From 15fb4c990a3357aac4f2cb1844b7f279fe3c5230 Mon Sep 17 00:00:00 2001 From: Seth Hoenig Date: Sat, 30 May 2020 09:29:47 -0500 Subject: [PATCH 1/2] deps: Switch to Go modules for dependency management This PR switches the Nomad repository from using govendor to Go modules for managing dependencies. Aspects of the Nomad workflow remain pretty much the same. The usual Makefile targets should continue to work as they always did. The API submodule simply defers to the parent Nomad version on the repository, keeping the semantics of API versioning that currently exists. --- .circleci/config.yml | 75 +- .circleci/config/commands/run-tests.yml | 7 +- .../config/jobs/build-darwin-binaries.yml | 2 +- .circleci/config/jobs/test-machine.yml | 4 + .circleci/config/workflows/build-test.yml | 2 +- .gitignore | 4 + GNUmakefile | 65 +- command/job_init.bindata_assetfs.go | 258 +- go.mod | 148 + go.sum | 1028 + .../host => lib/darwin}/include/smc.c | 0 .../host => lib/darwin}/include/smc.h | 0 tools/go.mod | 25 + tools/go.sum | 448 + tools/tools.go | 18 + vendor/cloud.google.com/go/CHANGES.md | 1383 + vendor/cloud.google.com/go/CODE_OF_CONDUCT.md | 44 + vendor/cloud.google.com/go/CONTRIBUTING.md | 301 + vendor/cloud.google.com/go/README.md | 227 + vendor/cloud.google.com/go/RELEASING.md | 49 + .../go/compute/metadata/.repo-metadata.json | 12 + .../go/compute/metadata/metadata.go | 13 + vendor/cloud.google.com/go/doc.go | 100 + vendor/cloud.google.com/go/go.mod | 27 + vendor/cloud.google.com/go/go.sum | 193 + .../go/iam/.repo-metadata.json | 12 + .../go/internal/version/update_version.sh | 0 vendor/cloud.google.com/go/issue_template.md | 17 + vendor/cloud.google.com/go/regen-gapic.sh | 163 + .../go/storage/.repo-metadata.json | 12 + vendor/cloud.google.com/go/storage/CHANGES.md | 6 + .../go/storage}/LICENSE | 0 vendor/cloud.google.com/go/storage/bucket.go | 13 +- vendor/cloud.google.com/go/storage/go.mod | 14 + vendor/cloud.google.com/go/storage/go.sum | 156 + .../go/storage/go_mod_tidy_hack.go | 22 + vendor/cloud.google.com/go/storage/hmac.go | 67 +- vendor/cloud.google.com/go/storage/reader.go | 34 +- vendor/cloud.google.com/go/storage/storage.go | 6 +- vendor/cloud.google.com/go/storage/writer.go | 27 +- vendor/cloud.google.com/go/tidyall.sh | 23 + vendor/cloud.google.com/go/tools.go | 33 + .../exporter/ocagent/.travis.yml | 18 + .../exporter/ocagent/CONTRIBUTING.md | 24 + .../exporter/ocagent/LICENSE | 201 + .../exporter/ocagent/README.md | 61 + .../exporter/ocagent/common.go | 38 + .../exporter/ocagent/connection.go | 97 + .../exporter/ocagent/go.mod | 10 + .../exporter/ocagent/go.sum | 130 + .../exporter/ocagent/nodeinfo.go | 46 + .../exporter/ocagent/ocagent.go | 496 + .../exporter/ocagent/options.go | 128 + .../exporter/ocagent/transform_spans.go | 248 + .../ocagent/transform_stats_to_metrics.go | 274 + .../exporter/ocagent/version.go | 17 + .../Azure/azure-sdk-for-go/LICENSE | 0 .../Azure/azure-sdk-for-go/NOTICE | 0 .../2015-06-15/network/applicationgateways.go | 28 +- .../network/mgmt/2015-06-15/network/client.go | 135 + .../expressroutecircuitauthorizations.go | 16 +- .../network/expressroutecircuitpeerings.go | 16 +- .../network/expressroutecircuits.go | 32 +- .../network/expressrouteserviceproviders.go | 4 +- .../2015-06-15/network/interfacesgroup.go | 32 +- .../mgmt/2015-06-15/network/loadbalancers.go | 20 +- .../network/localnetworkgateways.go | 16 +- .../network/mgmt/2015-06-15/network/models.go | 29 - .../2015-06-15/network/publicipaddresses.go | 20 +- .../network/mgmt/2015-06-15/network/routes.go | 16 +- .../mgmt/2015-06-15/network/routetables.go | 20 +- .../mgmt/2015-06-15/network/securitygroups.go | 20 +- .../mgmt/2015-06-15/network/securityrules.go | 16 +- .../mgmt/2015-06-15/network/subnets.go | 16 +- .../network/mgmt/2015-06-15/network/usages.go | 4 +- .../mgmt/2015-06-15/network/version.go | 0 .../virtualnetworkgatewayconnections.go | 28 +- .../network/virtualnetworkgateways.go | 50 +- .../2015-06-15/network/virtualnetworks.go | 20 +- .../Azure/azure-sdk-for-go/version/version.go | 21 + .../Azure/go-autorest/autorest/adal/README.md | 292 + .../Azure/go-autorest/autorest/adal/config.go | 91 + .../go-autorest/autorest/adal/devicetoken.go | 35 +- .../go-autorest/autorest/adal/persist.go | 0 .../Azure/go-autorest/autorest/adal/sender.go | 60 + .../Azure/go-autorest/autorest/adal/token.go | 985 + .../go-autorest/autorest/adal/version.go | 0 .../go-autorest/autorest/authorization.go | 59 +- .../Azure/go-autorest/autorest/autorest.go | 0 .../Azure/go-autorest/autorest/azure/async.go | 80 +- .../go-autorest/autorest/azure/auth/auth.go | 33 +- .../Azure/go-autorest/autorest/azure/azure.go | 19 +- .../go-autorest/autorest/azure/cli/profile.go | 6 +- .../go-autorest/autorest/azure/cli/token.go | 170 + .../autorest/azure/environments.go | 196 + .../autorest/azure/metadata_environment.go | 0 .../Azure/go-autorest/autorest/azure/rp.go | 12 +- .../Azure/go-autorest/autorest/client.go | 285 + .../Azure/go-autorest/autorest/date/date.go | 0 .../Azure/go-autorest/autorest/date/time.go | 0 .../go-autorest/autorest/date/timerfc1123.go | 0 .../go-autorest/autorest/date/unixtime.go | 0 .../go-autorest/autorest/date/utility.go | 0 .../Azure/go-autorest/autorest/error.go | 0 .../Azure/go-autorest/autorest/preparer.go | 88 +- .../Azure/go-autorest/autorest/responder.go | 19 - .../go-autorest/autorest/retriablerequest.go | 0 .../autorest/retriablerequest_1.7.go | 0 .../autorest/retriablerequest_1.8.go | 0 .../Azure/go-autorest/autorest/sender.go | 326 + .../Azure/go-autorest/autorest/to/convert.go | 147 + .../Azure/go-autorest/autorest/utility.go | 0 .../go-autorest/autorest/validation/error.go | 0 .../autorest/validation/validation.go | 408 + .../Azure/go-autorest/autorest/version.go | 41 + .../Azure/go-autorest/logger/logger.go | 0 .../Azure/go-autorest/tracing/tracing.go | 190 + vendor/github.com/BurntSushi/toml/.gitignore | 5 + vendor/github.com/BurntSushi/toml/.travis.yml | 15 + .../DataDog/datadog-go/statsd/README.md | 60 - .../DataDog/datadog-go/statsd/buffer.go | 130 + .../DataDog/datadog-go/statsd/buffer_pool.go | 40 + .../DataDog/datadog-go/statsd/event.go | 91 + .../DataDog/datadog-go/statsd/format.go | 232 + .../DataDog/datadog-go/statsd/noop.go | 91 + .../DataDog/datadog-go/statsd/options.go | 141 + .../DataDog/datadog-go/statsd/sender.go | 116 + .../datadog-go/statsd/service_check.go | 70 + .../DataDog/datadog-go/statsd/statsd.go | 757 +- .../DataDog/datadog-go/statsd/udp.go | 40 +- .../DataDog/datadog-go/statsd/uds.go | 70 +- .../github.com/LK4D4/joincontext/.travis.yml | 13 + .../github.com/Microsoft/go-winio/.gitignore | 1 + .../NVIDIA/gpu-monitoring-tools/CLA | 160 - .../NVIDIA/gpu-monitoring-tools/README.md | 34 - .../github.com/NYTimes/gziphandler/.gitignore | 1 + .../NYTimes/gziphandler/.travis.yml | 6 + vendor/github.com/NYTimes/gziphandler/gzip.go | 14 +- vendor/github.com/Nvveen/Gotty/LICENSE | 26 - vendor/github.com/Nvveen/Gotty/README | 5 - vendor/github.com/Nvveen/Gotty/TODO | 3 - vendor/github.com/Nvveen/Gotty/attributes.go | 514 - vendor/github.com/Nvveen/Gotty/gotty.go | 238 - vendor/github.com/Nvveen/Gotty/parser.go | 362 - vendor/github.com/Nvveen/Gotty/types.go | 23 - vendor/github.com/StackExchange/wmi/wmi.go | 62 +- .../github.com/agext/levenshtein/.gitignore | 2 + .../github.com/agext/levenshtein/.travis.yml | 70 + .../apparentlymart/go-textseg/LICENSE | 95 - .../go-textseg/v12/textseg/make_tables.go | 307 - .../v12/textseg/make_test_tables.go | 211 - vendor/github.com/appc/spec/LICENSE | 202 - .../appc/spec/schema/common/common.go | 40 - vendor/github.com/appc/spec/schema/doc.go | 25 - vendor/github.com/appc/spec/schema/image.go | 103 - vendor/github.com/appc/spec/schema/kind.go | 42 - vendor/github.com/appc/spec/schema/pod.go | 182 - .../appc/spec/schema/types/acidentifier.go | 145 - .../appc/spec/schema/types/ackind.go | 67 - .../appc/spec/schema/types/acname.go | 145 - .../appc/spec/schema/types/annotations.go | 106 - .../github.com/appc/spec/schema/types/app.go | 95 - .../github.com/appc/spec/schema/types/date.go | 60 - .../appc/spec/schema/types/dependencies.go | 58 - .../github.com/appc/spec/schema/types/doc.go | 18 - .../appc/spec/schema/types/environment.go | 110 - .../appc/spec/schema/types/errors.go | 49 - .../appc/spec/schema/types/event_handler.go | 61 - .../github.com/appc/spec/schema/types/exec.go | 46 - .../github.com/appc/spec/schema/types/hash.go | 118 - .../appc/spec/schema/types/isolator.go | 190 - .../schema/types/isolator_linux_specific.go | 533 - .../spec/schema/types/isolator_resources.go | 245 - .../appc/spec/schema/types/isolator_unix.go | 83 - .../appc/spec/schema/types/labels.go | 211 - .../appc/spec/schema/types/mountpoint.go | 92 - .../github.com/appc/spec/schema/types/port.go | 147 - .../appc/spec/schema/types/resource/README.md | 4 - .../appc/spec/schema/types/resource/amount.go | 298 - .../appc/spec/schema/types/resource/math.go | 327 - .../spec/schema/types/resource/quantity.go | 768 - .../spec/schema/types/resource/scale_int.go | 95 - .../appc/spec/schema/types/resource/suffix.go | 198 - .../appc/spec/schema/types/semver.go | 91 - .../github.com/appc/spec/schema/types/url.go | 71 - .../spec/schema/types/user_annotations.go | 18 - .../appc/spec/schema/types/user_labels.go | 18 - .../github.com/appc/spec/schema/types/uuid.go | 92 - .../appc/spec/schema/types/volume.go | 249 - vendor/github.com/appc/spec/schema/version.go | 39 - vendor/github.com/armon/circbuf/.gitignore | 22 + vendor/github.com/armon/circbuf/LICENSE | 0 vendor/github.com/armon/go-metrics/.gitignore | 24 + .../github.com/armon/go-metrics/.travis.yml | 13 + vendor/github.com/armon/go-radix/.gitignore | 22 + vendor/github.com/armon/go-radix/.travis.yml | 3 + vendor/github.com/armon/go-radix/go.mod | 1 + vendor/github.com/armon/go-radix/radix.go | 60 +- .../aws/credentials/processcreds/provider.go | 3 +- .../aws/aws-sdk-go/aws/ec2metadata/api.go | 16 +- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 55 +- .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../private/protocol/ec2query/build.go | 0 .../private/protocol/ec2query/unmarshal.go | 0 .../aws/aws-sdk-go/service/ec2/api.go | 0 .../aws-sdk-go/service/ec2/customizations.go | 0 .../aws/aws-sdk-go/service/ec2/doc.go | 0 .../aws/aws-sdk-go/service/ec2/errors.go | 0 .../aws/aws-sdk-go/service/ec2/service.go | 0 .../aws/aws-sdk-go/service/ec2/waiters.go | 0 .../beorn7/perks/quantile/stream.go | 34 +- .../github.com/bgentry/speakeasy/.gitignore | 2 + vendor/github.com/bgentry/speakeasy/LICENSE | 24 + .../github.com/bgentry/speakeasy/speakeasy.go | 14 +- .../bgentry/speakeasy/speakeasy_unix.go | 2 +- .../bgentry/speakeasy/speakeasy_windows.go | 8 +- vendor/github.com/boltdb/bolt/.gitignore | 4 + .../opencensus-proto/AUTHORS | 1 + .../opencensus-proto}/LICENSE | 0 .../gen-go/agent/common/v1/common.pb.go | 361 + .../agent/metrics/v1/metrics_service.pb.go | 275 + .../agent/metrics/v1/metrics_service.pb.gw.go | 150 + .../gen-go/agent/trace/v1/trace_service.pb.go | 457 + .../agent/trace/v1/trace_service.pb.gw.go | 150 + .../gen-go/metrics/v1/metrics.pb.go | 1127 + .../gen-go/resource/v1/resource.pb.go | 100 + .../gen-go/trace/v1/trace.pb.go | 1553 + .../gen-go/trace/v1/trace_config.pb.go | 359 + .../github.com/cespare/xxhash/v2/.travis.yml | 8 + .../github.com/cespare/xxhash/v2/LICENSE.txt | 22 + vendor/github.com/cespare/xxhash/v2/README.md | 67 + vendor/github.com/cespare/xxhash/v2/go.mod | 3 + .../{godbus/dbus => cespare/xxhash/v2}/go.sum | 0 vendor/github.com/cespare/xxhash/v2/xxhash.go | 236 + .../cespare/xxhash/v2/xxhash_amd64.go | 13 + .../cespare/xxhash/v2/xxhash_amd64.s | 215 + .../cespare/xxhash/v2/xxhash_other.go | 76 + .../cespare/xxhash/v2/xxhash_safe.go | 15 + .../cespare/xxhash/v2/xxhash_unsafe.go | 46 + .../circonus-gometrics/.gitignore | 11 + .../circonus-gometrics/CHANGELOG.md | 13 + .../circonus-gometrics/api/broker.go | 1 + .../circonus-gometrics/api/graph.go | 83 +- .../circonusllhist/circonusllhist.go | 460 +- .../github.com/containerd/console/.travis.yml | 27 + .../github.com/containerd/continuity/AUTHORS | 16 + .../continuity/pathdriver/path_driver.go | 101 - .../containerd/continuity/sysx/generate.sh | 0 .../github.com/containerd/go-cni/.travis.yml | 22 + vendor/github.com/coreos/go-semver/NOTICE | 5 + .../coreos/go-systemd/dbus/methods.go | 6 + vendor/github.com/creack/pty/Dockerfile.riscv | 14 - vendor/github.com/creack/pty/LICENSE | 23 - vendor/github.com/creack/pty/README.md | 100 - vendor/github.com/creack/pty/doc.go | 16 - vendor/github.com/creack/pty/go.mod | 4 - vendor/github.com/creack/pty/ioctl.go | 13 - vendor/github.com/creack/pty/ioctl_bsd.go | 39 - vendor/github.com/creack/pty/ioctl_solaris.go | 30 - vendor/github.com/creack/pty/mktypes.bash | 19 - vendor/github.com/creack/pty/pty_darwin.go | 65 - vendor/github.com/creack/pty/pty_dragonfly.go | 80 - vendor/github.com/creack/pty/pty_freebsd.go | 78 - vendor/github.com/creack/pty/pty_linux.go | 51 - vendor/github.com/creack/pty/pty_openbsd.go | 33 - vendor/github.com/creack/pty/pty_solaris.go | 139 - .../github.com/creack/pty/pty_unsupported.go | 11 - vendor/github.com/creack/pty/run.go | 57 - .../creack/pty/test_crosscompile.sh | 50 - vendor/github.com/creack/pty/util.go | 64 - vendor/github.com/creack/pty/util_solaris.go | 51 - vendor/github.com/creack/pty/ztypes_386.go | 9 - vendor/github.com/creack/pty/ztypes_amd64.go | 9 - vendor/github.com/creack/pty/ztypes_arm.go | 9 - vendor/github.com/creack/pty/ztypes_arm64.go | 11 - .../creack/pty/ztypes_dragonfly_amd64.go | 14 - .../creack/pty/ztypes_freebsd_386.go | 13 - .../creack/pty/ztypes_freebsd_amd64.go | 14 - .../creack/pty/ztypes_freebsd_arm.go | 13 - .../creack/pty/ztypes_freebsd_arm64.go | 13 - vendor/github.com/creack/pty/ztypes_mipsx.go | 12 - .../creack/pty/ztypes_openbsd_386.go | 13 - .../creack/pty/ztypes_openbsd_amd64.go | 13 - vendor/github.com/creack/pty/ztypes_ppc64.go | 11 - .../github.com/creack/pty/ztypes_ppc64le.go | 11 - vendor/github.com/creack/pty/ztypes_riscvx.go | 11 - vendor/github.com/creack/pty/ztypes_s390x.go | 11 - .../cyphar/filepath-securejoin/.travis.yml | 19 + .../github.com/davecgh/go-spew/spew/bypass.go | 187 +- .../davecgh/go-spew/spew/bypasssafe.go | 2 +- .../denverdino/aliyungo/LICENSE.txt | 0 .../denverdino/aliyungo/common/client.go | 550 + .../denverdino/aliyungo/common/endpoint.go | 208 + .../denverdino/aliyungo/common/endpoints.xml | 21 + .../denverdino/aliyungo/common/regions.go | 55 + .../denverdino/aliyungo/common/request.go | 105 + .../denverdino/aliyungo/common/types.go | 107 + .../denverdino/aliyungo/common/version.go | 0 .../denverdino/aliyungo/ecs/client.go | 124 + .../denverdino/aliyungo/ecs/disks.go | 25 +- .../github.com/denverdino/aliyungo/ecs/eni.go | 183 + .../denverdino/aliyungo/ecs/forward_entry.go | 0 .../denverdino/aliyungo/ecs/images.go | 347 + .../denverdino/aliyungo/ecs/instance_types.go | 17 +- .../denverdino/aliyungo/ecs/instances.go | 832 + .../denverdino/aliyungo/ecs/monitoring.go | 0 .../denverdino/aliyungo/ecs/nat_gateway.go | 19 +- .../denverdino/aliyungo/ecs/networks.go | 41 +- .../denverdino/aliyungo/ecs/regions.go | 0 .../denverdino/aliyungo/ecs/route_tables.go | 4 +- .../aliyungo/ecs/router_interface.go | 32 +- .../aliyungo/ecs/security_groups.go | 34 +- .../denverdino/aliyungo/ecs/snapshots.go | 142 + .../denverdino/aliyungo/ecs/snat_entry.go | 2 +- .../denverdino/aliyungo/ecs/ssh_key_pair.go | 10 +- .../denverdino/aliyungo/ecs/tags.go | 0 .../denverdino/aliyungo/ecs/vpcs.go | 0 .../denverdino/aliyungo/ecs/vrouters.go | 0 .../denverdino/aliyungo/ecs/vswitches.go | 0 .../denverdino/aliyungo/ecs/zones.go | 158 + .../denverdino/aliyungo/util/attempt.go | 0 .../denverdino/aliyungo/util/encoding.go | 331 + .../denverdino/aliyungo/util/iso6801.go | 0 .../denverdino/aliyungo/util/signature.go | 1 - .../denverdino/aliyungo/util/util.go | 185 + vendor/github.com/dgrijalva/jwt-go/.gitignore | 4 + .../github.com/dgrijalva/jwt-go/.travis.yml | 13 + .../github.com => }/dgrijalva/jwt-go/LICENSE | 0 .../dgrijalva/jwt-go/MIGRATION_GUIDE.md | 0 vendor/github.com/dgrijalva/jwt-go/README.md | 100 + .../dgrijalva/jwt-go/VERSION_HISTORY.md | 7 + .../dgrijalva/jwt-go/claims.go | 0 .../github.com => }/dgrijalva/jwt-go/doc.go | 0 .../github.com => }/dgrijalva/jwt-go/ecdsa.go | 1 + .../dgrijalva/jwt-go/ecdsa_utils.go | 0 .../dgrijalva/jwt-go/errors.go | 0 .../github.com => }/dgrijalva/jwt-go/hmac.go | 3 +- .../dgrijalva/jwt-go/map_claims.go | 0 .../github.com => }/dgrijalva/jwt-go/none.go | 0 vendor/github.com/dgrijalva/jwt-go/parser.go | 148 + .../github.com => }/dgrijalva/jwt-go/rsa.go | 5 +- .../dgrijalva/jwt-go/rsa_pss.go | 0 .../github.com/dgrijalva/jwt-go/rsa_utils.go | 101 + .../dgrijalva/jwt-go/signing_method.go | 0 .../github.com => }/dgrijalva/jwt-go/token.go | 0 .../github.com/digitalocean/godo/.gitignore | 1 + .../github.com/digitalocean/godo/.travis.yml | 8 + .../github.com/digitalocean/godo/CHANGELOG.md | 102 + .../digitalocean/godo/CONTRIBUTING.md | 48 + .../digitalocean/godo/LICENSE.txt | 0 vendor/github.com/digitalocean/godo/README.md | 150 + .../github.com/digitalocean/godo/account.go | 60 + .../digitalocean/godo/action.go | 3 +- vendor/github.com/digitalocean/godo/cdn.go | 214 + .../digitalocean/godo/certificates.go | 26 +- .../github.com/digitalocean/godo/databases.go | 614 + vendor/github.com/digitalocean/godo/doc.go | 11 + .../digitalocean/godo/domains.go | 29 +- .../digitalocean/godo/droplet_actions.go | 10 +- .../digitalocean/godo/droplets.go | 7 +- .../digitalocean/godo/errors.go | 0 .../digitalocean/godo/firewalls.go | 7 +- .../digitalocean/godo/floating_ips.go | 7 +- .../digitalocean/godo/floating_ips_actions.go | 3 +- .../github.com => }/digitalocean/godo/godo.go | 62 +- .../digitalocean/godo/image_actions.go | 3 +- vendor/github.com/digitalocean/godo/images.go | 241 + vendor/github.com/digitalocean/godo/keys.go | 226 + .../digitalocean/godo/kubernetes.go | 432 + .../digitalocean/godo/links.go | 3 +- .../digitalocean/godo/load_balancers.go | 40 +- .../github.com/digitalocean/godo/projects.go | 302 + .../github.com/digitalocean/godo/regions.go | 64 + vendor/github.com/digitalocean/godo/sizes.go | 68 + .../github.com/digitalocean/godo/snapshots.go | 140 + .../github.com/digitalocean/godo/storage.go | 253 + .../digitalocean/godo/storage_actions.go | 3 +- .../digitalocean/godo/strings.go | 10 + vendor/github.com/digitalocean/godo/tags.go | 231 + .../digitalocean/godo/timestamp.go | 0 .../github.com/dimchansky/utfbom/.gitignore | 37 + .../github.com/dimchansky/utfbom/.travis.yml | 18 + .../github.com => }/dimchansky/utfbom/LICENSE | 0 .../dimchansky/utfbom/README.md | 0 .../github.com => }/dimchansky/utfbom/go.mod | 0 .../dimchansky/utfbom/utfbom.go | 0 vendor/github.com/docker/cli/AUTHORS | 716 + .../github.com/docker/distribution/.gitignore | 38 + .../docker/distribution/.gometalinter.json | 16 + .../github.com/docker/distribution/.mailmap | 32 + .../docker/distribution/.travis.yml | 51 + vendor/github.com/docker/docker/AUTHORS | 2135 + .../docker/docker/api/types/client.go | 8 +- .../api/types/container/container_changes.go | 3 +- .../api/types/container/container_create.go | 3 +- .../api/types/container/container_top.go | 3 +- .../api/types/container/container_update.go | 3 +- .../api/types/container/container_wait.go | 3 +- .../docker/api/types/container/host_config.go | 34 +- .../docker/api/types/error_response_ext.go | 6 + .../docker/docker/api/types/filters/parse.go | 8 +- .../docker/api/types/network/network.go | 2 +- .../docker/api/types/registry/registry.go | 2 +- .../docker/api/types/swarm/container.go | 13 +- .../api/types/swarm/runtime/plugin.pb.go | 110 +- .../api/types/swarm/runtime/plugin.proto | 1 + .../docker/docker/api/types/swarm/service.go | 82 +- .../docker/docker/api/types/swarm/task.go | 6 + .../docker/docker/api/types/types.go | 12 +- .../docker/docker/oci/caps/defaults.go | 21 + .../docker/docker/opts/address_pools.go | 84 - vendor/github.com/docker/docker/opts/env.go | 48 - vendor/github.com/docker/docker/opts/hosts.go | 176 - .../docker/docker/opts/hosts_unix.go | 8 - .../docker/docker/opts/hosts_windows.go | 4 - vendor/github.com/docker/docker/opts/ip.go | 47 - vendor/github.com/docker/docker/opts/opts.go | 337 - .../docker/docker/opts/opts_unix.go | 6 - .../docker/docker/opts/opts_windows.go | 56 - .../docker/docker/opts/quotedstring.go | 37 - .../github.com/docker/docker/opts/runtime.go | 79 - .../github.com/docker/docker/opts/ulimit.go | 81 - .../docker/pkg/homedir/homedir_linux.go | 16 - .../docker/pkg/homedir/homedir_others.go | 6 - .../docker/docker/pkg/homedir/homedir_unix.go | 12 +- .../docker/docker/pkg/ioutils/bytespipe.go | 3 +- .../docker/pkg/jsonmessage/jsonmessage.go | 12 +- .../docker/docker/pkg/mount/mount.go | 30 +- .../docker/pkg/mount/mountinfo_freebsd.go | 5 +- .../docker/pkg/mount/mountinfo_linux.go | 1 - .../docker/docker/pkg/pools/pools.go | 10 +- .../docker/docker/pkg/term/term_windows.go | 2 +- .../docker/docker/pkg/term/windows/windows.go | 3 +- .../github.com/docker/docker/registry/auth.go | 6 +- .../docker/docker/registry/endpoint_v1.go | 5 +- .../docker/docker/registry/registry.go | 12 +- .../resumable/resumablerequestreader.go | 4 +- .../docker/docker/registry/session.go | 55 +- .../docker/volume/mounts/lcow_parser.go | 34 - .../docker/volume/mounts/linux_parser.go | 423 - .../docker/docker/volume/mounts/mounts.go | 181 - .../docker/docker/volume/mounts/parser.go | 47 - .../docker/docker/volume/mounts/validate.go | 28 - .../docker/volume/mounts/volume_copy.go | 23 - .../docker/volume/mounts/volume_unix.go | 18 - .../docker/volume/mounts/volume_windows.go | 8 - .../docker/volume/mounts/windows_parser.go | 456 - .../github.com/docker/docker/volume/volume.go | 69 - .../docker/go-connections/sockets/README.md | 0 .../go-connections/sockets/inmem_socket.go | 81 - .../docker/go-connections/sockets/proxy.go | 51 - .../docker/go-connections/sockets/sockets.go | 38 - .../go-connections/sockets/sockets_unix.go | 35 - .../go-connections/sockets/sockets_windows.go | 27 - .../go-connections/sockets/tcp_socket.go | 22 - .../go-connections/sockets/unix_socket.go | 32 - .../docker/go-units/{LICENSE.code => LICENSE} | 0 .../github.com/docker/go-units/LICENSE.docs | 425 - vendor/github.com/docker/go-units/MAINTAINERS | 33 +- vendor/github.com/docker/go-units/README.md | 10 +- vendor/github.com/docker/go-units/circle.yml | 2 +- vendor/github.com/docker/go-units/duration.go | 6 +- vendor/github.com/docker/go-units/size.go | 29 +- vendor/github.com/docker/go-units/ulimit.go | 9 +- vendor/github.com/docker/libnetwork/LICENSE | 202 - .../docker/libnetwork/ipamutils/utils.go | 135 - .../github.com/dustin/go-humanize/.travis.yml | 21 + .../dustin/go-humanize/README.markdown | 60 +- .../github.com/dustin/go-humanize/bigbytes.go | 21 +- vendor/github.com/dustin/go-humanize/bytes.go | 21 +- vendor/github.com/dustin/go-humanize/comma.go | 17 +- .../github.com/dustin/go-humanize/commaf.go | 40 + vendor/github.com/dustin/go-humanize/ftoa.go | 25 +- .../github.com/dustin/go-humanize/humanize.go | 4 +- .../github.com/dustin/go-humanize/number.go | 2 +- vendor/github.com/dustin/go-humanize/si.go | 29 +- vendor/github.com/dustin/go-humanize/times.go | 74 +- .../elazarl/go-bindata-assetfs/README.md | 32 +- .../elazarl/go-bindata-assetfs/assetfs.go | 14 +- .../elazarl/go-bindata-assetfs/doc.go | 2 +- vendor/github.com/fatih/color/Gopkg.lock | 27 - vendor/github.com/fatih/color/Gopkg.toml | 30 - vendor/github.com/fatih/color/README.md | 11 +- vendor/github.com/fatih/color/color.go | 3 + vendor/github.com/fatih/color/go.mod | 8 + vendor/github.com/fatih/color/go.sum | 8 + .../fsouza/go-dockerclient/.gitattributes | 1 + .../fsouza/go-dockerclient/.gitignore | 2 + .../fsouza/go-dockerclient/.golangci.yaml | 33 + vendor/github.com/go-ole/go-ole/.travis.yml | 9 + vendor/github.com/go-ole/go-ole/LICENSE | 21 + vendor/github.com/go-ole/go-ole/appveyor.yml | 11 +- vendor/github.com/go-ole/go-ole/com.go | 4 +- .../go-ole/go-ole/idispatch_windows.go | 4 + .../go-ole/oleutil/connection_windows.go | 1 + .../go-ole/go-ole/oleutil/oleutil.go | 38 + vendor/github.com/godbus/dbus/.travis.yml | 46 + vendor/github.com/godbus/dbus/auth.go | 4 +- vendor/github.com/godbus/dbus/auth_sha1.go | 2 +- vendor/github.com/godbus/dbus/conn.go | 167 +- vendor/github.com/godbus/dbus/conn_other.go | 6 +- vendor/github.com/godbus/dbus/conn_unix.go | 5 +- vendor/github.com/godbus/dbus/dbus.go | 1 - vendor/github.com/godbus/dbus/decoder.go | 53 +- .../github.com/godbus/dbus/default_handler.go | 115 +- vendor/github.com/godbus/dbus/doc.go | 2 +- vendor/github.com/godbus/dbus/encoder.go | 2 +- vendor/github.com/godbus/dbus/export.go | 2 +- vendor/github.com/godbus/dbus/go.mod | 4 +- vendor/github.com/godbus/dbus/match.go | 62 - vendor/github.com/godbus/dbus/object.go | 62 +- .../godbus/dbus/server_interfaces.go | 8 - .../github.com/godbus/dbus/transport_tcp.go | 2 + .../github.com/godbus/dbus/transport_unix.go | 2 +- vendor/github.com/godbus/dbus/variant.go | 4 +- .../github.com/godbus/dbus/variant_lexer.go | 8 +- vendor/github.com/gogo/protobuf/AUTHORS | 15 + vendor/github.com/gogo/protobuf/CONTRIBUTORS | 23 + vendor/github.com/gogo/protobuf/LICENSE | 5 +- .../github.com/gogo/protobuf/proto/Makefile | 4 +- .../github.com/gogo/protobuf/proto/clone.go | 46 +- .../gogo/protobuf/proto/custom_gogo.go | 39 + .../github.com/gogo/protobuf/proto/decode.go | 677 +- .../gogo/protobuf/proto/decode_gogo.go | 172 - .../protobuf/proto/deprecated.go | 0 .../golang => gogo}/protobuf/proto/discard.go | 8 +- .../gogo/protobuf/proto/duration_gogo.go | 154 - .../github.com/gogo/protobuf/proto/encode.go | 1211 +- .../gogo/protobuf/proto/encode_gogo.go | 317 - .../github.com/gogo/protobuf/proto/equal.go | 30 +- .../gogo/protobuf/proto/extensions.go | 284 +- .../gogo/protobuf/proto/extensions_gogo.go | 181 +- vendor/github.com/gogo/protobuf/proto/lib.go | 184 +- .../gogo/protobuf/proto/lib_gogo.go | 8 + .../gogo/protobuf/proto/message_set.go | 138 +- .../gogo/protobuf/proto/pointer_reflect.go | 357 + .../protobuf/proto/pointer_reflect_gogo.go | 59 + .../gogo/protobuf/proto/pointer_unsafe.go | 366 +- .../protobuf/proto/pointer_unsafe_gogo.go | 100 +- .../gogo/protobuf/proto/properties.go | 579 +- .../gogo/protobuf/proto/properties_gogo.go | 81 +- .../protobuf/proto/table_marshal.go | 323 +- .../gogo/protobuf/proto/table_marshal_gogo.go | 388 + .../protobuf/proto/table_merge.go | 32 +- .../protobuf/proto/table_unmarshal.go | 280 +- .../protobuf/proto/table_unmarshal_gogo.go | 385 + vendor/github.com/gogo/protobuf/proto/text.go | 69 +- .../gogo/protobuf/proto/text_parser.go | 103 +- .../gogo/protobuf/proto/timestamp_gogo.go | 180 - .../gogo/protobuf/proto/wrappers.go | 1888 + .../gogo/protobuf/proto/wrappers_gogo.go | 113 + .../x/oauth2 => golang/protobuf}/AUTHORS | 0 .../x/oauth2 => golang/protobuf}/CONTRIBUTORS | 0 .../golang/protobuf/jsonpb/jsonpb.go | 1290 + .../golang/protobuf/protoc-gen-go/doc.go | 51 + .../protoc-gen-go/generator/generator.go | 2808 + .../generator/internal/remap/remap.go | 117 + .../protobuf/protoc-gen-go/grpc/grpc.go | 545 + .../protobuf/protoc-gen-go/link_grpc.go | 34 + .../golang/protobuf/protoc-gen-go/main.go | 98 + .../protoc-gen-go/plugin/plugin.pb.go | 369 + .../protoc-gen-go/plugin/plugin.pb.golden | 83 + .../protoc-gen-go/plugin/plugin.proto | 167 + .../protobuf/ptypes/struct/struct.pb.go | 338 + .../protobuf/ptypes/struct/struct.proto | 95 + vendor/github.com/golang/snappy/.gitignore | 16 + vendor/github.com/golang/snappy/encode.go | 2 +- .../github.com/golang/snappy/encode_amd64.go | 2 +- vendor/github.com/golang/snappy/go.mod | 1 + vendor/github.com/golang/snappy/snappy.go | 17 +- vendor/github.com/google/btree/.travis.yml | 1 + .../google/go-cmp/cmp/cmpopts/equate.go | 73 +- .../google/go-cmp/cmp/cmpopts/ignore.go | 73 +- .../google/go-cmp/cmp/cmpopts/sort.go | 37 +- .../google/go-cmp/cmp/cmpopts/sort_go17.go | 46 - .../google/go-cmp/cmp/cmpopts/sort_go18.go | 31 - .../google/go-cmp/cmp/cmpopts/xform.go | 35 + .../github.com/google/go-cmp/cmp/compare.go | 624 +- .../google/go-cmp/cmp/export_panic.go | 15 + .../google/go-cmp/cmp/export_unsafe.go | 25 + .../go-cmp/cmp/internal/diff/debug_disable.go | 2 +- .../go-cmp/cmp/internal/diff/debug_enable.go | 6 +- .../google/go-cmp/cmp/internal/diff/diff.go | 49 +- .../google/go-cmp/cmp/internal/flags/flags.go | 9 + .../cmp/internal/flags/toolchain_legacy.go | 10 + .../cmp/internal/flags/toolchain_recent.go | 10 + .../go-cmp/cmp/internal/function/func.go | 64 +- .../go-cmp/cmp/internal/value/format.go | 259 - .../cmp/internal/value/pointer_purego.go | 23 + .../cmp/internal/value/pointer_unsafe.go | 26 + .../google/go-cmp/cmp/internal/value/sort.go | 11 +- .../google/go-cmp/cmp/internal/value/zero.go | 48 + .../github.com/google/go-cmp/cmp/options.go | 325 +- vendor/github.com/google/go-cmp/cmp/path.go | 422 +- vendor/github.com/google/go-cmp/cmp/report.go | 51 + .../google/go-cmp/cmp/report_compare.go | 296 + .../google/go-cmp/cmp/report_reflect.go | 278 + .../google/go-cmp/cmp/report_slices.go | 333 + .../google/go-cmp/cmp/report_text.go | 387 + .../google/go-cmp/cmp/report_value.go | 121 + .../github.com/google/go-cmp/cmp/reporter.go | 53 - .../google/go-cmp/cmp/unsafe_reflect.go | 23 - .../google/go-querystring/query/encode.go | 0 .../googleapis/gax-go/{ => v2}/LICENSE | 0 .../gophercloud/gophercloud/.gitignore | 3 + .../gophercloud/gophercloud/.travis.yml | 21 + .../gophercloud/gophercloud/.zuul.yaml | 86 + .../gophercloud/gophercloud/CHANGELOG.md | 0 .../gophercloud/gophercloud/LICENSE | 0 .../gophercloud/gophercloud/README.md | 159 + .../gophercloud/gophercloud/auth_options.go | 75 +- .../gophercloud/gophercloud/doc.go | 0 .../gophercloud/endpoint_search.go | 0 .../gophercloud/gophercloud/errors.go | 453 + .../gophercloud/openstack/auth_env.go | 85 + .../gophercloud/openstack/client.go | 422 + .../openstack/compute/v2/flavors/doc.go | 137 + .../openstack/compute/v2/flavors/requests.go | 357 + .../openstack/compute/v2/flavors/results.go | 252 + .../openstack/compute/v2/flavors/urls.go | 49 + .../openstack/compute/v2/images/doc.go | 0 .../openstack/compute/v2/images/requests.go | 0 .../openstack/compute/v2/images/results.go | 0 .../openstack/compute/v2/images/urls.go | 0 .../openstack/compute/v2/servers/doc.go | 0 .../openstack/compute/v2/servers/errors.go | 0 .../openstack/compute/v2/servers/requests.go | 794 + .../openstack/compute/v2/servers/results.go | 414 + .../openstack/compute/v2/servers/urls.go | 0 .../openstack/compute/v2/servers/util.go | 0 .../gophercloud/gophercloud/openstack/doc.go | 0 .../openstack/endpoint_location.go | 2 +- .../gophercloud/openstack/errors.go | 0 .../openstack/identity/v2/tenants/doc.go | 0 .../openstack/identity/v2/tenants/requests.go | 0 .../openstack/identity/v2/tenants/results.go | 0 .../openstack/identity/v2/tenants/urls.go | 0 .../openstack/identity/v2/tokens/doc.go | 0 .../openstack/identity/v2/tokens/requests.go | 0 .../openstack/identity/v2/tokens/results.go | 0 .../openstack/identity/v2/tokens/urls.go | 0 .../openstack/identity/v3/tokens/doc.go | 0 .../openstack/identity/v3/tokens/requests.go | 153 + .../openstack/identity/v3/tokens/results.go | 171 + .../openstack/identity/v3/tokens/urls.go | 0 .../openstack/utils/base_endpoint.go | 28 + .../openstack/utils/choose_version.go | 31 +- .../gophercloud/pagination/http.go | 0 .../gophercloud/pagination/linked.go | 0 .../gophercloud/pagination/marker.go | 0 .../gophercloud/pagination/pager.go | 33 +- .../gophercloud/gophercloud/pagination/pkg.go | 0 .../gophercloud/pagination/single.go | 0 .../gophercloud/gophercloud/params.go | 475 + .../gophercloud/provider_client.go | 391 + .../gophercloud/gophercloud/results.go | 446 + .../gophercloud/gophercloud/service_client.go | 28 + .../gophercloud/gophercloud/util.go | 0 vendor/github.com/gorilla/context/LICENSE | 27 - vendor/github.com/gorilla/context/README.md | 10 - vendor/github.com/gorilla/context/context.go | 143 - vendor/github.com/gorilla/context/doc.go | 88 - .../github.com/gorilla/mux/ISSUE_TEMPLATE.md | 11 - vendor/github.com/gorilla/mux/README.md | 176 +- .../github.com/gorilla/mux/context_gorilla.go | 26 - .../github.com/gorilla/mux/context_native.go | 24 - vendor/github.com/gorilla/mux/doc.go | 2 +- vendor/github.com/gorilla/mux/go.mod | 2 + vendor/github.com/gorilla/mux/middleware.go | 56 +- vendor/github.com/gorilla/mux/mux.go | 147 +- vendor/github.com/gorilla/mux/regexp.go | 110 +- vendor/github.com/gorilla/mux/route.go | 177 +- vendor/github.com/gorilla/mux/test_helpers.go | 2 +- .../github.com/gorilla/websocket/.gitignore | 25 + vendor/github.com/gorilla/websocket/README.md | 10 +- vendor/github.com/gorilla/websocket/conn.go | 77 +- vendor/github.com/gorilla/websocket/doc.go | 6 +- vendor/github.com/gorilla/websocket/go.mod | 2 + vendor/github.com/gorilla/websocket/go.sum | 2 - .../github.com/gorilla/websocket/prepared.go | 4 +- vendor/github.com/gorilla/websocket/server.go | 2 +- .../grpc-ecosystem/grpc-gateway/LICENSE.txt | 27 + .../grpc-gateway/internal/BUILD.bazel | 22 + .../grpc-gateway/internal/stream_chunk.pb.go | 118 + .../grpc-gateway/internal/stream_chunk.proto | 15 + .../grpc-gateway/runtime/BUILD.bazel | 84 + .../grpc-gateway/runtime/context.go | 210 + .../grpc-gateway/runtime/convert.go | 312 + .../grpc-gateway/runtime/doc.go | 5 + .../grpc-gateway/runtime/errors.go | 145 + .../grpc-gateway/runtime/fieldmask.go | 70 + .../grpc-gateway/runtime/handler.go | 209 + .../runtime/marshal_httpbodyproto.go | 43 + .../grpc-gateway/runtime/marshal_json.go | 45 + .../grpc-gateway/runtime/marshal_jsonpb.go | 250 + .../grpc-gateway/runtime/marshal_proto.go | 62 + .../grpc-gateway/runtime/marshaler.go | 48 + .../runtime/marshaler_registry.go | 91 + .../grpc-gateway/runtime/mux.go | 289 + .../grpc-gateway/runtime/pattern.go | 227 + .../grpc-gateway/runtime/proto2_convert.go | 80 + .../grpc-gateway/runtime/proto_errors.go | 106 + .../grpc-gateway/runtime/query.go | 392 + .../grpc-gateway/utilities/BUILD.bazel | 21 + .../grpc-gateway/utilities/doc.go | 2 + .../grpc-gateway/utilities/pattern.go | 22 + .../grpc-gateway/utilities/readerfactory.go | 20 + .../grpc-gateway/utilities/trie.go | 177 + .../hashicorp/consul-template/CHANGELOG.md | 1087 - .../hashicorp/consul-template/Makefile | 253 - .../hashicorp/consul-template/README.md | 2572 - .../hashicorp/consul-template/cli.go | 799 - .../hashicorp/consul-template/flags.go | 56 - .../hashicorp/consul-template/go.mod | 43 - .../hashicorp/consul-template/go.sum | 227 - .../consul-template/logging/logging.go | 88 - .../consul-template/logging/syslog.go | 53 - .../hashicorp/consul-template/main.go | 8 - .../github.com/hashicorp/consul/api/LICENSE | 354 + .../consul/api/config_entry_discoverychain.go | 2 - vendor/github.com/hashicorp/consul/api/go.sum | 2 + .../github.com/hashicorp/consul/sdk/LICENSE | 354 + vendor/github.com/hashicorp/errwrap/README.md | 2 +- vendor/github.com/hashicorp/errwrap/go.mod | 1 + .../hashicorp/go-cleanhttp/cleanhttp.go | 13 +- .../github.com/hashicorp/go-cleanhttp/go.mod | 1 + .../hashicorp/go-cleanhttp/handlers.go | 48 + .../hashicorp/go-connlimit/connlimit.go | 29 +- .../hashicorp/go-discover/.gitignore | 6 + .../hashicorp/go-discover/.travis.yml | 10 + .../github.com/hashicorp/go-discover/go.mod | 2 - .../github.com/denverdino/aliyungo/README.md | 179 - .../denverdino/aliyungo/common/client.go | 357 - .../denverdino/aliyungo/common/endpoint.go | 118 - .../denverdino/aliyungo/common/regions.go | 34 - .../denverdino/aliyungo/common/request.go | 101 - .../denverdino/aliyungo/common/types.go | 89 - .../denverdino/aliyungo/ecs/client.go | 74 - .../denverdino/aliyungo/ecs/images.go | 323 - .../denverdino/aliyungo/ecs/instances.go | 681 - .../denverdino/aliyungo/ecs/snapshots.go | 140 - .../denverdino/aliyungo/ecs/zones.go | 103 - .../denverdino/aliyungo/util/encoding.go | 314 - .../denverdino/aliyungo/util/util.go | 147 - .../provider/aliyun/vendor/vendor.json | 8 - .../github.com/aws/aws-sdk-go/NOTICE.txt | 3 - .../aws/aws-sdk-go/aws/awserr/error.go | 164 - .../aws/aws-sdk-go/aws/awserr/types.go | 221 - .../aws/aws-sdk-go/aws/awsutil/copy.go | 108 - .../aws/aws-sdk-go/aws/awsutil/equal.go | 27 - .../aws/aws-sdk-go/aws/awsutil/path_value.go | 221 - .../aws/aws-sdk-go/aws/awsutil/prettify.go | 113 - .../aws-sdk-go/aws/awsutil/string_value.go | 88 - .../aws/aws-sdk-go/aws/client/client.go | 97 - .../aws-sdk-go/aws/client/default_retryer.go | 177 - .../aws/aws-sdk-go/aws/client/logger.go | 194 - .../aws/client/metadata/client_info.go | 14 - .../aws-sdk-go/aws/client/no_op_retryer.go | 28 - .../github.com/aws/aws-sdk-go/aws/config.go | 564 - .../aws/aws-sdk-go/aws/context_1_5.go | 37 - .../aws/aws-sdk-go/aws/context_1_9.go | 11 - .../aws-sdk-go/aws/context_background_1_5.go | 56 - .../aws-sdk-go/aws/context_background_1_7.go | 20 - .../aws/aws-sdk-go/aws/context_sleep.go | 24 - .../aws/aws-sdk-go/aws/convert_types.go | 918 - .../aws-sdk-go/aws/corehandlers/handlers.go | 230 - .../aws/corehandlers/param_validator.go | 17 - .../aws-sdk-go/aws/corehandlers/user_agent.go | 37 - .../aws/credentials/chain_provider.go | 100 - .../aws-sdk-go/aws/credentials/credentials.go | 299 - .../ec2rolecreds/ec2_role_provider.go | 180 - .../aws/credentials/endpointcreds/provider.go | 203 - .../aws/credentials/env_provider.go | 74 - .../aws-sdk-go/aws/credentials/example.ini | 12 - .../aws/credentials/processcreds/provider.go | 425 - .../shared_credentials_provider.go | 150 - .../aws/credentials/static_provider.go | 55 - .../stscreds/assume_role_provider.go | 312 - .../stscreds/web_identity_provider.go | 100 - .../github.com/aws/aws-sdk-go/aws/csm/doc.go | 69 - .../aws/aws-sdk-go/aws/csm/enable.go | 89 - .../aws/aws-sdk-go/aws/csm/metric.go | 109 - .../aws/aws-sdk-go/aws/csm/metric_chan.go | 55 - .../aws-sdk-go/aws/csm/metric_exception.go | 26 - .../aws/aws-sdk-go/aws/csm/reporter.go | 264 - .../aws/aws-sdk-go/aws/defaults/defaults.go | 207 - .../aws-sdk-go/aws/defaults/shared_config.go | 27 - .../github.com/aws/aws-sdk-go/aws/doc.go | 56 - .../aws/aws-sdk-go/aws/ec2metadata/api.go | 199 - .../aws/aws-sdk-go/aws/ec2metadata/service.go | 226 - .../aws/ec2metadata/token_provider.go | 92 - .../aws/aws-sdk-go/aws/endpoints/decode.go | 216 - .../aws/aws-sdk-go/aws/endpoints/defaults.go | 6098 - .../aws/endpoints/dep_service_ids.go | 141 - .../aws/aws-sdk-go/aws/endpoints/doc.go | 66 - .../aws/aws-sdk-go/aws/endpoints/endpoints.go | 564 - .../aws/endpoints/legacy_regions.go | 24 - .../aws/aws-sdk-go/aws/endpoints/v3model.go | 341 - .../aws/endpoints/v3model_codegen.go | 351 - .../github.com/aws/aws-sdk-go/aws/errors.go | 13 - .../aws/aws-sdk-go/aws/jsonvalue.go | 12 - .../github.com/aws/aws-sdk-go/aws/logger.go | 118 - .../aws/request/connection_reset_error.go | 18 - .../aws/aws-sdk-go/aws/request/handlers.go | 322 - .../aws-sdk-go/aws/request/http_request.go | 24 - .../aws-sdk-go/aws/request/offset_reader.go | 65 - .../aws/aws-sdk-go/aws/request/request.go | 678 - .../aws/aws-sdk-go/aws/request/request_1_7.go | 39 - .../aws/aws-sdk-go/aws/request/request_1_8.go | 36 - .../aws-sdk-go/aws/request/request_context.go | 14 - .../aws/request/request_context_1_6.go | 14 - .../aws/request/request_pagination.go | 266 - .../aws/aws-sdk-go/aws/request/retryer.go | 307 - .../aws/request/timeout_read_closer.go | 94 - .../aws/aws-sdk-go/aws/request/validation.go | 286 - .../aws/aws-sdk-go/aws/request/waiter.go | 295 - .../aws/session/cabundle_transport.go | 26 - .../aws/session/cabundle_transport_1_5.go | 22 - .../aws/session/cabundle_transport_1_6.go | 23 - .../aws/aws-sdk-go/aws/session/credentials.go | 259 - .../aws/aws-sdk-go/aws/session/doc.go | 245 - .../aws/aws-sdk-go/aws/session/env_config.go | 320 - .../aws/aws-sdk-go/aws/session/session.go | 719 - .../aws-sdk-go/aws/session/shared_config.go | 526 - .../aws-sdk-go/aws/signer/v4/header_rules.go | 82 - .../aws/aws-sdk-go/aws/signer/v4/options.go | 7 - .../aws/aws-sdk-go/aws/signer/v4/uri_path.go | 24 - .../aws/aws-sdk-go/aws/signer/v4/v4.go | 806 - .../github.com/aws/aws-sdk-go/aws/types.go | 207 - .../github.com/aws/aws-sdk-go/aws/url.go | 12 - .../github.com/aws/aws-sdk-go/aws/url_1_7.go | 29 - .../github.com/aws/aws-sdk-go/aws/version.go | 8 - .../aws/aws-sdk-go/internal/ini/ast.go | 120 - .../aws-sdk-go/internal/ini/comma_token.go | 11 - .../aws-sdk-go/internal/ini/comment_token.go | 35 - .../aws/aws-sdk-go/internal/ini/doc.go | 29 - .../aws-sdk-go/internal/ini/empty_token.go | 4 - .../aws/aws-sdk-go/internal/ini/expression.go | 24 - .../aws/aws-sdk-go/internal/ini/fuzz.go | 17 - .../aws/aws-sdk-go/internal/ini/ini.go | 51 - .../aws/aws-sdk-go/internal/ini/ini_lexer.go | 165 - .../aws/aws-sdk-go/internal/ini/ini_parser.go | 356 - .../aws-sdk-go/internal/ini/literal_tokens.go | 324 - .../aws-sdk-go/internal/ini/newline_token.go | 30 - .../aws-sdk-go/internal/ini/number_helper.go | 152 - .../aws/aws-sdk-go/internal/ini/op_tokens.go | 39 - .../aws-sdk-go/internal/ini/parse_error.go | 43 - .../aws-sdk-go/internal/ini/parse_stack.go | 60 - .../aws/aws-sdk-go/internal/ini/sep_tokens.go | 41 - .../aws/aws-sdk-go/internal/ini/skipper.go | 45 - .../aws/aws-sdk-go/internal/ini/statement.go | 35 - .../aws/aws-sdk-go/internal/ini/value_util.go | 284 - .../aws/aws-sdk-go/internal/ini/visitor.go | 166 - .../aws/aws-sdk-go/internal/ini/walker.go | 25 - .../aws/aws-sdk-go/internal/ini/ws_token.go | 24 - .../aws/aws-sdk-go/internal/sdkio/byte.go | 12 - .../aws/aws-sdk-go/internal/sdkio/io_go1.6.go | 10 - .../aws/aws-sdk-go/internal/sdkio/io_go1.7.go | 12 - .../aws/aws-sdk-go/internal/sdkmath/floor.go | 15 - .../internal/sdkmath/floor_go1.9.go | 56 - .../internal/sdkrand/locked_source.go | 29 - .../aws/aws-sdk-go/internal/sdkrand/read.go | 11 - .../aws-sdk-go/internal/sdkrand/read_1_5.go | 24 - .../aws/aws-sdk-go/internal/sdkuri/path.go | 23 - .../internal/shareddefaults/ecs_container.go | 12 - .../internal/shareddefaults/shared_config.go | 40 - .../aws/aws-sdk-go/private/protocol/host.go | 68 - .../private/protocol/host_prefix.go | 54 - .../private/protocol/idempotency.go | 75 - .../private/protocol/json/jsonutil/build.go | 296 - .../protocol/json/jsonutil/unmarshal.go | 250 - .../aws-sdk-go/private/protocol/jsonvalue.go | 76 - .../aws-sdk-go/private/protocol/payload.go | 81 - .../private/protocol/query/build.go | 36 - .../protocol/query/queryutil/queryutil.go | 246 - .../private/protocol/query/unmarshal.go | 39 - .../private/protocol/query/unmarshal_error.go | 69 - .../aws-sdk-go/private/protocol/rest/build.go | 310 - .../private/protocol/rest/payload.go | 45 - .../private/protocol/rest/unmarshal.go | 237 - .../aws-sdk-go/private/protocol/timestamp.go | 84 - .../aws-sdk-go/private/protocol/unmarshal.go | 21 - .../private/protocol/xml/xmlutil/build.go | 306 - .../private/protocol/xml/xmlutil/sort.go | 32 - .../private/protocol/xml/xmlutil/unmarshal.go | 291 - .../protocol/xml/xmlutil/xml_to_struct.go | 159 - .../aws/aws-sdk-go/service/sts/api.go | 3115 - .../aws-sdk-go/service/sts/customizations.go | 11 - .../aws/aws-sdk-go/service/sts/doc.go | 108 - .../aws/aws-sdk-go/service/sts/errors.go | 82 - .../aws/aws-sdk-go/service/sts/service.go | 98 - .../service/sts/stsiface/interface.go | 96 - .../aws/vendor/github.com/go-ini/ini/LICENSE | 191 - .../aws/vendor/github.com/go-ini/ini/Makefile | 12 - .../vendor/github.com/go-ini/ini/README.md | 703 - .../vendor/github.com/go-ini/ini/README_ZH.md | 690 - .../aws/vendor/github.com/go-ini/ini/error.go | 32 - .../aws/vendor/github.com/go-ini/ini/ini.go | 501 - .../aws/vendor/github.com/go-ini/ini/key.go | 633 - .../vendor/github.com/go-ini/ini/parser.go | 325 - .../vendor/github.com/go-ini/ini/section.go | 206 - .../vendor/github.com/go-ini/ini/struct.go | 431 - .../github.com/jmespath/go-jmespath/LICENSE | 13 - .../github.com/jmespath/go-jmespath/Makefile | 44 - .../github.com/jmespath/go-jmespath/README.md | 7 - .../github.com/jmespath/go-jmespath/api.go | 49 - .../go-jmespath/astnodetype_string.go | 16 - .../jmespath/go-jmespath/functions.go | 842 - .../jmespath/go-jmespath/interpreter.go | 418 - .../github.com/jmespath/go-jmespath/lexer.go | 420 - .../github.com/jmespath/go-jmespath/parser.go | 603 - .../jmespath/go-jmespath/toktype_string.go | 16 - .../github.com/jmespath/go-jmespath/util.go | 185 - .../provider/aws/vendor/vendor.json | 44 - .../network/mgmt/2015-06-15/network/client.go | 135 - .../Azure/azure-sdk-for-go/version/version.go | 21 - .../github.com/Azure/go-autorest/LICENSE | 191 - .../Azure/go-autorest/autorest/adal/README.md | 292 - .../Azure/go-autorest/autorest/adal/config.go | 151 - .../Azure/go-autorest/autorest/adal/go.mod | 12 - .../Azure/go-autorest/autorest/adal/go.sum | 23 - .../autorest/adal/go_mod_tidy_hack.go | 24 - .../Azure/go-autorest/autorest/adal/sender.go | 95 - .../Azure/go-autorest/autorest/adal/token.go | 1130 - .../go-autorest/autorest/authorization_sas.go | 67 - .../autorest/authorization_storage.go | 301 - .../go-autorest/autorest/azure/auth/go.mod | 11 - .../go-autorest/autorest/azure/auth/go.sum | 38 - .../autorest/azure/auth/go_mod_tidy_hack.go | 24 - .../go-autorest/autorest/azure/cli/go.mod | 11 - .../go-autorest/autorest/azure/cli/go.sum | 29 - .../autorest/azure/cli/go_mod_tidy_hack.go | 24 - .../go-autorest/autorest/azure/cli/token.go | 175 - .../autorest/azure/environments.go | 244 - .../Azure/go-autorest/autorest/client.go | 300 - .../Azure/go-autorest/autorest/date/go.mod | 5 - .../Azure/go-autorest/autorest/date/go.sum | 16 - .../autorest/date/go_mod_tidy_hack.go | 24 - .../Azure/go-autorest/autorest/go.mod | 11 - .../Azure/go-autorest/autorest/go.sum | 18 - .../Azure/go-autorest/autorest/sender.go | 407 - .../Azure/go-autorest/autorest/to/convert.go | 152 - .../Azure/go-autorest/autorest/to/go.mod | 5 - .../Azure/go-autorest/autorest/to/go.sum | 17 - .../autorest/to/go_mod_tidy_hack.go | 24 - .../go-autorest/autorest/validation/go.mod | 8 - .../go-autorest/autorest/validation/go.sum | 24 - .../autorest/validation/go_mod_tidy_hack.go | 24 - .../autorest/validation/validation.go | 400 - .../Azure/go-autorest/autorest/version.go | 41 - .../Azure/go-autorest/logger/go.mod | 3 - .../Azure/go-autorest/tracing/go.mod | 3 - .../Azure/go-autorest/tracing/tracing.go | 67 - .../github.com/dgrijalva/jwt-go/README.md | 85 - .../github.com/dgrijalva/jwt-go/parser.go | 131 - .../github.com/dgrijalva/jwt-go/rsa_utils.go | 69 - .../github.com/mitchellh/go-homedir/LICENSE | 21 - .../github.com/mitchellh/go-homedir/README.md | 14 - .../mitchellh/go-homedir/homedir.go | 167 - .../provider/azure/vendor/vendor.json | 25 - .../github.com/digitalocean/godo/CHANGELOG.md | 20 - .../digitalocean/godo/CONTRIBUTING.md | 23 - .../github.com/digitalocean/godo/README.md | 138 - .../github.com/digitalocean/godo/account.go | 60 - .../digitalocean/godo/context/context.go | 98 - .../digitalocean/godo/context/context_go17.go | 39 - .../godo/context/context_pre_go17.go | 41 - .../github.com/digitalocean/godo/doc.go | 2 - .../github.com/digitalocean/godo/images.go | 199 - .../github.com/digitalocean/godo/keys.go | 227 - .../github.com/digitalocean/godo/regions.go | 65 - .../github.com/digitalocean/godo/sizes.go | 69 - .../github.com/digitalocean/godo/snapshots.go | 141 - .../github.com/digitalocean/godo/storage.go | 241 - .../github.com/digitalocean/godo/tags.go | 209 - .../vendor/github.com/golang/protobuf/LICENSE | 31 - .../github.com/golang/protobuf/proto/Makefile | 43 - .../github.com/golang/protobuf/proto/clone.go | 229 - .../golang/protobuf/proto/decode.go | 970 - .../golang/protobuf/proto/encode.go | 1362 - .../github.com/golang/protobuf/proto/equal.go | 300 - .../golang/protobuf/proto/extensions.go | 587 - .../github.com/golang/protobuf/proto/lib.go | 897 - .../golang/protobuf/proto/message_set.go | 311 - .../golang/protobuf/proto/pointer_reflect.go | 484 - .../golang/protobuf/proto/pointer_unsafe.go | 270 - .../golang/protobuf/proto/properties.go | 872 - .../github.com/golang/protobuf/proto/text.go | 854 - .../golang/protobuf/proto/text_parser.go | 895 - .../github.com/google/go-querystring/LICENSE | 27 - .../github.com/tent/http-link-go/LICENSE | 27 - .../github.com/tent/http-link-go/README.md | 12 - .../github.com/tent/http-link-go/link.go | 185 - .../golang.org/x/net/context/context.go | 54 - .../x/net/context/ctxhttp/ctxhttp.go | 74 - .../x/net/context/ctxhttp/ctxhttp_pre17.go | 147 - .../vendor/golang.org/x/net/context/go17.go | 72 - .../vendor/golang.org/x/net/context/go19.go | 20 - .../golang.org/x/net/context/pre_go17.go | 300 - .../golang.org/x/net/context/pre_go19.go | 109 - .../golang.org/x/oauth2/CONTRIBUTING.md | 31 - .../vendor/golang.org/x/oauth2/README.md | 77 - .../golang.org/x/oauth2/client_appengine.go | 25 - .../golang.org/x/oauth2/internal/oauth2.go | 76 - .../golang.org/x/oauth2/internal/token.go | 251 - .../golang.org/x/oauth2/internal/transport.go | 69 - .../vendor/golang.org/x/oauth2/oauth2.go | 340 - .../vendor/golang.org/x/oauth2/token.go | 158 - .../vendor/golang.org/x/oauth2/transport.go | 132 - .../appengine/internal/api.go | 677 - .../appengine/internal/api_classic.go | 165 - .../appengine/internal/base/api_base.pb.go | 133 - .../internal/datastore/datastore_v3.pb.go | 2778 - .../internal/datastore/datastore_v3.proto | 541 - .../appengine/internal/identity.go | 14 - .../appengine/internal/identity_classic.go | 57 - .../appengine/internal/identity_vm.go | 101 - .../appengine/internal/log/log_service.pb.go | 899 - .../appengine/internal/main.go | 15 - .../appengine/internal/main_vm.go | 48 - .../appengine/internal/metadata.go | 61 - .../internal/remote_api/remote_api.pb.go | 231 - .../appengine/internal/transaction.go | 107 - .../internal/urlfetch/urlfetch_service.pb.go | 355 - .../provider/digitalocean/vendor/vendor.json | 26 - .../gce/vendor/cloud.google.com/go/LICENSE | 202 - .../go/compute/metadata/metadata.go | 438 - .../cloud.google.com/go/internal/cloud.go | 64 - .../cloud.google.com/go/internal/retry.go | 55 - .../vendor/github.com/golang/protobuf/LICENSE | 31 - .../github.com/golang/protobuf/proto/Makefile | 43 - .../github.com/golang/protobuf/proto/clone.go | 229 - .../golang/protobuf/proto/decode.go | 970 - .../golang/protobuf/proto/encode.go | 1362 - .../github.com/golang/protobuf/proto/equal.go | 300 - .../golang/protobuf/proto/extensions.go | 587 - .../github.com/golang/protobuf/proto/lib.go | 898 - .../golang/protobuf/proto/message_set.go | 311 - .../golang/protobuf/proto/pointer_reflect.go | 484 - .../golang/protobuf/proto/pointer_unsafe.go | 270 - .../golang/protobuf/proto/properties.go | 872 - .../github.com/golang/protobuf/proto/text.go | 854 - .../golang/protobuf/proto/text_parser.go | 895 - .../googleapis/gax-go/CONTRIBUTING.md | 27 - .../github.com/googleapis/gax-go/LICENSE | 27 - .../github.com/googleapis/gax-go/README.md | 24 - .../googleapis/gax-go/call_option.go | 136 - .../github.com/googleapis/gax-go/gax.go | 40 - .../github.com/googleapis/gax-go/invoke.go | 90 - .../googleapis/gax-go/path_template.go | 176 - .../googleapis/gax-go/path_template_parser.go | 227 - .../gce/vendor/golang.org/x/net/LICENSE | 27 - .../golang.org/x/net/context/context.go | 156 - .../x/net/context/ctxhttp/ctxhttp.go | 74 - .../x/net/context/ctxhttp/ctxhttp_pre17.go | 147 - .../vendor/golang.org/x/net/context/go17.go | 72 - .../golang.org/x/net/context/pre_go17.go | 300 - .../vendor/golang.org/x/net/http2/Dockerfile | 51 - .../vendor/golang.org/x/net/http2/Makefile | 3 - .../gce/vendor/golang.org/x/net/http2/README | 20 - .../x/net/http2/client_conn_pool.go | 256 - .../x/net/http2/configure_transport.go | 80 - .../vendor/golang.org/x/net/http2/errors.go | 130 - .../golang.org/x/net/http2/fixed_buffer.go | 60 - .../gce/vendor/golang.org/x/net/http2/flow.go | 50 - .../vendor/golang.org/x/net/http2/frame.go | 1544 - .../gce/vendor/golang.org/x/net/http2/go16.go | 43 - .../gce/vendor/golang.org/x/net/http2/go17.go | 106 - .../golang.org/x/net/http2/go17_not18.go | 36 - .../gce/vendor/golang.org/x/net/http2/go18.go | 50 - .../vendor/golang.org/x/net/http2/gotrack.go | 170 - .../golang.org/x/net/http2/headermap.go | 78 - .../golang.org/x/net/http2/hpack/encode.go | 251 - .../golang.org/x/net/http2/hpack/hpack.go | 542 - .../golang.org/x/net/http2/hpack/huffman.go | 212 - .../golang.org/x/net/http2/hpack/tables.go | 352 - .../vendor/golang.org/x/net/http2/http2.go | 387 - .../vendor/golang.org/x/net/http2/not_go16.go | 46 - .../vendor/golang.org/x/net/http2/not_go17.go | 87 - .../vendor/golang.org/x/net/http2/not_go18.go | 27 - .../gce/vendor/golang.org/x/net/http2/pipe.go | 153 - .../vendor/golang.org/x/net/http2/server.go | 2753 - .../golang.org/x/net/http2/transport.go | 2129 - .../vendor/golang.org/x/net/http2/write.go | 370 - .../golang.org/x/net/http2/writesched.go | 242 - .../x/net/http2/writesched_priority.go | 452 - .../x/net/http2/writesched_random.go | 72 - .../gce/vendor/golang.org/x/net/idna/idna.go | 508 - .../vendor/golang.org/x/net/idna/punycode.go | 203 - .../vendor/golang.org/x/net/idna/tables.go | 4479 - .../gce/vendor/golang.org/x/net/idna/trie.go | 71 - .../vendor/golang.org/x/net/idna/trieval.go | 116 - .../x/net/internal/timeseries/timeseries.go | 525 - .../golang.org/x/net/lex/httplex/httplex.go | 351 - .../vendor/golang.org/x/net/trace/events.go | 524 - .../golang.org/x/net/trace/histogram.go | 356 - .../vendor/golang.org/x/net/trace/trace.go | 1076 - .../golang.org/x/oauth2/CONTRIBUTING.md | 31 - .../gce/vendor/golang.org/x/oauth2/LICENSE | 27 - .../gce/vendor/golang.org/x/oauth2/README.md | 65 - .../golang.org/x/oauth2/client_appengine.go | 25 - .../golang.org/x/oauth2/google/appengine.go | 89 - .../x/oauth2/google/appengine_hook.go | 14 - .../x/oauth2/google/appenginevm_hook.go | 15 - .../golang.org/x/oauth2/google/default.go | 130 - .../golang.org/x/oauth2/google/google.go | 202 - .../vendor/golang.org/x/oauth2/google/jwt.go | 74 - .../vendor/golang.org/x/oauth2/google/sdk.go | 172 - .../golang.org/x/oauth2/internal/oauth2.go | 76 - .../golang.org/x/oauth2/internal/token.go | 227 - .../golang.org/x/oauth2/internal/transport.go | 69 - .../gce/vendor/golang.org/x/oauth2/jws/jws.go | 182 - .../gce/vendor/golang.org/x/oauth2/jwt/jwt.go | 159 - .../gce/vendor/golang.org/x/oauth2/oauth2.go | 341 - .../gce/vendor/golang.org/x/oauth2/token.go | 158 - .../vendor/golang.org/x/oauth2/transport.go | 132 - .../gce/vendor/golang.org/x/text/LICENSE | 27 - .../x/text/secure/bidirule/bidirule.go | 342 - .../golang.org/x/text/transform/transform.go | 705 - .../golang.org/x/text/unicode/bidi/bidi.go | 198 - .../golang.org/x/text/unicode/bidi/bracket.go | 335 - .../golang.org/x/text/unicode/bidi/core.go | 1058 - .../golang.org/x/text/unicode/bidi/prop.go | 206 - .../golang.org/x/text/unicode/bidi/tables.go | 1779 - .../golang.org/x/text/unicode/bidi/trieval.go | 60 - .../x/text/unicode/norm/composition.go | 514 - .../x/text/unicode/norm/forminfo.go | 256 - .../golang.org/x/text/unicode/norm/input.go | 105 - .../golang.org/x/text/unicode/norm/iter.go | 450 - .../x/text/unicode/norm/normalize.go | 608 - .../x/text/unicode/norm/readwriter.go | 125 - .../golang.org/x/text/unicode/norm/tables.go | 7627 - .../x/text/unicode/norm/transform.go | 88 - .../golang.org/x/text/unicode/norm/trie.go | 54 - .../gce/vendor/google.golang.org/api/LICENSE | 27 - .../api/compute/v1/compute-api.json | 18628 -- .../api/compute/v1/compute-gen.go | 57419 ------- .../api/gensupport/backoff.go | 46 - .../api/gensupport/buffer.go | 77 - .../google.golang.org/api/gensupport/json.go | 184 - .../api/gensupport/jsonfloat.go | 57 - .../google.golang.org/api/gensupport/media.go | 199 - .../api/gensupport/params.go | 50 - .../api/gensupport/resumable.go | 217 - .../google.golang.org/api/gensupport/retry.go | 85 - .../google.golang.org/api/gensupport/send.go | 55 - .../api/googleapi/googleapi.go | 406 - .../googleapi/internal/uritemplates/LICENSE | 18 - .../internal/uritemplates/uritemplates.go | 248 - .../googleapi/internal/uritemplates/utils.go | 17 - .../google.golang.org/api/googleapi/types.go | 202 - .../google.golang.org/appengine/README.md | 73 - .../google.golang.org/appengine/appengine.go | 113 - .../appengine/internal/api.go | 675 - .../appengine/internal/api_classic.go | 159 - .../appengine/internal/api_common.go | 116 - .../appengine/internal/app_id.go | 28 - .../app_identity/app_identity_service.pb.go | 296 - .../appengine/internal/base/api_base.pb.go | 133 - .../appengine/internal/base/api_base.proto | 33 - .../internal/datastore/datastore_v3.pb.go | 2778 - .../internal/datastore/datastore_v3.proto | 541 - .../appengine/internal/identity.go | 14 - .../appengine/internal/identity_classic.go | 27 - .../appengine/internal/identity_vm.go | 97 - .../appengine/internal/internal.go | 110 - .../appengine/internal/log/log_service.pb.go | 899 - .../appengine/internal/log/log_service.proto | 150 - .../appengine/internal/main.go | 15 - .../appengine/internal/main_vm.go | 44 - .../appengine/internal/metadata.go | 61 - .../internal/modules/modules_service.pb.go | 375 - .../appengine/internal/net.go | 56 - .../appengine/internal/regen.sh | 40 - .../internal/remote_api/remote_api.pb.go | 231 - .../internal/remote_api/remote_api.proto | 44 - .../appengine/internal/transaction.go | 107 - .../internal/urlfetch/urlfetch_service.pb.go | 355 - .../internal/urlfetch/urlfetch_service.proto | 64 - .../appengine/urlfetch/urlfetch.go | 210 - .../google.golang.org/grpc/CONTRIBUTING.md | 46 - .../gce/vendor/google.golang.org/grpc/LICENSE | 28 - .../vendor/google.golang.org/grpc/Makefile | 52 - .../gce/vendor/google.golang.org/grpc/PATENTS | 22 - .../vendor/google.golang.org/grpc/README.md | 57 - .../vendor/google.golang.org/grpc/backoff.go | 80 - .../vendor/google.golang.org/grpc/balancer.go | 400 - .../gce/vendor/google.golang.org/grpc/call.go | 286 - .../google.golang.org/grpc/clientconn.go | 965 - .../vendor/google.golang.org/grpc/codegen.sh | 17 - .../grpc/codes/code_string.go | 16 - .../google.golang.org/grpc/codes/codes.go | 159 - .../vendor/google.golang.org/grpc/coverage.sh | 48 - .../grpc/credentials/credentials.go | 230 - .../grpc/credentials/credentials_util_go17.go | 76 - .../credentials/credentials_util_pre_go17.go | 74 - .../gce/vendor/google.golang.org/grpc/doc.go | 6 - .../google.golang.org/grpc/grpclog/logger.go | 93 - .../google.golang.org/grpc/interceptor.go | 90 - .../grpc/internal/internal.go | 49 - .../grpc/metadata/metadata.go | 149 - .../google.golang.org/grpc/naming/naming.go | 74 - .../google.golang.org/grpc/peer/peer.go | 65 - .../vendor/google.golang.org/grpc/rpc_util.go | 519 - .../vendor/google.golang.org/grpc/server.go | 1054 - .../google.golang.org/grpc/stats/handlers.go | 76 - .../google.golang.org/grpc/stats/stats.go | 223 - .../vendor/google.golang.org/grpc/stream.go | 625 - .../vendor/google.golang.org/grpc/tap/tap.go | 54 - .../vendor/google.golang.org/grpc/trace.go | 119 - .../grpc/transport/control.go | 193 - .../google.golang.org/grpc/transport/go16.go | 46 - .../google.golang.org/grpc/transport/go17.go | 46 - .../grpc/transport/handler_server.go | 397 - .../grpc/transport/http2_client.go | 1129 - .../grpc/transport/http2_server.go | 835 - .../grpc/transport/http_util.go | 513 - .../grpc/transport/pre_go16.go | 51 - .../grpc/transport/transport.go | 608 - .../provider/gce/vendor/vendor.json | 53 - .../go-discover/provider/k8s/k8s_discover.go | 209 - .../vendor/github.com/golang/protobuf/LICENSE | 28 - .../github.com/golang/protobuf/proto/clone.go | 253 - .../golang/protobuf/proto/decode.go | 427 - .../golang/protobuf/proto/encode.go | 203 - .../github.com/golang/protobuf/proto/equal.go | 301 - .../golang/protobuf/proto/extensions.go | 607 - .../github.com/golang/protobuf/proto/lib.go | 965 - .../golang/protobuf/proto/message_set.go | 181 - .../golang/protobuf/proto/pointer_reflect.go | 360 - .../golang/protobuf/proto/pointer_unsafe.go | 313 - .../golang/protobuf/proto/properties.go | 544 - .../github.com/golang/protobuf/proto/text.go | 843 - .../golang/protobuf/proto/text_parser.go | 880 - .../linode/vendor/golang.org/x/net/LICENSE | 27 - .../linode/vendor/golang.org/x/net/PATENTS | 22 - .../golang.org/x/net/context/context.go | 56 - .../x/net/context/ctxhttp/ctxhttp.go | 71 - .../vendor/golang.org/x/net/context/go17.go | 72 - .../vendor/golang.org/x/net/context/go19.go | 20 - .../golang.org/x/net/context/pre_go17.go | 300 - .../golang.org/x/net/context/pre_go19.go | 109 - .../golang.org/x/net/publicsuffix/table.go | 9753 -- .../golang.org/x/oauth2/CONTRIBUTING.md | 31 - .../linode/vendor/golang.org/x/oauth2/LICENSE | 27 - .../vendor/golang.org/x/oauth2/README.md | 77 - .../golang.org/x/oauth2/client_appengine.go | 25 - .../golang.org/x/oauth2/internal/oauth2.go | 76 - .../golang.org/x/oauth2/internal/token.go | 251 - .../golang.org/x/oauth2/internal/transport.go | 69 - .../vendor/golang.org/x/oauth2/oauth2.go | 340 - .../vendor/golang.org/x/oauth2/token.go | 158 - .../vendor/golang.org/x/oauth2/transport.go | 132 - .../appengine/internal/api_common.go | 123 - .../appengine/internal/app_id.go | 28 - .../appengine/internal/base/api_base.proto | 33 - .../appengine/internal/internal.go | 110 - .../appengine/internal/log/log_service.proto | 150 - .../appengine/internal/net.go | 56 - .../appengine/internal/regen.sh | 40 - .../internal/remote_api/remote_api.proto | 44 - .../internal/urlfetch/urlfetch_service.proto | 64 - .../appengine/urlfetch/urlfetch.go | 210 - .../provider/linode/vendor/vendor.json | 25 - .../mdns/vendor/github.com/miekg/dns/AUTHORS | 1 - .../vendor/github.com/miekg/dns/CONTRIBUTORS | 10 - .../vendor/github.com/miekg/dns/COPYRIGHT | 9 - .../vendor/github.com/miekg/dns/Gopkg.lock | 57 - .../vendor/github.com/miekg/dns/Gopkg.toml | 38 - .../mdns/vendor/github.com/miekg/dns/LICENSE | 32 - .../vendor/github.com/miekg/dns/README.md | 172 - .../vendor/github.com/miekg/dns/client.go | 577 - .../github.com/miekg/dns/clientconfig.go | 139 - .../github.com/miekg/dns/compress_generate.go | 198 - .../vendor/github.com/miekg/dns/defaults.go | 288 - .../mdns/vendor/github.com/miekg/dns/dns.go | 97 - .../vendor/github.com/miekg/dns/dnssec.go | 801 - .../github.com/miekg/dns/dnssec_keygen.go | 178 - .../github.com/miekg/dns/dnssec_keyscan.go | 352 - .../github.com/miekg/dns/dnssec_privkey.go | 93 - .../mdns/vendor/github.com/miekg/dns/doc.go | 272 - .../vendor/github.com/miekg/dns/duplicate.go | 25 - .../miekg/dns/duplicate_generate.go | 158 - .../mdns/vendor/github.com/miekg/dns/edns.go | 630 - .../vendor/github.com/miekg/dns/format.go | 87 - .../mdns/vendor/github.com/miekg/dns/fuzz.go | 23 - .../vendor/github.com/miekg/dns/labels.go | 191 - .../mdns/vendor/github.com/miekg/dns/msg.go | 1181 - .../github.com/miekg/dns/msg_generate.go | 348 - .../mdns/vendor/github.com/miekg/dns/nsecx.go | 106 - .../vendor/github.com/miekg/dns/privaterr.go | 147 - .../vendor/github.com/miekg/dns/rawmsg.go | 49 - .../vendor/github.com/miekg/dns/reverse.go | 38 - .../vendor/github.com/miekg/dns/sanitize.go | 85 - .../vendor/github.com/miekg/dns/scan_rr.go | 2209 - .../vendor/github.com/miekg/dns/server.go | 829 - .../mdns/vendor/github.com/miekg/dns/sig0.go | 217 - .../github.com/miekg/dns/singleinflight.go | 57 - .../mdns/vendor/github.com/miekg/dns/tlsa.go | 47 - .../mdns/vendor/github.com/miekg/dns/tsig.go | 386 - .../mdns/vendor/github.com/miekg/dns/types.go | 1383 - .../github.com/miekg/dns/types_generate.go | 272 - .../mdns/vendor/github.com/miekg/dns/udp.go | 102 - .../github.com/miekg/dns/udp_windows.go | 37 - .../vendor/github.com/miekg/dns/update.go | 106 - .../vendor/github.com/miekg/dns/version.go | 15 - .../mdns/vendor/github.com/miekg/dns/xfr.go | 260 - .../vendor/github.com/miekg/dns/zcompress.go | 152 - .../vendor/github.com/miekg/dns/zduplicate.go | 943 - .../mdns/vendor/github.com/miekg/dns/zmsg.go | 3615 - .../vendor/github.com/miekg/dns/ztypes.go | 863 - .../mdns/vendor/golang.org/x/crypto/LICENSE | 27 - .../mdns/vendor/golang.org/x/crypto/PATENTS | 22 - .../golang.org/x/crypto/ed25519/ed25519.go | 217 - .../ed25519/internal/edwards25519/const.go | 1422 - .../internal/edwards25519/edwards25519.go | 1793 - .../mdns/vendor/golang.org/x/net/LICENSE | 27 - .../mdns/vendor/golang.org/x/net/PATENTS | 22 - .../x/net/internal/socket/iovec_64bit.go | 19 - .../x/net/internal/socket/rawconn_nommsg.go | 18 - .../x/net/internal/socket/rawconn_nomsg.go | 18 - .../x/net/internal/socket/rawconn_stub.go | 25 - .../x/net/internal/socket/reflect.go | 62 - .../x/net/internal/socket/sys_bsd.go | 17 - .../x/net/internal/socket/sys_bsdvar.go | 14 - .../x/net/internal/socket/sys_dragonfly.go | 7 - .../x/net/internal/socket/sys_stub.go | 64 - .../x/net/internal/socket/zsys_freebsd_386.go | 59 - .../net/internal/socket/zsys_freebsd_amd64.go | 61 - .../x/net/internal/socket/zsys_freebsd_arm.go | 59 - .../x/net/internal/socket/zsys_linux_386.go | 63 - .../x/net/internal/socket/zsys_linux_amd64.go | 66 - .../x/net/internal/socket/zsys_linux_arm.go | 63 - .../x/net/internal/socket/zsys_linux_arm64.go | 66 - .../x/net/internal/socket/zsys_linux_mips.go | 63 - .../net/internal/socket/zsys_linux_mips64.go | 66 - .../internal/socket/zsys_linux_mips64le.go | 66 - .../net/internal/socket/zsys_linux_mipsle.go | 63 - .../x/net/internal/socket/zsys_linux_ppc64.go | 66 - .../net/internal/socket/zsys_linux_ppc64le.go | 66 - .../x/net/internal/socket/zsys_linux_s390x.go | 66 - .../vendor/golang.org/x/net/ipv4/batch.go | 190 - .../golang.org/x/net/ipv4/control_stub.go | 13 - .../golang.org/x/net/ipv4/control_unix.go | 73 - .../golang.org/x/net/ipv4/control_windows.go | 16 - .../vendor/golang.org/x/net/ipv4/dgramopt.go | 264 - .../mdns/vendor/golang.org/x/net/ipv4/doc.go | 244 - .../vendor/golang.org/x/net/ipv4/endpoint.go | 186 - .../golang.org/x/net/ipv4/genericopt.go | 55 - .../vendor/golang.org/x/net/ipv4/helper.go | 64 - .../vendor/golang.org/x/net/ipv4/packet.go | 68 - .../golang.org/x/net/ipv4/packet_go1_8.go | 56 - .../golang.org/x/net/ipv4/packet_go1_9.go | 67 - .../golang.org/x/net/ipv4/payload_cmsg.go | 33 - .../x/net/ipv4/payload_cmsg_go1_8.go | 59 - .../x/net/ipv4/payload_cmsg_go1_9.go | 67 - .../golang.org/x/net/ipv4/payload_nocmsg.go | 39 - .../golang.org/x/net/ipv4/sockopt_posix.go | 71 - .../golang.org/x/net/ipv4/sockopt_stub.go | 42 - .../golang.org/x/net/ipv4/sys_asmreq.go | 119 - .../golang.org/x/net/ipv4/sys_asmreq_stub.go | 25 - .../vendor/golang.org/x/net/ipv4/sys_bpf.go | 23 - .../golang.org/x/net/ipv4/sys_bpf_stub.go | 16 - .../golang.org/x/net/ipv4/sys_darwin.go | 93 - .../golang.org/x/net/ipv4/sys_freebsd.go | 76 - .../vendor/golang.org/x/net/ipv4/sys_linux.go | 59 - .../golang.org/x/net/ipv4/sys_ssmreq.go | 54 - .../golang.org/x/net/ipv4/sys_ssmreq_stub.go | 21 - .../vendor/golang.org/x/net/ipv4/sys_stub.go | 13 - .../golang.org/x/net/ipv4/zsys_darwin.go | 99 - .../golang.org/x/net/ipv4/zsys_dragonfly.go | 31 - .../golang.org/x/net/ipv4/zsys_freebsd_386.go | 93 - .../x/net/ipv4/zsys_freebsd_amd64.go | 95 - .../golang.org/x/net/ipv4/zsys_freebsd_arm.go | 95 - .../golang.org/x/net/ipv4/zsys_linux_386.go | 148 - .../golang.org/x/net/ipv4/zsys_linux_amd64.go | 150 - .../golang.org/x/net/ipv4/zsys_linux_arm.go | 148 - .../golang.org/x/net/ipv4/zsys_linux_arm64.go | 150 - .../golang.org/x/net/ipv4/zsys_linux_mips.go | 148 - .../x/net/ipv4/zsys_linux_mips64.go | 150 - .../x/net/ipv4/zsys_linux_mips64le.go | 150 - .../x/net/ipv4/zsys_linux_mipsle.go | 148 - .../golang.org/x/net/ipv4/zsys_linux_ppc.go | 148 - .../golang.org/x/net/ipv4/zsys_linux_ppc64.go | 150 - .../x/net/ipv4/zsys_linux_ppc64le.go | 150 - .../golang.org/x/net/ipv4/zsys_linux_s390x.go | 150 - .../golang.org/x/net/ipv4/zsys_netbsd.go | 30 - .../golang.org/x/net/ipv4/zsys_openbsd.go | 30 - .../golang.org/x/net/ipv4/zsys_solaris.go | 100 - .../vendor/golang.org/x/net/ipv6/batch.go | 118 - .../golang.org/x/net/ipv6/control_stub.go | 13 - .../golang.org/x/net/ipv6/control_unix.go | 55 - .../golang.org/x/net/ipv6/control_windows.go | 16 - .../vendor/golang.org/x/net/ipv6/dgramopt.go | 301 - .../vendor/golang.org/x/net/ipv6/endpoint.go | 127 - .../golang.org/x/net/ipv6/genericopt.go | 56 - .../vendor/golang.org/x/net/ipv6/helper.go | 58 - .../golang.org/x/net/ipv6/payload_cmsg.go | 32 - .../x/net/ipv6/payload_cmsg_go1_8.go | 55 - .../x/net/ipv6/payload_cmsg_go1_9.go | 57 - .../golang.org/x/net/ipv6/payload_nocmsg.go | 38 - .../golang.org/x/net/ipv6/sockopt_posix.go | 87 - .../golang.org/x/net/ipv6/sockopt_stub.go | 46 - .../golang.org/x/net/ipv6/sys_asmreq.go | 24 - .../golang.org/x/net/ipv6/sys_asmreq_stub.go | 17 - .../vendor/golang.org/x/net/ipv6/sys_bpf.go | 23 - .../golang.org/x/net/ipv6/sys_bpf_stub.go | 16 - .../golang.org/x/net/ipv6/sys_darwin.go | 106 - .../golang.org/x/net/ipv6/sys_freebsd.go | 92 - .../vendor/golang.org/x/net/ipv6/sys_linux.go | 74 - .../golang.org/x/net/ipv6/sys_ssmreq.go | 54 - .../golang.org/x/net/ipv6/sys_ssmreq_stub.go | 21 - .../vendor/golang.org/x/net/ipv6/sys_stub.go | 13 - .../golang.org/x/net/ipv6/zsys_darwin.go | 131 - .../golang.org/x/net/ipv6/zsys_dragonfly.go | 88 - .../golang.org/x/net/ipv6/zsys_freebsd_386.go | 122 - .../x/net/ipv6/zsys_freebsd_amd64.go | 124 - .../golang.org/x/net/ipv6/zsys_freebsd_arm.go | 124 - .../golang.org/x/net/ipv6/zsys_linux_386.go | 170 - .../golang.org/x/net/ipv6/zsys_linux_amd64.go | 172 - .../golang.org/x/net/ipv6/zsys_linux_arm.go | 170 - .../golang.org/x/net/ipv6/zsys_linux_arm64.go | 172 - .../golang.org/x/net/ipv6/zsys_linux_mips.go | 170 - .../x/net/ipv6/zsys_linux_mips64.go | 172 - .../x/net/ipv6/zsys_linux_mips64le.go | 172 - .../x/net/ipv6/zsys_linux_mipsle.go | 170 - .../golang.org/x/net/ipv6/zsys_linux_ppc.go | 170 - .../golang.org/x/net/ipv6/zsys_linux_ppc64.go | 172 - .../x/net/ipv6/zsys_linux_ppc64le.go | 172 - .../golang.org/x/net/ipv6/zsys_linux_s390x.go | 172 - .../golang.org/x/net/ipv6/zsys_netbsd.go | 84 - .../golang.org/x/net/ipv6/zsys_openbsd.go | 93 - .../golang.org/x/net/ipv6/zsys_solaris.go | 131 - .../mdns/vendor/golang.org/x/sys/LICENSE | 27 - .../mdns/vendor/golang.org/x/sys/PATENTS | 22 - .../vendor/golang.org/x/sys/unix/README.md | 173 - .../golang.org/x/sys/unix/affinity_linux.go | 124 - .../vendor/golang.org/x/sys/unix/aliases.go | 14 - .../golang.org/x/sys/unix/asm_aix_ppc64.s | 17 - .../golang.org/x/sys/unix/asm_darwin_386.s | 29 - .../golang.org/x/sys/unix/asm_darwin_amd64.s | 29 - .../golang.org/x/sys/unix/asm_darwin_arm.s | 30 - .../golang.org/x/sys/unix/asm_darwin_arm64.s | 30 - .../x/sys/unix/asm_dragonfly_amd64.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_386.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_amd64.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_arm.s | 29 - .../golang.org/x/sys/unix/asm_linux_386.s | 65 - .../golang.org/x/sys/unix/asm_linux_amd64.s | 57 - .../golang.org/x/sys/unix/asm_linux_arm.s | 56 - .../golang.org/x/sys/unix/asm_linux_arm64.s | 52 - .../golang.org/x/sys/unix/asm_linux_mips64x.s | 56 - .../golang.org/x/sys/unix/asm_linux_mipsx.s | 54 - .../golang.org/x/sys/unix/asm_linux_ppc64x.s | 56 - .../golang.org/x/sys/unix/asm_linux_s390x.s | 56 - .../golang.org/x/sys/unix/asm_netbsd_386.s | 29 - .../golang.org/x/sys/unix/asm_netbsd_amd64.s | 29 - .../golang.org/x/sys/unix/asm_netbsd_arm.s | 29 - .../golang.org/x/sys/unix/asm_openbsd_386.s | 29 - .../golang.org/x/sys/unix/asm_openbsd_amd64.s | 29 - .../golang.org/x/sys/unix/asm_openbsd_arm.s | 29 - .../golang.org/x/sys/unix/asm_solaris_amd64.s | 17 - .../golang.org/x/sys/unix/bluetooth_linux.go | 35 - .../golang.org/x/sys/unix/cap_freebsd.go | 195 - .../vendor/golang.org/x/sys/unix/constants.go | 13 - .../golang.org/x/sys/unix/dev_aix_ppc.go | 27 - .../golang.org/x/sys/unix/dev_aix_ppc64.go | 29 - .../golang.org/x/sys/unix/dev_darwin.go | 24 - .../golang.org/x/sys/unix/dev_dragonfly.go | 30 - .../golang.org/x/sys/unix/dev_freebsd.go | 30 - .../vendor/golang.org/x/sys/unix/dev_linux.go | 42 - .../golang.org/x/sys/unix/dev_netbsd.go | 29 - .../golang.org/x/sys/unix/dev_openbsd.go | 29 - .../vendor/golang.org/x/sys/unix/dirent.go | 17 - .../golang.org/x/sys/unix/endian_big.go | 9 - .../golang.org/x/sys/unix/endian_little.go | 9 - .../vendor/golang.org/x/sys/unix/env_unix.go | 31 - .../x/sys/unix/errors_freebsd_386.go | 227 - .../x/sys/unix/errors_freebsd_amd64.go | 227 - .../x/sys/unix/errors_freebsd_arm.go | 226 - .../vendor/golang.org/x/sys/unix/fcntl.go | 32 - .../x/sys/unix/fcntl_linux_32bit.go | 13 - .../vendor/golang.org/x/sys/unix/gccgo.go | 62 - .../vendor/golang.org/x/sys/unix/gccgo_c.c | 39 - .../x/sys/unix/gccgo_linux_amd64.go | 20 - .../vendor/golang.org/x/sys/unix/ioctl.go | 30 - .../vendor/golang.org/x/sys/unix/mkall.sh | 204 - .../vendor/golang.org/x/sys/unix/mkerrors.sh | 656 - .../vendor/golang.org/x/sys/unix/mksyscall.pl | 341 - .../x/sys/unix/mksyscall_aix_ppc.pl | 384 - .../x/sys/unix/mksyscall_aix_ppc64.pl | 579 - .../x/sys/unix/mksyscall_solaris.pl | 294 - .../golang.org/x/sys/unix/mksysctl_openbsd.pl | 265 - .../golang.org/x/sys/unix/mksysnum_darwin.pl | 39 - .../x/sys/unix/mksysnum_dragonfly.pl | 50 - .../golang.org/x/sys/unix/mksysnum_freebsd.pl | 50 - .../golang.org/x/sys/unix/mksysnum_netbsd.pl | 58 - .../golang.org/x/sys/unix/mksysnum_openbsd.pl | 50 - .../golang.org/x/sys/unix/openbsd_pledge.go | 166 - .../golang.org/x/sys/unix/openbsd_unveil.go | 44 - .../golang.org/x/sys/unix/pagesize_unix.go | 15 - .../mdns/vendor/golang.org/x/sys/unix/race.go | 30 - .../vendor/golang.org/x/sys/unix/race0.go | 25 - .../golang.org/x/sys/unix/sockcmsg_linux.go | 36 - .../golang.org/x/sys/unix/sockcmsg_unix.go | 104 - .../mdns/vendor/golang.org/x/sys/unix/str.go | 26 - .../vendor/golang.org/x/sys/unix/syscall.go | 54 - .../golang.org/x/sys/unix/syscall_aix.go | 547 - .../golang.org/x/sys/unix/syscall_aix_ppc.go | 34 - .../x/sys/unix/syscall_aix_ppc64.go | 34 - .../golang.org/x/sys/unix/syscall_bsd.go | 624 - .../golang.org/x/sys/unix/syscall_darwin.go | 700 - .../x/sys/unix/syscall_darwin_386.go | 68 - .../x/sys/unix/syscall_darwin_amd64.go | 68 - .../x/sys/unix/syscall_darwin_arm.go | 66 - .../x/sys/unix/syscall_darwin_arm64.go | 68 - .../x/sys/unix/syscall_dragonfly.go | 524 - .../x/sys/unix/syscall_dragonfly_amd64.go | 52 - .../golang.org/x/sys/unix/syscall_freebsd.go | 817 - .../x/sys/unix/syscall_freebsd_386.go | 52 - .../x/sys/unix/syscall_freebsd_amd64.go | 52 - .../x/sys/unix/syscall_freebsd_arm.go | 52 - .../golang.org/x/sys/unix/syscall_linux.go | 1628 - .../x/sys/unix/syscall_linux_386.go | 385 - .../x/sys/unix/syscall_linux_amd64.go | 175 - .../x/sys/unix/syscall_linux_amd64_gc.go | 13 - .../x/sys/unix/syscall_linux_arm.go | 259 - .../x/sys/unix/syscall_linux_arm64.go | 209 - .../golang.org/x/sys/unix/syscall_linux_gc.go | 14 - .../x/sys/unix/syscall_linux_gc_386.go | 16 - .../x/sys/unix/syscall_linux_gccgo_386.go | 30 - .../x/sys/unix/syscall_linux_gccgo_arm.go | 20 - .../x/sys/unix/syscall_linux_mips64x.go | 214 - .../x/sys/unix/syscall_linux_mipsx.go | 233 - .../x/sys/unix/syscall_linux_ppc64x.go | 151 - .../x/sys/unix/syscall_linux_riscv64.go | 209 - .../x/sys/unix/syscall_linux_s390x.go | 337 - .../x/sys/unix/syscall_linux_sparc64.go | 146 - .../golang.org/x/sys/unix/syscall_netbsd.go | 598 - .../x/sys/unix/syscall_netbsd_386.go | 33 - .../x/sys/unix/syscall_netbsd_amd64.go | 33 - .../x/sys/unix/syscall_netbsd_arm.go | 33 - .../golang.org/x/sys/unix/syscall_openbsd.go | 394 - .../x/sys/unix/syscall_openbsd_386.go | 37 - .../x/sys/unix/syscall_openbsd_amd64.go | 37 - .../x/sys/unix/syscall_openbsd_arm.go | 37 - .../golang.org/x/sys/unix/syscall_solaris.go | 730 - .../x/sys/unix/syscall_solaris_amd64.go | 23 - .../golang.org/x/sys/unix/syscall_unix.go | 394 - .../golang.org/x/sys/unix/syscall_unix_gc.go | 15 - .../golang.org/x/sys/unix/timestruct.go | 82 - .../vendor/golang.org/x/sys/unix/xattr_bsd.go | 231 - .../golang.org/x/sys/unix/zerrors_aix_ppc.go | 1372 - .../x/sys/unix/zerrors_aix_ppc64.go | 1373 - .../x/sys/unix/zerrors_darwin_386.go | 1783 - .../x/sys/unix/zerrors_darwin_amd64.go | 1783 - .../x/sys/unix/zerrors_darwin_arm.go | 1783 - .../x/sys/unix/zerrors_darwin_arm64.go | 1783 - .../x/sys/unix/zerrors_dragonfly_amd64.go | 1650 - .../x/sys/unix/zerrors_freebsd_386.go | 1793 - .../x/sys/unix/zerrors_freebsd_amd64.go | 1794 - .../x/sys/unix/zerrors_freebsd_arm.go | 1802 - .../x/sys/unix/zerrors_linux_386.go | 2704 - .../x/sys/unix/zerrors_linux_amd64.go | 2704 - .../x/sys/unix/zerrors_linux_arm.go | 2710 - .../x/sys/unix/zerrors_linux_arm64.go | 2695 - .../x/sys/unix/zerrors_linux_mips.go | 2711 - .../x/sys/unix/zerrors_linux_mips64.go | 2711 - .../x/sys/unix/zerrors_linux_mips64le.go | 2711 - .../x/sys/unix/zerrors_linux_mipsle.go | 2711 - .../x/sys/unix/zerrors_linux_ppc64.go | 2764 - .../x/sys/unix/zerrors_linux_ppc64le.go | 2764 - .../x/sys/unix/zerrors_linux_riscv64.go | 2691 - .../x/sys/unix/zerrors_linux_s390x.go | 2764 - .../x/sys/unix/zerrors_linux_sparc64.go | 2150 - .../x/sys/unix/zerrors_netbsd_386.go | 1772 - .../x/sys/unix/zerrors_netbsd_amd64.go | 1762 - .../x/sys/unix/zerrors_netbsd_arm.go | 1751 - .../x/sys/unix/zerrors_openbsd_386.go | 1654 - .../x/sys/unix/zerrors_openbsd_amd64.go | 1765 - .../x/sys/unix/zerrors_openbsd_arm.go | 1656 - .../x/sys/unix/zerrors_solaris_amd64.go | 1532 - .../golang.org/x/sys/unix/zptrace386_linux.go | 80 - .../golang.org/x/sys/unix/zptracearm_linux.go | 41 - .../x/sys/unix/zptracemips_linux.go | 50 - .../x/sys/unix/zptracemipsle_linux.go | 50 - .../golang.org/x/sys/unix/zsyscall_aix_ppc.go | 1450 - .../x/sys/unix/zsyscall_aix_ppc64.go | 1408 - .../x/sys/unix/zsyscall_aix_ppc64_gc.go | 1162 - .../x/sys/unix/zsyscall_aix_ppc64_gccgo.go | 1042 - .../x/sys/unix/zsyscall_darwin_386.go | 1769 - .../x/sys/unix/zsyscall_darwin_amd64.go | 1769 - .../x/sys/unix/zsyscall_darwin_arm.go | 1769 - .../x/sys/unix/zsyscall_darwin_arm64.go | 1769 - .../x/sys/unix/zsyscall_dragonfly_amd64.go | 1524 - .../x/sys/unix/zsyscall_freebsd_386.go | 2015 - .../x/sys/unix/zsyscall_freebsd_amd64.go | 2015 - .../x/sys/unix/zsyscall_freebsd_arm.go | 2015 - .../x/sys/unix/zsyscall_linux_386.go | 2182 - .../x/sys/unix/zsyscall_linux_amd64.go | 2364 - .../x/sys/unix/zsyscall_linux_arm.go | 2284 - .../x/sys/unix/zsyscall_linux_arm64.go | 2191 - .../x/sys/unix/zsyscall_linux_mips.go | 2362 - .../x/sys/unix/zsyscall_linux_mips64.go | 2333 - .../x/sys/unix/zsyscall_linux_mips64le.go | 2333 - .../x/sys/unix/zsyscall_linux_mipsle.go | 2362 - .../x/sys/unix/zsyscall_linux_ppc64.go | 2411 - .../x/sys/unix/zsyscall_linux_ppc64le.go | 2411 - .../x/sys/unix/zsyscall_linux_riscv64.go | 2191 - .../x/sys/unix/zsyscall_linux_s390x.go | 2181 - .../x/sys/unix/zsyscall_linux_sparc64.go | 2172 - .../x/sys/unix/zsyscall_netbsd_386.go | 1669 - .../x/sys/unix/zsyscall_netbsd_amd64.go | 1669 - .../x/sys/unix/zsyscall_netbsd_arm.go | 1669 - .../x/sys/unix/zsyscall_openbsd_386.go | 1535 - .../x/sys/unix/zsyscall_openbsd_amd64.go | 1535 - .../x/sys/unix/zsyscall_openbsd_arm.go | 1535 - .../x/sys/unix/zsyscall_solaris_amd64.go | 1953 - .../x/sys/unix/zsysctl_openbsd_386.go | 270 - .../x/sys/unix/zsysctl_openbsd_amd64.go | 270 - .../x/sys/unix/zsysctl_openbsd_arm.go | 270 - .../x/sys/unix/zsysnum_darwin_386.go | 436 - .../x/sys/unix/zsysnum_darwin_amd64.go | 436 - .../x/sys/unix/zsysnum_darwin_arm.go | 436 - .../x/sys/unix/zsysnum_darwin_arm64.go | 436 - .../x/sys/unix/zsysnum_dragonfly_amd64.go | 315 - .../x/sys/unix/zsysnum_freebsd_386.go | 403 - .../x/sys/unix/zsysnum_freebsd_amd64.go | 403 - .../x/sys/unix/zsysnum_freebsd_arm.go | 403 - .../x/sys/unix/zsysnum_linux_386.go | 392 - .../x/sys/unix/zsysnum_linux_amd64.go | 344 - .../x/sys/unix/zsysnum_linux_arm.go | 364 - .../x/sys/unix/zsysnum_linux_arm64.go | 288 - .../x/sys/unix/zsysnum_linux_mips.go | 377 - .../x/sys/unix/zsysnum_linux_mips64.go | 337 - .../x/sys/unix/zsysnum_linux_mips64le.go | 337 - .../x/sys/unix/zsysnum_linux_mipsle.go | 377 - .../x/sys/unix/zsysnum_linux_ppc64.go | 375 - .../x/sys/unix/zsysnum_linux_ppc64le.go | 375 - .../x/sys/unix/zsysnum_linux_riscv64.go | 287 - .../x/sys/unix/zsysnum_linux_s390x.go | 337 - .../x/sys/unix/zsysnum_linux_sparc64.go | 348 - .../x/sys/unix/zsysnum_netbsd_386.go | 274 - .../x/sys/unix/zsysnum_netbsd_amd64.go | 274 - .../x/sys/unix/zsysnum_netbsd_arm.go | 274 - .../x/sys/unix/zsysnum_openbsd_386.go | 218 - .../x/sys/unix/zsysnum_openbsd_amd64.go | 218 - .../x/sys/unix/zsysnum_openbsd_arm.go | 218 - .../golang.org/x/sys/unix/ztypes_aix_ppc.go | 345 - .../golang.org/x/sys/unix/ztypes_aix_ppc64.go | 354 - .../x/sys/unix/ztypes_darwin_386.go | 489 - .../x/sys/unix/ztypes_darwin_amd64.go | 499 - .../x/sys/unix/ztypes_darwin_arm.go | 490 - .../x/sys/unix/ztypes_darwin_arm64.go | 499 - .../x/sys/unix/ztypes_dragonfly_amd64.go | 469 - .../x/sys/unix/ztypes_freebsd_386.go | 603 - .../x/sys/unix/ztypes_freebsd_amd64.go | 602 - .../x/sys/unix/ztypes_freebsd_arm.go | 602 - .../golang.org/x/sys/unix/ztypes_linux_386.go | 1988 - .../x/sys/unix/ztypes_linux_amd64.go | 2010 - .../golang.org/x/sys/unix/ztypes_linux_arm.go | 1978 - .../x/sys/unix/ztypes_linux_arm64.go | 1989 - .../x/sys/unix/ztypes_linux_mips.go | 1983 - .../x/sys/unix/ztypes_linux_mips64.go | 1991 - .../x/sys/unix/ztypes_linux_mips64le.go | 1991 - .../x/sys/unix/ztypes_linux_mipsle.go | 1983 - .../x/sys/unix/ztypes_linux_ppc64.go | 1999 - .../x/sys/unix/ztypes_linux_ppc64le.go | 1999 - .../x/sys/unix/ztypes_linux_riscv64.go | 2016 - .../x/sys/unix/ztypes_linux_s390x.go | 2016 - .../x/sys/unix/ztypes_linux_sparc64.go | 690 - .../x/sys/unix/ztypes_netbsd_386.go | 458 - .../x/sys/unix/ztypes_netbsd_amd64.go | 465 - .../x/sys/unix/ztypes_netbsd_arm.go | 463 - .../x/sys/unix/ztypes_openbsd_386.go | 560 - .../x/sys/unix/ztypes_openbsd_amd64.go | 560 - .../x/sys/unix/ztypes_openbsd_arm.go | 553 - .../x/sys/unix/ztypes_solaris_amd64.go | 442 - .../provider/mdns/vendor/vendor.json | 17 - .../github.com/gophercloud/gophercloud/FAQ.md | 148 - .../gophercloud/gophercloud/MIGRATING.md | 32 - .../gophercloud/gophercloud/README.md | 143 - .../gophercloud/gophercloud/STYLEGUIDE.md | 74 - .../gophercloud/gophercloud/errors.go | 401 - .../gophercloud/openstack/auth_env.go | 64 - .../gophercloud/openstack/client.go | 333 - .../openstack/compute/v2/flavors/doc.go | 45 - .../openstack/compute/v2/flavors/requests.go | 194 - .../openstack/compute/v2/flavors/results.go | 133 - .../openstack/compute/v2/flavors/urls.go | 21 - .../openstack/compute/v2/servers/requests.go | 791 - .../openstack/compute/v2/servers/results.go | 404 - .../openstack/identity/v3/tokens/requests.go | 210 - .../openstack/identity/v3/tokens/results.go | 170 - .../gophercloud/gophercloud/params.go | 463 - .../gophercloud/provider_client.go | 307 - .../gophercloud/gophercloud/results.go | 382 - .../provider/os/vendor/vendor.json | 17 - .../provider/packet/vendor/vendor.json | 13 - .../github.com/nicolai86/scaleway-sdk/api.go | 302 - .../scaleway/vendor/golang.org/x/net/LICENSE | 27 - .../scaleway/vendor/golang.org/x/net/PATENTS | 22 - .../golang.org/x/net/context/context.go | 56 - .../vendor/golang.org/x/net/context/go17.go | 72 - .../vendor/golang.org/x/net/context/go19.go | 20 - .../golang.org/x/net/context/pre_go17.go | 300 - .../golang.org/x/net/context/pre_go19.go | 109 - .../scaleway/vendor/golang.org/x/sync/LICENSE | 27 - .../scaleway/vendor/golang.org/x/sync/PATENTS | 22 - .../golang.org/x/sync/errgroup/errgroup.go | 67 - .../provider/scaleway/vendor/vendor.json | 10 - .../softlayer-go/datatypes/account.go | 2785 - .../softlayer-go/datatypes/billing.go | 2660 - .../softlayer/softlayer-go/datatypes/brand.go | 227 - .../softlayer-go/datatypes/hardware.go | 1761 - .../softlayer-go/datatypes/locale.go | 95 - .../softlayer-go/datatypes/location.go | 431 - .../softlayer-go/datatypes/network.go | 5556 - .../softlayer-go/datatypes/product.go | 1836 - .../softlayer-go/datatypes/ticket.go | 702 - .../softlayer/softlayer-go/datatypes/user.go | 1412 - .../softlayer-go/datatypes/virtual.go | 1313 - .../softlayer-go/services/account.go | 4602 - .../softlayer-go/services/billing.go | 2744 - .../softlayer/softlayer-go/services/brand.go | 293 - .../softlayer-go/services/hardware.go | 7779 - .../softlayer/softlayer-go/services/locale.go | 201 - .../softlayer-go/services/location.go | 866 - .../softlayer-go/services/network.go | 13667 -- .../softlayer-go/services/product.go | 2028 - .../softlayer/softlayer-go/services/ticket.go | 1024 - .../softlayer/softlayer-go/services/user.go | 4396 - .../softlayer-go/services/virtual.go | 2957 - .../softlayer/softlayer-go/session/rest.go | 232 - .../softlayer/softlayer-go/session/session.go | 226 - .../softlayer/softlayer-go/session/xmlrpc.go | 195 - .../vendor/golang.org/x/text/LICENSE | 27 - .../vendor/golang.org/x/text/PATENTS | 22 - .../x/text/encoding/charmap/charmap.go | 249 - .../x/text/encoding/charmap/tables.go | 7410 - .../golang.org/x/text/encoding/encoding.go | 335 - .../internal/identifier/identifier.go | 81 - .../text/encoding/internal/identifier/mib.go | 1621 - .../x/text/encoding/internal/internal.go | 75 - .../golang.org/x/text/transform/transform.go | 705 - .../provider/softlayer/vendor/vendor.json | 19 - .../tencentcloud/common/http/request.go | 233 - .../provider/tencentcloud/vendor/vendor.json | 37 - .../github.com/joyent/triton-go/CHANGELOG.md | 91 - .../github.com/joyent/triton-go/GNUmakefile | 40 - .../github.com/joyent/triton-go/Gopkg.lock | 33 - .../github.com/joyent/triton-go/Gopkg.toml | 38 - .../github.com/joyent/triton-go/README.md | 247 - .../joyent/triton-go/client/client.go | 465 - .../joyent/triton-go/compute/client.go | 85 - .../joyent/triton-go/compute/instances.go | 1178 - .../github.com/joyent/triton-go/version.go | 42 - .../vendor/github.com/pkg/errors/LICENSE | 23 - .../vendor/github.com/pkg/errors/README.md | 52 - .../vendor/github.com/pkg/errors/appveyor.yml | 32 - .../vendor/github.com/pkg/errors/errors.go | 269 - .../vendor/github.com/pkg/errors/stack.go | 147 - .../triton/vendor/golang.org/x/crypto/LICENSE | 27 - .../triton/vendor/golang.org/x/crypto/PATENTS | 22 - .../x/crypto/curve25519/const_amd64.h | 8 - .../x/crypto/curve25519/const_amd64.s | 20 - .../x/crypto/curve25519/cswap_amd64.s | 65 - .../x/crypto/curve25519/curve25519.go | 834 - .../golang.org/x/crypto/curve25519/doc.go | 23 - .../x/crypto/curve25519/freeze_amd64.s | 73 - .../x/crypto/curve25519/ladderstep_amd64.s | 1377 - .../x/crypto/curve25519/mont25519_amd64.go | 240 - .../x/crypto/curve25519/mul_amd64.s | 169 - .../x/crypto/curve25519/square_amd64.s | 132 - .../golang.org/x/crypto/ed25519/ed25519.go | 188 - .../ed25519/internal/edwards25519/const.go | 1422 - .../internal/edwards25519/edwards25519.go | 1793 - .../internal/chacha20/chacha_generic.go | 198 - .../golang.org/x/crypto/poly1305/poly1305.go | 33 - .../golang.org/x/crypto/poly1305/sum_amd64.go | 22 - .../golang.org/x/crypto/poly1305/sum_amd64.s | 125 - .../golang.org/x/crypto/poly1305/sum_arm.go | 22 - .../golang.org/x/crypto/poly1305/sum_arm.s | 427 - .../golang.org/x/crypto/poly1305/sum_ref.go | 141 - .../golang.org/x/crypto/ssh/agent/client.go | 683 - .../golang.org/x/crypto/ssh/agent/server.go | 523 - .../vendor/golang.org/x/crypto/ssh/cipher.go | 771 - .../vendor/golang.org/x/crypto/ssh/client.go | 278 - .../vendor/golang.org/x/crypto/ssh/common.go | 383 - .../vendor/golang.org/x/crypto/ssh/kex.go | 540 - .../vendor/golang.org/x/crypto/ssh/keys.go | 1032 - .../vendor/golang.org/x/crypto/ssh/server.go | 593 - .../golang.org/x/crypto/ssh/transport.go | 353 - .../provider/triton/vendor/vendor.json | 95 - .../vendor/github.com/pkg/errors/LICENSE | 23 - .../vendor/github.com/pkg/errors/README.md | 52 - .../vendor/github.com/pkg/errors/appveyor.yml | 32 - .../vendor/github.com/pkg/errors/errors.go | 269 - .../vendor/github.com/pkg/errors/stack.go | 147 - .../github.com/sirupsen/logrus/CHANGELOG.md | 123 - .../vendor/github.com/sirupsen/logrus/LICENSE | 21 - .../github.com/sirupsen/logrus/README.md | 461 - .../github.com/sirupsen/logrus/alt_exit.go | 64 - .../github.com/sirupsen/logrus/appveyor.yml | 14 - .../vendor/github.com/sirupsen/logrus/doc.go | 26 - .../github.com/sirupsen/logrus/entry.go | 300 - .../github.com/sirupsen/logrus/exported.go | 201 - .../github.com/sirupsen/logrus/formatter.go | 51 - .../github.com/sirupsen/logrus/hooks.go | 34 - .../sirupsen/logrus/json_formatter.go | 89 - .../github.com/sirupsen/logrus/logger.go | 337 - .../github.com/sirupsen/logrus/logrus.go | 143 - .../sirupsen/logrus/terminal_bsd.go | 10 - .../logrus/terminal_check_appengine.go | 11 - .../logrus/terminal_check_notappengine.go | 19 - .../sirupsen/logrus/terminal_linux.go | 14 - .../sirupsen/logrus/text_formatter.go | 195 - .../github.com/sirupsen/logrus/writer.go | 62 - .../vendor/golang.org/x/crypto/LICENSE | 27 - .../vendor/golang.org/x/crypto/PATENTS | 22 - .../x/crypto/ssh/terminal/terminal.go | 951 - .../golang.org/x/crypto/ssh/terminal/util.go | 114 - .../x/crypto/ssh/terminal/util_bsd.go | 12 - .../x/crypto/ssh/terminal/util_linux.go | 10 - .../x/crypto/ssh/terminal/util_plan9.go | 58 - .../x/crypto/ssh/terminal/util_solaris.go | 124 - .../x/crypto/ssh/terminal/util_windows.go | 103 - .../vsphere/vendor/golang.org/x/sys/LICENSE | 27 - .../vsphere/vendor/golang.org/x/sys/PATENTS | 22 - .../vendor/golang.org/x/sys/unix/README.md | 173 - .../golang.org/x/sys/unix/affinity_linux.go | 124 - .../golang.org/x/sys/unix/asm_darwin_386.s | 29 - .../golang.org/x/sys/unix/asm_darwin_amd64.s | 29 - .../golang.org/x/sys/unix/asm_darwin_arm.s | 30 - .../golang.org/x/sys/unix/asm_darwin_arm64.s | 30 - .../x/sys/unix/asm_dragonfly_amd64.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_386.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_amd64.s | 29 - .../golang.org/x/sys/unix/asm_freebsd_arm.s | 29 - .../golang.org/x/sys/unix/asm_linux_386.s | 65 - .../golang.org/x/sys/unix/asm_linux_amd64.s | 57 - .../golang.org/x/sys/unix/asm_linux_arm.s | 56 - .../golang.org/x/sys/unix/asm_linux_arm64.s | 52 - .../golang.org/x/sys/unix/asm_linux_mips64x.s | 56 - .../golang.org/x/sys/unix/asm_linux_mipsx.s | 54 - .../golang.org/x/sys/unix/asm_linux_ppc64x.s | 56 - .../golang.org/x/sys/unix/asm_linux_s390x.s | 56 - .../golang.org/x/sys/unix/asm_netbsd_386.s | 29 - .../golang.org/x/sys/unix/asm_netbsd_amd64.s | 29 - .../golang.org/x/sys/unix/asm_netbsd_arm.s | 29 - .../golang.org/x/sys/unix/asm_openbsd_386.s | 29 - .../golang.org/x/sys/unix/asm_openbsd_amd64.s | 29 - .../golang.org/x/sys/unix/asm_openbsd_arm.s | 29 - .../golang.org/x/sys/unix/asm_solaris_amd64.s | 17 - .../golang.org/x/sys/unix/bluetooth_linux.go | 35 - .../golang.org/x/sys/unix/cap_freebsd.go | 195 - .../vendor/golang.org/x/sys/unix/constants.go | 13 - .../golang.org/x/sys/unix/dev_darwin.go | 24 - .../golang.org/x/sys/unix/dev_dragonfly.go | 30 - .../golang.org/x/sys/unix/dev_freebsd.go | 30 - .../vendor/golang.org/x/sys/unix/dev_linux.go | 42 - .../golang.org/x/sys/unix/dev_netbsd.go | 29 - .../golang.org/x/sys/unix/dev_openbsd.go | 29 - .../vendor/golang.org/x/sys/unix/dirent.go | 17 - .../golang.org/x/sys/unix/endian_big.go | 9 - .../golang.org/x/sys/unix/endian_little.go | 9 - .../vendor/golang.org/x/sys/unix/env_unix.go | 31 - .../x/sys/unix/errors_freebsd_386.go | 227 - .../x/sys/unix/errors_freebsd_amd64.go | 227 - .../x/sys/unix/errors_freebsd_arm.go | 226 - .../vendor/golang.org/x/sys/unix/fcntl.go | 28 - .../x/sys/unix/fcntl_linux_32bit.go | 13 - .../vendor/golang.org/x/sys/unix/gccgo.go | 61 - .../vendor/golang.org/x/sys/unix/gccgo_c.c | 47 - .../x/sys/unix/gccgo_linux_amd64.go | 20 - .../vendor/golang.org/x/sys/unix/mkall.sh | 188 - .../vendor/golang.org/x/sys/unix/mkerrors.sh | 603 - .../vendor/golang.org/x/sys/unix/mksyscall.pl | 341 - .../x/sys/unix/mksyscall_solaris.pl | 289 - .../golang.org/x/sys/unix/mksysctl_openbsd.pl | 264 - .../golang.org/x/sys/unix/mksysnum_darwin.pl | 39 - .../x/sys/unix/mksysnum_dragonfly.pl | 50 - .../golang.org/x/sys/unix/mksysnum_freebsd.pl | 50 - .../golang.org/x/sys/unix/mksysnum_netbsd.pl | 58 - .../golang.org/x/sys/unix/mksysnum_openbsd.pl | 50 - .../golang.org/x/sys/unix/openbsd_pledge.go | 38 - .../golang.org/x/sys/unix/pagesize_unix.go | 15 - .../vendor/golang.org/x/sys/unix/race.go | 30 - .../vendor/golang.org/x/sys/unix/race0.go | 25 - .../golang.org/x/sys/unix/sockcmsg_linux.go | 36 - .../golang.org/x/sys/unix/sockcmsg_unix.go | 104 - .../vendor/golang.org/x/sys/unix/str.go | 26 - .../vendor/golang.org/x/sys/unix/syscall.go | 54 - .../golang.org/x/sys/unix/syscall_bsd.go | 624 - .../golang.org/x/sys/unix/syscall_darwin.go | 680 - .../x/sys/unix/syscall_darwin_386.go | 68 - .../x/sys/unix/syscall_darwin_amd64.go | 68 - .../x/sys/unix/syscall_darwin_arm.go | 66 - .../x/sys/unix/syscall_darwin_arm64.go | 68 - .../x/sys/unix/syscall_dragonfly.go | 523 - .../x/sys/unix/syscall_dragonfly_amd64.go | 52 - .../golang.org/x/sys/unix/syscall_freebsd.go | 756 - .../x/sys/unix/syscall_freebsd_386.go | 52 - .../x/sys/unix/syscall_freebsd_amd64.go | 52 - .../x/sys/unix/syscall_freebsd_arm.go | 52 - .../golang.org/x/sys/unix/syscall_linux.go | 1474 - .../x/sys/unix/syscall_linux_386.go | 391 - .../x/sys/unix/syscall_linux_amd64.go | 157 - .../x/sys/unix/syscall_linux_amd64_gc.go | 13 - .../x/sys/unix/syscall_linux_arm.go | 255 - .../x/sys/unix/syscall_linux_arm64.go | 190 - .../golang.org/x/sys/unix/syscall_linux_gc.go | 14 - .../x/sys/unix/syscall_linux_gccgo.go | 21 - .../x/sys/unix/syscall_linux_mips64x.go | 210 - .../x/sys/unix/syscall_linux_mipsx.go | 232 - .../x/sys/unix/syscall_linux_ppc64x.go | 128 - .../x/sys/unix/syscall_linux_s390x.go | 320 - .../x/sys/unix/syscall_linux_sparc64.go | 144 - .../golang.org/x/sys/unix/syscall_netbsd.go | 567 - .../x/sys/unix/syscall_netbsd_386.go | 33 - .../x/sys/unix/syscall_netbsd_amd64.go | 33 - .../x/sys/unix/syscall_netbsd_arm.go | 33 - .../golang.org/x/sys/unix/syscall_openbsd.go | 367 - .../x/sys/unix/syscall_openbsd_386.go | 33 - .../x/sys/unix/syscall_openbsd_amd64.go | 37 - .../x/sys/unix/syscall_openbsd_arm.go | 33 - .../golang.org/x/sys/unix/syscall_solaris.go | 725 - .../x/sys/unix/syscall_solaris_amd64.go | 23 - .../golang.org/x/sys/unix/syscall_unix.go | 394 - .../golang.org/x/sys/unix/syscall_unix_gc.go | 15 - .../golang.org/x/sys/unix/timestruct.go | 82 - .../x/sys/unix/zerrors_darwin_386.go | 1783 - .../x/sys/unix/zerrors_darwin_amd64.go | 1783 - .../x/sys/unix/zerrors_darwin_arm.go | 1783 - .../x/sys/unix/zerrors_darwin_arm64.go | 1783 - .../x/sys/unix/zerrors_dragonfly_amd64.go | 1586 - .../x/sys/unix/zerrors_freebsd_386.go | 1764 - .../x/sys/unix/zerrors_freebsd_amd64.go | 1765 - .../x/sys/unix/zerrors_freebsd_arm.go | 1773 - .../x/sys/unix/zerrors_linux_386.go | 2565 - .../x/sys/unix/zerrors_linux_amd64.go | 2565 - .../x/sys/unix/zerrors_linux_arm.go | 2571 - .../x/sys/unix/zerrors_linux_arm64.go | 2556 - .../x/sys/unix/zerrors_linux_mips.go | 2573 - .../x/sys/unix/zerrors_linux_mips64.go | 2573 - .../x/sys/unix/zerrors_linux_mips64le.go | 2573 - .../x/sys/unix/zerrors_linux_mipsle.go | 2573 - .../x/sys/unix/zerrors_linux_ppc64.go | 2626 - .../x/sys/unix/zerrors_linux_ppc64le.go | 2626 - .../x/sys/unix/zerrors_linux_s390x.go | 2625 - .../x/sys/unix/zerrors_linux_sparc64.go | 2142 - .../x/sys/unix/zerrors_netbsd_386.go | 1728 - .../x/sys/unix/zerrors_netbsd_amd64.go | 1718 - .../x/sys/unix/zerrors_netbsd_arm.go | 1707 - .../x/sys/unix/zerrors_openbsd_386.go | 1600 - .../x/sys/unix/zerrors_openbsd_amd64.go | 1706 - .../x/sys/unix/zerrors_openbsd_arm.go | 1602 - .../x/sys/unix/zerrors_solaris_amd64.go | 1497 - .../golang.org/x/sys/unix/zptrace386_linux.go | 80 - .../golang.org/x/sys/unix/zptracearm_linux.go | 41 - .../x/sys/unix/zptracemips_linux.go | 50 - .../x/sys/unix/zptracemipsle_linux.go | 50 - .../x/sys/unix/zsyscall_darwin_386.go | 1712 - .../x/sys/unix/zsyscall_darwin_amd64.go | 1712 - .../x/sys/unix/zsyscall_darwin_arm.go | 1712 - .../x/sys/unix/zsyscall_darwin_arm64.go | 1712 - .../x/sys/unix/zsyscall_dragonfly_amd64.go | 1508 - .../x/sys/unix/zsyscall_freebsd_386.go | 1937 - .../x/sys/unix/zsyscall_freebsd_amd64.go | 1937 - .../x/sys/unix/zsyscall_freebsd_arm.go | 1937 - .../x/sys/unix/zsyscall_linux_386.go | 2005 - .../x/sys/unix/zsyscall_linux_amd64.go | 2172 - .../x/sys/unix/zsyscall_linux_arm.go | 2107 - .../x/sys/unix/zsyscall_linux_arm64.go | 2065 - .../x/sys/unix/zsyscall_linux_mips.go | 2173 - .../x/sys/unix/zsyscall_linux_mips64.go | 2156 - .../x/sys/unix/zsyscall_linux_mips64le.go | 2156 - .../x/sys/unix/zsyscall_linux_mipsle.go | 2173 - .../x/sys/unix/zsyscall_linux_ppc64.go | 2219 - .../x/sys/unix/zsyscall_linux_ppc64le.go | 2219 - .../x/sys/unix/zsyscall_linux_s390x.go | 1989 - .../x/sys/unix/zsyscall_linux_sparc64.go | 1843 - .../x/sys/unix/zsyscall_netbsd_386.go | 1424 - .../x/sys/unix/zsyscall_netbsd_amd64.go | 1424 - .../x/sys/unix/zsyscall_netbsd_arm.go | 1424 - .../x/sys/unix/zsyscall_openbsd_386.go | 1493 - .../x/sys/unix/zsyscall_openbsd_amd64.go | 1493 - .../x/sys/unix/zsyscall_openbsd_arm.go | 1493 - .../x/sys/unix/zsyscall_solaris_amd64.go | 1681 - .../x/sys/unix/zsysctl_openbsd_386.go | 270 - .../x/sys/unix/zsysctl_openbsd_amd64.go | 257 - .../x/sys/unix/zsysctl_openbsd_arm.go | 270 - .../x/sys/unix/zsysnum_darwin_386.go | 436 - .../x/sys/unix/zsysnum_darwin_amd64.go | 436 - .../x/sys/unix/zsysnum_darwin_arm.go | 436 - .../x/sys/unix/zsysnum_darwin_arm64.go | 436 - .../x/sys/unix/zsysnum_dragonfly_amd64.go | 315 - .../x/sys/unix/zsysnum_freebsd_386.go | 353 - .../x/sys/unix/zsysnum_freebsd_amd64.go | 353 - .../x/sys/unix/zsysnum_freebsd_arm.go | 353 - .../x/sys/unix/zsysnum_linux_386.go | 390 - .../x/sys/unix/zsysnum_linux_amd64.go | 342 - .../x/sys/unix/zsysnum_linux_arm.go | 362 - .../x/sys/unix/zsysnum_linux_arm64.go | 286 - .../x/sys/unix/zsysnum_linux_mips.go | 375 - .../x/sys/unix/zsysnum_linux_mips64.go | 335 - .../x/sys/unix/zsysnum_linux_mips64le.go | 335 - .../x/sys/unix/zsysnum_linux_mipsle.go | 375 - .../x/sys/unix/zsysnum_linux_ppc64.go | 373 - .../x/sys/unix/zsysnum_linux_ppc64le.go | 373 - .../x/sys/unix/zsysnum_linux_s390x.go | 334 - .../x/sys/unix/zsysnum_linux_sparc64.go | 348 - .../x/sys/unix/zsysnum_netbsd_386.go | 274 - .../x/sys/unix/zsysnum_netbsd_amd64.go | 274 - .../x/sys/unix/zsysnum_netbsd_arm.go | 274 - .../x/sys/unix/zsysnum_openbsd_386.go | 207 - .../x/sys/unix/zsysnum_openbsd_amd64.go | 217 - .../x/sys/unix/zsysnum_openbsd_arm.go | 213 - .../x/sys/unix/ztypes_darwin_386.go | 489 - .../x/sys/unix/ztypes_darwin_amd64.go | 499 - .../x/sys/unix/ztypes_darwin_arm.go | 490 - .../x/sys/unix/ztypes_darwin_arm64.go | 499 - .../x/sys/unix/ztypes_dragonfly_amd64.go | 486 - .../x/sys/unix/ztypes_freebsd_386.go | 553 - .../x/sys/unix/ztypes_freebsd_amd64.go | 556 - .../x/sys/unix/ztypes_freebsd_arm.go | 556 - .../golang.org/x/sys/unix/ztypes_linux_386.go | 1815 - .../x/sys/unix/ztypes_linux_amd64.go | 1835 - .../golang.org/x/sys/unix/ztypes_linux_arm.go | 1804 - .../x/sys/unix/ztypes_linux_arm64.go | 1814 - .../x/sys/unix/ztypes_linux_mips.go | 1809 - .../x/sys/unix/ztypes_linux_mips64.go | 1816 - .../x/sys/unix/ztypes_linux_mips64le.go | 1816 - .../x/sys/unix/ztypes_linux_mipsle.go | 1809 - .../x/sys/unix/ztypes_linux_ppc64.go | 1824 - .../x/sys/unix/ztypes_linux_ppc64le.go | 1824 - .../x/sys/unix/ztypes_linux_s390x.go | 1841 - .../x/sys/unix/ztypes_linux_sparc64.go | 690 - .../x/sys/unix/ztypes_netbsd_386.go | 448 - .../x/sys/unix/ztypes_netbsd_amd64.go | 455 - .../x/sys/unix/ztypes_netbsd_arm.go | 453 - .../x/sys/unix/ztypes_openbsd_386.go | 484 - .../x/sys/unix/ztypes_openbsd_amd64.go | 484 - .../x/sys/unix/ztypes_openbsd_arm.go | 477 - .../x/sys/unix/ztypes_solaris_amd64.go | 459 - .../x/sys/windows/asm_windows_386.s | 13 - .../x/sys/windows/asm_windows_amd64.s | 13 - .../golang.org/x/sys/windows/dll_windows.go | 378 - .../golang.org/x/sys/windows/env_windows.go | 29 - .../golang.org/x/sys/windows/eventlog.go | 20 - .../golang.org/x/sys/windows/exec_windows.go | 97 - .../x/sys/windows/memory_windows.go | 26 - .../golang.org/x/sys/windows/mksyscall.go | 7 - .../vendor/golang.org/x/sys/windows/race.go | 30 - .../vendor/golang.org/x/sys/windows/race0.go | 25 - .../x/sys/windows/security_windows.go | 476 - .../golang.org/x/sys/windows/service.go | 165 - .../vendor/golang.org/x/sys/windows/str.go | 22 - .../golang.org/x/sys/windows/syscall.go | 74 - .../x/sys/windows/syscall_windows.go | 1153 - .../golang.org/x/sys/windows/types_windows.go | 1333 - .../x/sys/windows/types_windows_386.go | 22 - .../x/sys/windows/types_windows_amd64.go | 22 - .../x/sys/windows/zsyscall_windows.go | 2700 - .../provider/vsphere/vendor/vendor.json | 29 - .../hashicorp/go-envparse/.appveyor.yml | 35 + .../hashicorp/go-envparse/.gitignore | 14 + .../hashicorp/go-envparse/.travis.yml | 16 + .../hashicorp/go-getter/.travis.yml | 25 + .../github.com/hashicorp/go-getter/README.md | 14 +- .../hashicorp/go-getter/appveyor.yml | 16 + .../github.com/hashicorp/go-getter/get_git.go | 31 +- .../hashicorp/go-getter/get_http.go | 26 +- vendor/github.com/hashicorp/go-getter/go.mod | 11 +- vendor/github.com/hashicorp/go-getter/go.sum | 210 +- .../github.com/hashicorp/go-hclog/.gitignore | 1 + .../hashicorp/go-hclog/intlogger.go | 36 + .../github.com/hashicorp/go-hclog/logger.go | 19 + .../hashicorp/go-immutable-radix/.gitignore | 24 + .../hashicorp/go-immutable-radix/iter.go | 2 +- .../hashicorp/go-immutable-radix/raw_iter.go | 2 +- .../github.com/hashicorp/go-memdb/.gitignore | 26 + .../hashicorp/go-msgpack/codec/build.sh | 0 .../hashicorp/go-msgpack/codec/test.py | 0 .../hashicorp/go-multierror/.travis.yml | 12 + .../github.com/hashicorp/go-plugin/.gitignore | 2 + .../hashicorp/go-retryablehttp/.gitignore | 4 + .../hashicorp/go-retryablehttp/.travis.yml | 12 + .../hashicorp/go-retryablehttp/client.go | 79 +- .../hashicorp/go-rootcerts/.travis.yml | 12 + .../github.com/hashicorp/go-safetemp/go.mod | 1 + .../hashicorp/go-sockaddr/.gitignore | 26 + .../hashicorp/go-sockaddr/GNUmakefile | 2 +- .../github.com/hashicorp/go-sockaddr/go.mod | 8 + .../github.com/hashicorp/go-sockaddr/go.sum | 24 + .../hashicorp/go-sockaddr/ifaddrs.go | 41 +- .../go-sockaddr/route_info_android.go | 34 + .../hashicorp/go-sockaddr/route_info_linux.go | 2 + .../github.com/hashicorp/go-syslog/.gitignore | 22 + .../github.com/hashicorp/go-uuid/.travis.yml | 12 + .../hashicorp/golang-lru/.gitignore | 23 + vendor/github.com/hashicorp/golang-lru/2q.go | 21 +- vendor/github.com/hashicorp/golang-lru/arc.go | 16 +- vendor/github.com/hashicorp/golang-lru/doc.go | 21 + vendor/github.com/hashicorp/golang-lru/go.mod | 3 + vendor/github.com/hashicorp/golang-lru/lru.go | 106 +- .../hashicorp/golang-lru/simplelru/lru.go | 35 +- .../golang-lru/simplelru/lru_interface.go | 39 + vendor/github.com/hashicorp/hcl/.gitignore | 9 + vendor/github.com/hashicorp/hcl/.travis.yml | 13 + vendor/github.com/hashicorp/hcl/README.md | 7 +- .../hashicorp/hcl/hcl/printer/nodes.go | 789 - .../hashicorp/hcl/hcl/printer/printer.go | 66 - .../hcl/v2/hclsyntax/expression_vars.go | 0 .../github.com/hashicorp/logutils/.gitignore | 22 + vendor/github.com/hashicorp/logutils/go.mod | 1 + vendor/github.com/hashicorp/mdns/.gitignore | 23 + .../github.com/hashicorp => }/mdns/LICENSE | 0 .../github.com/hashicorp => }/mdns/README.md | 0 .../github.com/hashicorp => }/mdns/client.go | 0 .../github.com/hashicorp => }/mdns/go.mod | 0 .../github.com/hashicorp => }/mdns/go.sum | 0 .../github.com/hashicorp => }/mdns/server.go | 0 .../github.com/hashicorp => }/mdns/zone.go | 0 .../hashicorp/memberlist/.gitignore | 25 + .../github.com/hashicorp/memberlist/Makefile | 29 +- .../github.com/hashicorp/memberlist/README.md | 4 +- .../hashicorp/memberlist/alive_delegate.go | 6 +- .../github.com/hashicorp/memberlist/config.go | 5 + vendor/github.com/hashicorp/memberlist/go.mod | 10 +- vendor/github.com/hashicorp/memberlist/go.sum | 23 +- .../hashicorp/memberlist/memberlist.go | 44 +- vendor/github.com/hashicorp/memberlist/net.go | 5 +- .../github.com/hashicorp/memberlist/state.go | 143 +- vendor/github.com/hashicorp/memberlist/tag.sh | 0 vendor/github.com/hashicorp/nomad/api/acl.go | 196 + .../github.com/hashicorp/nomad/api/agent.go | 440 + .../hashicorp/nomad/api/allocations.go | 631 + vendor/github.com/hashicorp/nomad/api/api.go | 971 + .../hashicorp/nomad/api/constraint.go | 30 + .../hashicorp/nomad/api/contexts/contexts.go | 17 + vendor/github.com/hashicorp/nomad/api/csi.go | 266 + .../hashicorp/nomad/api/deployments.go | 264 + .../hashicorp/nomad/api/evaluations.go | 101 + vendor/github.com/hashicorp/nomad/api/fs.go | 383 + vendor/github.com/hashicorp/nomad/api/go.mod | 16 + vendor/github.com/hashicorp/nomad/api/go.sum | 35 + .../github.com/hashicorp/nomad/api/ioutil.go | 81 + vendor/github.com/hashicorp/nomad/api/jobs.go | 1203 + .../hashicorp/nomad/api/namespace.go | 91 + .../github.com/hashicorp/nomad/api/nodes.go | 806 + .../hashicorp/nomad/api/operator.go | 282 + .../hashicorp/nomad/api/operator_autopilot.go | 222 + .../github.com/hashicorp/nomad/api/quota.go | 186 + vendor/github.com/hashicorp/nomad/api/raw.go | 38 + .../github.com/hashicorp/nomad/api/regions.go | 23 + .../hashicorp/nomad/api/resources.go | 240 + .../github.com/hashicorp/nomad/api/scaling.go | 102 + .../github.com/hashicorp/nomad/api/search.go | 39 + .../hashicorp/nomad/api/sentinel.go | 79 + .../hashicorp/nomad/api/services.go | 281 + .../github.com/hashicorp/nomad/api/status.go | 43 + .../github.com/hashicorp/nomad/api/system.go | 23 + .../github.com/hashicorp/nomad/api/tasks.go | 991 + .../github.com/hashicorp/nomad/api/utils.go | 63 + .../hashicorp/raft-boltdb/.travis.yml | 10 + .../github.com/hashicorp/raft-boltdb/Makefile | 11 + .../hashicorp/raft-boltdb/bolt_store.go | 53 +- vendor/github.com/hashicorp/raft/.gitignore | 23 + .../hashicorp/raft/.golangci-lint.yml | 49 + vendor/github.com/hashicorp/raft/.travis.yml | 21 + .../hashicorp/raft/leadership_delegate.go | 9 - vendor/github.com/hashicorp/raft/tag.sh | 0 vendor/github.com/hashicorp/serf/CHANGELOG.md | 423 - vendor/github.com/hashicorp/serf/GNUmakefile | 64 - vendor/github.com/hashicorp/serf/README.md | 121 - .../hashicorp/serf/ops-misc/debian/copyright | 2 - .../github.com/hashicorp/serf/serf/config.go | 5 + .../github.com/hashicorp/serf/serf/event.go | 64 +- .../hashicorp/serf/serf/internal_query.go | 71 +- .../hashicorp/serf/serf/keymanager.go | 5 + .../hashicorp/serf/serf/messages.go | 1 + vendor/github.com/hashicorp/serf/serf/serf.go | 153 +- .../hashicorp/serf/website/LICENSE.md | 10 - .../hashicorp/serf/website/source/LICENSE | 10 - .../hashicorp/vault/{ => api}/LICENSE | 0 vendor/github.com/hashicorp/vault/api/go.mod | 2 +- vendor/github.com/hashicorp/vault/main.go | 11 - vendor/github.com/hashicorp/vault/sdk/LICENSE | 363 + .../github.com/hashicorp => }/vic/LICENSE | 0 .../vic/pkg/vsphere/tags/categories.go | 0 .../vic/pkg/vsphere/tags/rest_client.go | 0 .../vic/pkg/vsphere/tags/tag_association.go | 0 .../vic/pkg/vsphere/tags/tags.go | 0 vendor/github.com/hashicorp/yamux/.gitignore | 23 + vendor/github.com/hpcloud/tail/.gitignore | 3 + vendor/github.com/hpcloud/tail/.travis.yml | 19 + vendor/github.com/hpcloud/tail/CHANGES.md | 63 + vendor/github.com/hpcloud/tail/Dockerfile | 19 + vendor/github.com/hpcloud/tail/Makefile | 11 + vendor/github.com/hpcloud/tail/README.md | 28 + vendor/github.com/hpcloud/tail/appveyor.yml | 11 + .../hpcloud/tail/ratelimiter/Licence | 7 + .../hpcloud/tail/ratelimiter/leakybucket.go | 97 + .../hpcloud/tail/ratelimiter/memory.go | 60 + .../hpcloud/tail/ratelimiter/storage.go | 6 + vendor/github.com/hpcloud/tail/tail.go | 437 + vendor/github.com/hpcloud/tail/tail_posix.go | 11 + .../github.com/hpcloud/tail/tail_windows.go | 12 + .../hpcloud/tail/winfile/winfile.go | 92 + .../jmespath/go-jmespath/.gitignore | 4 + .../jmespath/go-jmespath/.travis.yml | 9 + .../github.com/jmespath/go-jmespath/Makefile | 2 +- vendor/github.com/jmespath/go-jmespath/api.go | 2 +- .../go-jmespath/compliance/basic.json | 96 - .../go-jmespath/compliance/boolean.json | 257 - .../go-jmespath/compliance/current.json | 25 - .../go-jmespath/compliance/escape.json | 46 - .../go-jmespath/compliance/filters.json | 468 - .../go-jmespath/compliance/functions.json | 825 - .../go-jmespath/compliance/identifiers.json | 1377 - .../go-jmespath/compliance/indices.json | 346 - .../go-jmespath/compliance/literal.json | 185 - .../go-jmespath/compliance/multiselect.json | 393 - .../go-jmespath/compliance/ormatch.json | 59 - .../jmespath/go-jmespath/compliance/pipe.json | 131 - .../go-jmespath/compliance/slice.json | 187 - .../go-jmespath/compliance/syntax.json | 616 - .../go-jmespath/compliance/unicode.json | 38 - .../go-jmespath/compliance/wildcard.json | 460 - .../jmespath/go-jmespath/functions.go | 128 +- .../github.com/jmespath/go-jmespath/parser.go | 4 +- vendor/github.com/joyent/triton-go/.gitignore | 19 + .../github.com/joyent/triton-go/.travis.yml | 19 + .../github.com/joyent/triton-go/CHANGELOG.md | 100 + .../github.com/joyent/triton-go/GNUmakefile | 46 + vendor/github.com/joyent/triton-go/Gopkg.lock | 308 + vendor/github.com/joyent/triton-go/Gopkg.toml | 74 + .../github.com => }/joyent/triton-go/LICENSE | 0 vendor/github.com/joyent/triton-go/README.md | 249 + .../authentication/agent_key_identifier.go | 0 .../joyent/triton-go/authentication/dummy.go | 0 .../authentication/ecdsa_signature.go | 0 .../authentication/private_key_signer.go | 0 .../triton-go/authentication/rsa_signature.go | 0 .../triton-go/authentication/signature.go | 0 .../joyent/triton-go/authentication/signer.go | 0 .../authentication/ssh_agent_signer.go | 0 .../triton-go/authentication/test_signer.go | 0 .../joyent/triton-go/authentication/util.go | 0 .../joyent/triton-go/client/client.go | 600 + .../joyent/triton-go/compute/client.go | 90 + .../joyent/triton-go/compute/datacenters.go | 0 .../joyent/triton-go/compute/images.go | 0 .../joyent/triton-go/compute/instances.go | 1178 + .../joyent/triton-go/compute/packages.go | 0 .../joyent/triton-go/compute/ping.go | 0 .../joyent/triton-go/compute/services.go | 0 .../joyent/triton-go/compute/snapshots.go | 0 .../joyent/triton-go/compute/volumes.go | 0 .../joyent/triton-go/errors/errors.go | 0 .../joyent/triton-go/triton.go | 0 vendor/github.com/joyent/triton-go/version.go | 42 + .../jstemmer/go-junit-report/.gitignore | 1 + .../jstemmer/go-junit-report/.travis.yml | 13 + .../jstemmer/go-junit-report/LICENSE | 20 + .../jstemmer/go-junit-report/README.md | 46 + .../go-junit-report/formatter/formatter.go | 182 + .../go-junit-report/go-junit-report.go | 51 + .../jstemmer/go-junit-report/parser/parser.go | 303 + .../go-windows-terminal-sequences/README.md | 1 + .../sequences.go | 3 +- vendor/github.com/kr/pretty/.gitignore | 4 + vendor/github.com/kr/pretty/License | 2 - vendor/github.com/kr/pretty/formatter.go | 3 +- vendor/github.com/kr/pretty/go.mod | 5 + vendor/github.com/kr/pretty/go.sum | 3 + vendor/github.com/kr/pretty/pretty.go | 2 +- vendor/github.com/kr/pty/.gitignore | 4 + vendor/github.com/kr/pty/mktypes.bash | 0 vendor/github.com/kr/pty/types.go | 10 - vendor/github.com/kr/pty/types_dragonfly.go | 17 - vendor/github.com/kr/pty/types_freebsd.go | 15 - vendor/github.com/kr/pty/types_openbsd.go | 14 - vendor/github.com/kr/text/go.mod | 3 + vendor/github.com/linode/linodego/.gitignore | 19 + vendor/github.com/linode/linodego/.travis.yml | 22 + .../linode/linodego/API_SUPPORT.md | 0 .../linode/linodego/CHANGELOG.md | 0 .../linode/linodego/Gopkg.lock | 0 .../linode/linodego/Gopkg.toml | 0 .../github.com => }/linode/linodego/LICENSE | 0 .../github.com => }/linode/linodego/Makefile | 0 .../github.com => }/linode/linodego/README.md | 0 .../linode/linodego/account.go | 0 .../linode/linodego/account_events.go | 0 .../linode/linodego/account_invoices.go | 0 .../linode/linodego/account_notifications.go | 0 .../linode/linodego/account_users.go | 0 .../github.com => }/linode/linodego/client.go | 0 .../linode/linodego/domain_records.go | 0 .../linode/linodego/domains.go | 0 .../linode/linodego/env.sample | 0 .../github.com => }/linode/linodego/errors.go | 0 .../github.com => }/linode/linodego/images.go | 0 .../linode/linodego/instance_configs.go | 0 .../linode/linodego/instance_disks.go | 0 .../linode/linodego/instance_ips.go | 0 .../linode/linodego/instance_snapshots.go | 0 .../linode/linodego/instance_volumes.go | 0 .../linode/linodego/instances.go | 0 .../linode/linodego/kernels.go | 0 .../linode/linodego/longview.go | 0 .../linode/linodego/longview_subscriptions.go | 0 .../linode/linodego/managed.go | 0 .../linode/linodego/network_ips.go | 0 .../linode/linodego/network_pools.go | 0 .../linode/linodego/network_ranges.go | 0 .../linode/linodego/nodebalancer.go | 0 .../linodego/nodebalancer_config_nodes.go | 0 .../linode/linodego/nodebalancer_configs.go | 0 .../linode/linodego/pagination.go | 0 .../linode/linodego/profile.go | 0 .../linode/linodego/profile_sshkeys.go | 0 .../linode/linodego/profile_tokens.go | 0 .../linode/linodego/regions.go | 0 .../linode/linodego/resources.go | 0 .../linode/linodego/stackscripts.go | 0 .../linode/linodego/support.go | 0 .../github.com => }/linode/linodego/tags.go | 0 .../github.com => }/linode/linodego/types.go | 0 .../github.com => }/linode/linodego/util.go | 0 .../linode/linodego/volumes.go | 0 .../linode/linodego/waitfor.go | 0 .../github.com/mattn/go-colorable/.travis.yml | 15 + .../github.com/mattn/go-colorable/README.md | 4 +- .../mattn/go-colorable/colorable_appengine.go | 14 +- .../mattn/go-colorable/colorable_others.go | 14 +- .../mattn/go-colorable/colorable_windows.go | 71 +- vendor/github.com/mattn/go-colorable/go.mod | 8 + vendor/github.com/mattn/go-colorable/go.sum | 5 + .../github.com/mattn/go-colorable/go.test.sh | 12 + .../mattn/go-colorable/noncolorable.go | 6 +- vendor/github.com/mattn/go-isatty/.travis.yml | 14 + vendor/github.com/mattn/go-isatty/README.md | 2 +- vendor/github.com/mattn/go-isatty/go.mod | 5 + vendor/github.com/mattn/go-isatty/go.sum | 2 + vendor/github.com/mattn/go-isatty/go.test.sh | 12 + .../github.com/mattn/go-isatty/isatty_bsd.go | 18 +- .../mattn/go-isatty/isatty_linux.go | 18 - .../mattn/go-isatty/isatty_linux_ppc64x.go | 19 - .../mattn/go-isatty/isatty_others.go | 11 +- .../mattn/go-isatty/isatty_plan9.go | 22 + .../mattn/go-isatty/isatty_solaris.go | 6 + .../mattn/go-isatty/isatty_tcgets.go | 18 + .../mattn/go-isatty/isatty_windows.go | 39 +- .../github.com/mattn/go-isatty/renovate.json | 8 + .../mattn/go-shellwords/.travis.yml | 8 + vendor/github.com/mattn/go-shellwords/LICENSE | 21 + .../github.com/mattn/go-shellwords/README.md | 2 +- vendor/github.com/mattn/go-shellwords/go.mod | 1 + .../mattn/go-shellwords/shellwords.go | 95 +- .../mattn/go-shellwords/util_go15.go | 24 + .../mattn/go-shellwords/util_posix.go | 5 +- .../mattn/go-shellwords/util_windows.go | 5 + .../pbutil/.gitignore | 1 + vendor/github.com/miekg/dns/.codecov.yml | 8 + vendor/github.com/miekg/dns/.gitignore | 4 + vendor/github.com/miekg/dns/.travis.yml | 16 + vendor/github.com/miekg/dns/CODEOWNERS | 1 + vendor/github.com/miekg/dns/CONTRIBUTORS | 1 + vendor/github.com/miekg/dns/LICENSE | 6 +- .../github.com => }/miekg/dns/Makefile.fuzz | 0 .../miekg/dns/Makefile.release | 0 vendor/github.com/miekg/dns/README.md | 109 +- vendor/github.com/miekg/dns/acceptfunc.go | 61 + vendor/github.com/miekg/dns/client.go | 451 +- vendor/github.com/miekg/dns/clientconfig.go | 56 +- .../vendor/github.com => }/miekg/dns/dane.go | 0 vendor/github.com/miekg/dns/defaults.go | 146 +- vendor/github.com/miekg/dns/dns.go | 86 +- vendor/github.com/miekg/dns/dnssec.go | 280 +- vendor/github.com/miekg/dns/dnssec_keygen.go | 74 +- vendor/github.com/miekg/dns/dnssec_keyscan.go | 245 +- vendor/github.com/miekg/dns/dnssec_privkey.go | 21 +- vendor/github.com/miekg/dns/doc.go | 133 +- vendor/github.com/miekg/dns/duplicate.go | 38 + vendor/github.com/miekg/dns/edns.go | 378 +- vendor/github.com/miekg/dns/format.go | 17 +- vendor/github.com/miekg/dns/fuzz.go | 32 + .../github.com => }/miekg/dns/generate.go | 9 +- vendor/github.com/miekg/dns/go.mod | 12 + vendor/github.com/miekg/dns/go.sum | 33 + vendor/github.com/miekg/dns/labels.go | 114 +- .../github.com => }/miekg/dns/listen_go111.go | 0 .../miekg/dns/listen_go_not111.go | 0 vendor/github.com/miekg/dns/msg.go | 1924 +- .../github.com => }/miekg/dns/msg_helpers.go | 123 +- vendor/github.com/miekg/dns/msg_truncate.go | 111 + vendor/github.com/miekg/dns/nsecx.go | 119 +- vendor/github.com/miekg/dns/privaterr.go | 113 +- vendor/github.com/miekg/dns/rawmsg.go | 95 - vendor/github.com/miekg/dns/reverse.go | 52 + vendor/github.com/miekg/dns/sanitize.go | 10 +- .../vendor/github.com => }/miekg/dns/scan.go | 195 +- vendor/github.com/miekg/dns/scan_rr.go | 1698 + vendor/github.com/miekg/dns/scanner.go | 43 - .../github.com => }/miekg/dns/serve_mux.go | 28 +- vendor/github.com/miekg/dns/server.go | 749 +- vendor/github.com/miekg/dns/sig0.go | 57 +- vendor/github.com/miekg/dns/singleinflight.go | 10 +- .../github.com => }/miekg/dns/smimea.go | 5 +- vendor/github.com/miekg/dns/tlsa.go | 50 +- vendor/github.com/miekg/dns/tsig.go | 179 +- vendor/github.com/miekg/dns/types.go | 634 +- vendor/github.com/miekg/dns/types_generate.go | 266 - vendor/github.com/miekg/dns/udp.go | 100 +- vendor/github.com/miekg/dns/udp_linux.go | 73 - vendor/github.com/miekg/dns/udp_other.go | 17 - vendor/github.com/miekg/dns/udp_plan9.go | 34 - vendor/github.com/miekg/dns/udp_windows.go | 25 +- vendor/github.com/miekg/dns/update.go | 14 +- vendor/github.com/miekg/dns/version.go | 15 + vendor/github.com/miekg/dns/xfr.go | 124 +- vendor/github.com/miekg/dns/zduplicate.go | 1140 + vendor/github.com/miekg/dns/zgenerate.go | 158 - vendor/github.com/miekg/dns/zmsg.go | 2722 + vendor/github.com/miekg/dns/zscan.go | 974 - vendor/github.com/miekg/dns/zscan_rr.go | 2270 - vendor/github.com/miekg/dns/ztypes.go | 583 +- vendor/github.com/mitchellh/cli/.travis.yml | 14 + vendor/github.com/mitchellh/cli/cli.go | 5 + vendor/github.com/mitchellh/cli/go.mod | 12 + vendor/github.com/mitchellh/cli/go.sum | 22 + .../mitchellh/colorstring/.travis.yml | 15 + .../mitchellh/copystructure/.travis.yml | 12 + .../github.com/mitchellh/copystructure/go.mod | 3 + .../github.com/mitchellh/copystructure/go.sum | 2 + .../mitchellh/go-homedir/go.mod | 0 .../mitchellh/go-homedir/homedir.go | 66 +- vendor/github.com/mitchellh/go-ps/.gitignore | 1 + vendor/github.com/mitchellh/go-ps/.travis.yml | 4 + vendor/github.com/mitchellh/go-ps/README.md | 2 +- .../mitchellh/go-ps/process_freebsd.go | 2 +- .../go-testing-interface/.travis.yml | 13 + .../mitchellh/go-testing-interface/go.mod | 1 + .../github.com/mitchellh/go-wordwrap/go.mod | 1 + .../mitchellh/hashstructure/README.md | 56 +- .../github.com/mitchellh/hashstructure/go.mod | 1 + .../mitchellh/hashstructure/hashstructure.go | 67 +- .../mitchellh/mapstructure/.travis.yml | 9 + .../mitchellh/mapstructure/CHANGELOG.md | 53 + .../mitchellh/mapstructure/README.md | 2 +- .../mitchellh/mapstructure/decode_hooks.go | 84 +- .../github.com/mitchellh/mapstructure/go.mod | 3 + .../mitchellh/mapstructure/mapstructure.go | 820 +- .../mitchellh/reflectwalk/.travis.yml | 1 + .../github.com/mitchellh/reflectwalk/go.mod | 1 + .../mitchellh/reflectwalk/location_string.go | 8 +- .../mitchellh/reflectwalk/reflectwalk.go | 3 +- .../github.com/mrunalp/fileutils/.gitignore | 1 + .../nicolai86/scaleway-sdk/LICENSE.md | 0 .../nicolai86/scaleway-sdk/README.md | 0 .../github.com/nicolai86/scaleway-sdk/api.go | 302 + .../nicolai86/scaleway-sdk/availability.go | 0 .../nicolai86/scaleway-sdk/bootscript.go | 0 .../nicolai86/scaleway-sdk/container.go | 0 .../nicolai86/scaleway-sdk/dashboard.go | 0 .../nicolai86/scaleway-sdk/image.go | 0 .../nicolai86/scaleway-sdk/ip.go | 0 .../nicolai86/scaleway-sdk/organization.go | 0 .../nicolai86/scaleway-sdk/permissions.go | 0 .../nicolai86/scaleway-sdk/quota.go | 0 .../nicolai86/scaleway-sdk/security_group.go | 0 .../scaleway-sdk/security_group_rule.go | 0 .../nicolai86/scaleway-sdk/server.go | 0 .../nicolai86/scaleway-sdk/snapshot.go | 0 .../nicolai86/scaleway-sdk/tasks.go | 0 .../nicolai86/scaleway-sdk/tokens.go | 0 .../nicolai86/scaleway-sdk/user.go | 0 .../nicolai86/scaleway-sdk/user_data.go | 0 .../nicolai86/scaleway-sdk/volume.go | 0 vendor/github.com/oklog/run/.gitignore | 14 + vendor/github.com/oklog/run/.travis.yml | 12 + vendor/github.com/onsi/ginkgo/.gitignore | 7 + vendor/github.com/onsi/ginkgo/.travis.yml | 25 + vendor/github.com/onsi/ginkgo/CHANGELOG.md | 119 +- vendor/github.com/onsi/ginkgo/CONTRIBUTING.md | 32 +- vendor/github.com/onsi/ginkgo/README.md | 6 +- vendor/github.com/onsi/ginkgo/RELEASING.md | 14 + vendor/github.com/onsi/ginkgo/before_pr.sh | 13 - .../github.com/onsi/ginkgo/config/config.go | 24 +- .../onsi/ginkgo/ginkgo/bootstrap_command.go | 202 - .../onsi/ginkgo/ginkgo/build_command.go | 68 - .../ginkgo/ginkgo/convert/ginkgo_ast_nodes.go | 123 - .../onsi/ginkgo/ginkgo/convert/import.go | 91 - .../ginkgo/ginkgo/convert/package_rewriter.go | 127 - .../onsi/ginkgo/ginkgo/convert/test_finder.go | 56 - .../ginkgo/convert/testfile_rewriter.go | 163 - .../ginkgo/convert/testing_t_rewriter.go | 130 - .../onsi/ginkgo/ginkgo/convert_command.go | 45 - .../onsi/ginkgo/ginkgo/generate_command.go | 167 - .../onsi/ginkgo/ginkgo/help_command.go | 31 - .../interrupthandler/interrupt_handler.go | 52 - .../sigquit_swallower_unix.go | 14 - .../sigquit_swallower_windows.go | 7 - vendor/github.com/onsi/ginkgo/ginkgo/main.go | 300 - .../onsi/ginkgo/ginkgo/nodot/nodot.go | 194 - .../onsi/ginkgo/ginkgo/nodot_command.go | 77 - .../onsi/ginkgo/ginkgo/notifications.go | 141 - .../onsi/ginkgo/ginkgo/run_command.go | 269 - .../run_watch_and_build_command_flags.go | 167 - .../onsi/ginkgo/ginkgo/suite_runner.go | 173 - .../ginkgo/ginkgo/testrunner/log_writer.go | 52 - .../ginkgo/ginkgo/testrunner/run_result.go | 27 - .../ginkgo/ginkgo/testrunner/test_runner.go | 554 - .../ginkgo/ginkgo/testsuite/test_suite.go | 115 - .../ginkgo/testsuite/vendor_check_go15.go | 16 - .../ginkgo/testsuite/vendor_check_go16.go | 15 - .../onsi/ginkgo/ginkgo/unfocus_command.go | 40 - .../onsi/ginkgo/ginkgo/version_command.go | 24 - .../onsi/ginkgo/ginkgo/watch/delta.go | 22 - .../onsi/ginkgo/ginkgo/watch/delta_tracker.go | 75 - .../onsi/ginkgo/ginkgo/watch/dependencies.go | 91 - .../onsi/ginkgo/ginkgo/watch/package_hash.go | 104 - .../ginkgo/ginkgo/watch/package_hashes.go | 85 - .../onsi/ginkgo/ginkgo/watch/suite.go | 87 - .../onsi/ginkgo/ginkgo/watch_command.go | 175 - vendor/github.com/onsi/ginkgo/ginkgo_dsl.go | 32 +- vendor/github.com/onsi/ginkgo/go.mod | 9 + vendor/github.com/onsi/ginkgo/go.sum | 26 + .../internal/codelocation/code_location.go | 20 +- .../ginkgo/internal/leafnodes/benchmarker.go | 2 +- .../onsi/ginkgo/internal/leafnodes/runner.go | 3 + .../ginkgo/internal/leafnodes/setup_nodes.go | 6 + .../onsi/ginkgo/internal/remote/aggregator.go | 12 +- .../internal/remote/forwarding_reporter.go | 61 +- .../internal/remote/output_interceptor.go | 3 + .../remote/output_interceptor_unix.go | 28 + .../internal/remote/output_interceptor_win.go | 3 + .../onsi/ginkgo/internal/remote/server.go | 2 +- .../remote/syscall_dup_linux_riscv64.go | 11 + .../internal/remote/syscall_dup_unix.go | 1 + .../onsi/ginkgo/internal/spec/spec.go | 24 +- .../onsi/ginkgo/internal/spec/specs.go | 49 +- .../ginkgo/internal/specrunner/spec_runner.go | 9 +- .../onsi/ginkgo/internal/suite/suite.go | 7 + .../onsi/ginkgo/internal/writer/writer.go | 16 +- .../onsi/ginkgo/reporters/default_reporter.go | 3 + .../onsi/ginkgo/reporters/junit_reporter.go | 53 +- .../reporters/stenographer/stenographer.go | 7 +- .../support/go-isatty/isatty_appengine.go | 9 + .../ginkgo/reporters/teamcity_reporter.go | 43 +- vendor/github.com/onsi/ginkgo/types/types.go | 5 +- vendor/github.com/onsi/gomega/.gitignore | 5 + vendor/github.com/onsi/gomega/.travis.yml | 17 + vendor/github.com/onsi/gomega/CHANGELOG.md | 105 +- vendor/github.com/onsi/gomega/Makefile | 6 + vendor/github.com/onsi/gomega/README.md | 2 +- vendor/github.com/onsi/gomega/RELEASING.md | 10 +- .../github.com/onsi/gomega/format/format.go | 40 +- vendor/github.com/onsi/gomega/go.mod | 17 + vendor/github.com/onsi/gomega/go.sum | 26 + vendor/github.com/onsi/gomega/gomega_dsl.go | 342 +- .../gomega/internal/assertion/assertion.go | 29 +- .../asyncassertion/async_assertion.go | 25 +- .../testingtsupport/testing_t_support.go | 44 +- vendor/github.com/onsi/gomega/matchers.go | 36 +- .../matchers/assignable_to_type_of_matcher.go | 8 +- .../onsi/gomega/matchers/be_a_directory.go | 2 + .../onsi/gomega/matchers/be_a_regular_file.go | 2 + .../gomega/matchers/be_an_existing_file.go | 2 + .../onsi/gomega/matchers/be_closed_matcher.go | 6 +- .../gomega/matchers/be_element_of_matcher.go | 57 + .../onsi/gomega/matchers/be_empty_matcher.go | 2 + .../matchers/be_equivalent_to_matcher.go | 2 + .../onsi/gomega/matchers/be_false_matcher.go | 2 + .../onsi/gomega/matchers/be_identical_to.go | 2 + .../onsi/gomega/matchers/be_nil_matcher.go | 2 + .../gomega/matchers/be_numerically_matcher.go | 18 +- .../onsi/gomega/matchers/be_sent_matcher.go | 6 +- .../gomega/matchers/be_temporally_matcher.go | 2 + .../onsi/gomega/matchers/be_true_matcher.go | 2 + .../onsi/gomega/matchers/consist_of.go | 93 +- .../matchers/contain_element_matcher.go | 22 +- .../matchers/contain_elements_matcher.go | 44 + .../matchers/contain_substring_matcher.go | 2 + .../onsi/gomega/matchers/have_cap_matcher.go | 2 + .../onsi/gomega/matchers/have_key_matcher.go | 2 + .../matchers/have_key_with_value_matcher.go | 2 + .../gomega/matchers/have_occurred_matcher.go | 4 +- .../gomega/matchers/match_error_matcher.go | 18 +- .../gomega/matchers/match_json_matcher.go | 70 - .../onsi/gomega/matchers/match_xml_matcher.go | 4 +- .../gomega/matchers/match_yaml_matcher.go | 16 +- .../onsi/gomega/matchers/receive_matcher.go | 24 +- .../matchers/semi_structured_data_support.go | 94 + .../goraph/bipartitegraph/bipartitegraph.go | 29 +- .../bipartitegraph/bipartitegraphmatching.go | 37 +- .../matchers/support/goraph/edge/edge.go | 8 +- .../matchers/support/goraph/node/node.go | 3 +- .../onsi/gomega/matchers/type_support.go | 9 + vendor/github.com/onsi/gomega/types/types.go | 9 + .../opencontainers/go-digest/.mailmap | 1 + .../opencontainers/go-digest/.pullapprove.yml | 12 + .../opencontainers/go-digest/.travis.yml | 4 + .../opencontainers/go-digest/README.md | 16 +- .../opencontainers/go-digest/algorithm.go | 54 +- .../opencontainers/go-digest/digest.go | 56 +- .../opencontainers/go-digest/digester.go | 14 + .../opencontainers/go-digest/doc.go | 14 + .../opencontainers/go-digest/verifiers.go | 14 + .../image-spec/specs-go/version.go | 4 +- .../github.com/packethost/packngo/.drone.yml | 28 + .../github.com/packethost/packngo/.gitignore | 28 + .../packethost/packngo/CHANGELOG.md | 0 .../packethost/packngo/LICENSE.txt | 0 .../packethost/packngo/README.md | 0 .../packethost/packngo/billing_address.go | 0 .../packethost/packngo/devices.go | 0 .../packethost/packngo/email.go | 0 .../packethost/packngo/facilities.go | 0 .../github.com => }/packethost/packngo/ip.go | 0 .../packethost/packngo/operatingsystems.go | 0 .../packethost/packngo/organizations.go | 0 .../packethost/packngo/packngo.go | 0 .../packethost/packngo/payment_methods.go | 0 .../packethost/packngo/plans.go | 0 .../packethost/packngo/ports.go | 0 .../packethost/packngo/projects.go | 0 .../packethost/packngo/rate.go | 0 .../packethost/packngo/spotmarket.go | 0 .../packethost/packngo/sshkeys.go | 0 .../packethost/packngo/timestamp.go | 0 .../packethost/packngo/user.go | 0 .../packethost/packngo/utils.go | 0 .../packethost/packngo/virtualnetworks.go | 0 .../packethost/packngo/volumes.go | 0 vendor/github.com/pierrec/lz4/.gitignore | 34 + vendor/github.com/pierrec/lz4/.travis.yml | 25 + vendor/github.com/pierrec/lz4/README.md | 25 +- vendor/github.com/pierrec/lz4/block.go | 116 +- vendor/github.com/pierrec/lz4/decode_other.go | 10 +- vendor/github.com/pierrec/lz4/errors.go | 15 +- vendor/github.com/pierrec/lz4/lz4.go | 67 +- vendor/github.com/pierrec/lz4/reader.go | 32 +- vendor/github.com/pierrec/lz4/writer.go | 189 +- vendor/github.com/pkg/errors/.gitignore | 24 + vendor/github.com/pkg/errors/.travis.yml | 10 + vendor/github.com/posener/complete/.gitignore | 4 + .../github.com/posener/complete/.travis.yml | 16 + vendor/github.com/posener/complete/args.go | 52 +- vendor/github.com/posener/complete/cmd/cmd.go | 2 +- .../posener/complete/cmd/install/fish.go | 56 + .../posener/complete/cmd/install/install.go | 35 +- .../posener/complete/cmd/install/utils.go | 24 +- vendor/github.com/posener/complete/command.go | 17 +- .../github.com/posener/complete/complete.go | 53 +- vendor/github.com/posener/complete/go.mod | 3 + vendor/github.com/posener/complete/go.sum | 4 + vendor/github.com/posener/complete/log.go | 3 +- .../posener/complete/metalinter.json | 21 - .../posener/complete/predict_set.go | 11 +- vendor/github.com/posener/complete/readme.md | 6 +- vendor/github.com/posener/complete/test.sh | 0 .../client_golang/prometheus/.gitignore | 1 + .../client_golang/prometheus/counter.go | 46 +- .../client_golang/prometheus/desc.go | 21 +- .../client_golang/prometheus/doc.go | 1 - .../client_golang/prometheus/gauge.go | 11 +- .../client_golang/prometheus/go_collector.go | 2 +- .../client_golang/prometheus/histogram.go | 114 +- .../client_golang/prometheus/http.go | 505 - .../client_golang/prometheus/metric.go | 3 +- .../client_golang/prometheus/observer.go | 12 + .../prometheus/process_collector.go | 61 +- .../prometheus/process_collector_other.go | 65 + .../prometheus/process_collector_windows.go | 112 + .../prometheus/promhttp/delegator.go | 9 + .../client_golang/prometheus/promhttp/http.go | 63 +- .../prometheus/push/deprecated.go | 172 - .../client_golang/prometheus/push/push.go | 99 +- .../client_golang/prometheus/registry.go | 46 +- .../client_golang/prometheus/summary.go | 26 +- .../client_golang/prometheus/value.go | 47 +- .../client_golang/prometheus/vec.go | 2 +- .../client_golang/prometheus/wrap.go | 21 + .../prometheus/client_model/go/metrics.pb.go | 477 +- .../prometheus/common/expfmt/decode.go | 4 +- .../prometheus/common/expfmt/encode.go | 124 +- .../prometheus/common/expfmt/expfmt.go | 13 +- .../common/expfmt/openmetrics_create.go | 527 + .../prometheus/common/expfmt/text_create.go | 354 +- .../prometheus/common/expfmt/text_parse.go | 19 +- .../bitbucket.org/ww/goautoneg/autoneg.go | 6 +- .../prometheus/common/model/metric.go | 1 - .../prometheus/common/model/silence.go | 4 +- .../prometheus/common/model/time.go | 13 +- .../prometheus/common/model/value.go | 4 +- .../github.com/prometheus/procfs/.gitignore | 1 + .../prometheus/procfs/.golangci.yml | 4 + .../prometheus/procfs/CONTRIBUTING.md | 109 +- .../prometheus/procfs/Makefile.common | 7 +- vendor/github.com/prometheus/procfs/README.md | 16 +- vendor/github.com/prometheus/procfs/arp.go | 85 + .../github.com/prometheus/procfs/buddyinfo.go | 2 +- .../github.com/prometheus/procfs/cpuinfo.go | 167 + vendor/github.com/prometheus/procfs/crypto.go | 131 + .../prometheus/procfs/fixtures.ttar | 4844 +- vendor/github.com/prometheus/procfs/go.mod | 7 +- vendor/github.com/prometheus/procfs/go.sum | 6 +- .../prometheus/procfs/internal/fs/fs.go | 3 + .../prometheus/procfs/internal/util/parse.go | 88 + .../procfs/internal/util/readfile.go | 38 + .../procfs/internal/util/sysreadfile.go | 48 + .../internal/util/sysreadfile_compat.go | 26 + .../procfs/internal/util/valueparser.go | 91 + vendor/github.com/prometheus/procfs/ipvs.go | 12 +- vendor/github.com/prometheus/procfs/mdstat.go | 111 +- .../github.com/prometheus/procfs/meminfo.go | 277 + .../github.com/prometheus/procfs/mountinfo.go | 180 + .../github.com/prometheus/procfs/net_dev.go | 1 - .../prometheus/procfs/net_sockstat.go | 163 + .../prometheus/procfs/net_softnet.go | 91 + .../github.com/prometheus/procfs/net_unix.go | 4 - vendor/github.com/prometheus/procfs/proc.go | 59 +- .../prometheus/procfs/proc_environ.go | 37 + .../prometheus/procfs/proc_fdinfo.go | 125 + .../github.com/prometheus/procfs/proc_io.go | 12 +- .../github.com/prometheus/procfs/proc_psi.go | 21 +- .../github.com/prometheus/procfs/proc_stat.go | 12 +- .../prometheus/procfs/proc_status.go | 19 +- .../github.com/prometheus/procfs/schedstat.go | 118 + vendor/github.com/prometheus/procfs/stat.go | 12 +- vendor/github.com/prometheus/procfs/ttar | 0 vendor/github.com/prometheus/procfs/vm.go | 210 + .../github.com/prometheus/procfs/zoneinfo.go | 196 + vendor/github.com/renier/xmlrpc/.gitignore | 2 + .../github.com => }/renier/xmlrpc/LICENSE | 0 .../github.com => }/renier/xmlrpc/README.md | 0 .../github.com => }/renier/xmlrpc/client.go | 0 .../github.com => }/renier/xmlrpc/decoder.go | 0 .../github.com => }/renier/xmlrpc/encoder.go | 0 .../github.com => }/renier/xmlrpc/request.go | 0 .../github.com => }/renier/xmlrpc/response.go | 0 .../renier/xmlrpc/test_server.rb | 0 .../github.com => }/renier/xmlrpc/xmlrpc.go | 0 vendor/github.com/rs/cors/.travis.yml | 7 + .../github.com/ryanuber/columnize/.travis.yml | 3 + .../github.com/ryanuber/go-glob/.travis.yml | 5 + vendor/github.com/ryanuber/go-glob/go.mod | 1 + vendor/github.com/sean-/seed/.gitignore | 24 + .../seccomp/libseccomp-golang/.gitignore | 4 + .../seccomp/libseccomp-golang/.travis.yml | 33 + .../gopsutil/host/freebsd_headers/utxdb.h | 63 - vendor/github.com/sirupsen/logrus/.gitignore | 2 + .../github.com/sirupsen/logrus/.golangci.yml | 40 + vendor/github.com/sirupsen/logrus/.travis.yml | 17 + .../github.com/sirupsen/logrus/CHANGELOG.md | 27 +- vendor/github.com/sirupsen/logrus/README.md | 42 +- .../github.com/sirupsen/logrus/appveyor.yml | 28 +- vendor/github.com/sirupsen/logrus/entry.go | 47 +- vendor/github.com/sirupsen/logrus/exported.go | 2 +- vendor/github.com/sirupsen/logrus/go.mod | 5 +- vendor/github.com/sirupsen/logrus/go.sum | 8 +- .../sirupsen/logrus/json_formatter.go | 4 + vendor/github.com/sirupsen/logrus/logger.go | 11 +- vendor/github.com/sirupsen/logrus/logrus.go | 2 +- .../sirupsen/logrus/terminal_check_bsd.go | 2 +- .../sirupsen/logrus/terminal_check_js.go | 7 + .../sirupsen/logrus/terminal_check_unix.go | 2 +- .../sirupsen/logrus/text_formatter.go | 55 +- vendor/github.com/sirupsen/logrus/writer.go | 6 + .../softlayer-go}/LICENSE | 0 .../softlayer/softlayer-go/config/config.go | 0 .../softlayer/softlayer-go/datatypes/abuse.go | 0 .../softlayer-go/datatypes/account.go | 2986 + .../softlayer-go/datatypes/auxiliary.go | 0 .../softlayer-go/datatypes/billing.go | 2674 + .../softlayer/softlayer-go/datatypes/brand.go | 262 + .../softlayer-go/datatypes/business.go | 43 + .../softlayer-go/datatypes/catalyst.go | 0 .../softlayer-go/datatypes/compliance.go | 0 .../softlayer-go/datatypes/configuration.go | 6 + .../softlayer-go/datatypes/container.go | 1230 +- .../softlayer/softlayer-go/datatypes/dns.go | 0 .../softlayer/softlayer-go/datatypes/email.go | 63 + .../softlayer-go/datatypes/entity.go | 0 .../softlayer/softlayer-go/datatypes/event.go | 0 .../softlayer-go/datatypes/flexiblecredit.go | 0 .../softlayer-go/datatypes/hardware.go | 1938 + .../softlayer-go/datatypes/layout.go | 0 .../softlayer/softlayer-go/datatypes/legal.go | 0 .../softlayer-go/datatypes/locale.go | 101 + .../softlayer-go/datatypes/location.go | 443 + .../softlayer-go/datatypes/marketplace.go | 0 .../softlayer-go/datatypes/mcafee.go | 0 .../softlayer-go/datatypes/metric.go | 0 .../softlayer-go/datatypes/monitoring.go | 0 .../softlayer-go/datatypes/network.go | 6136 + .../softlayer-go/datatypes/notification.go | 28 + .../softlayer-go/datatypes/policy.go | 29 + .../softlayer-go/datatypes/product.go | 1895 + .../softlayer-go/datatypes/provisioning.go | 0 .../softlayer-go/datatypes/resource.go | 0 .../softlayer/softlayer-go/datatypes/sales.go | 0 .../softlayer/softlayer-go/datatypes/scale.go | 0 .../softlayer-go/datatypes/search.go | 0 .../softlayer-go/datatypes/security.go | 11 + .../softlayer-go/datatypes/service.go | 0 .../softlayer-go/datatypes/softlayer.go | 0 .../softlayer-go/datatypes/software.go | 0 .../softlayer-go/datatypes/survey.go | 0 .../softlayer/softlayer-go/datatypes/tag.go | 8 + .../softlayer-go/datatypes/ticket.go | 733 + .../softlayer/softlayer-go/datatypes/user.go | 1450 + .../softlayer-go/datatypes/utility.go | 0 .../softlayer-go/datatypes/virtual.go | 1379 + .../softlayer/softlayer-go/filter/filters.go | 0 .../softlayer-go/services/account.go | 5459 + .../softlayer-go/services/auxiliary.go | 0 .../softlayer-go/services/billing.go | 2794 + .../softlayer/softlayer-go/services/brand.go | 375 + .../softlayer-go/services/business.go | 122 + .../softlayer-go/services/catalyst.go | 0 .../softlayer-go/services/compliance.go | 0 .../softlayer-go/services/configuration.go | 0 .../softlayer/softlayer-go/services/dns.go | 0 .../softlayer/softlayer-go/services/email.go | 158 + .../softlayer/softlayer-go/services/event.go | 0 .../softlayer-go/services/flexiblecredit.go | 0 .../softlayer-go/services/hardware.go | 10188 ++ .../softlayer/softlayer-go/services/layout.go | 0 .../softlayer/softlayer-go/services/locale.go | 225 + .../softlayer-go/services/location.go | 884 + .../softlayer-go/services/marketplace.go | 0 .../softlayer/softlayer-go/services/metric.go | 0 .../softlayer-go/services/monitoring.go | 0 .../softlayer-go/services/network.go | 15408 ++ .../softlayer-go/services/notification.go | 0 .../softlayer-go/services/product.go | 2077 + .../softlayer-go/services/provisioning.go | 0 .../softlayer-go/services/resource.go | 0 .../softlayer/softlayer-go/services/sales.go | 0 .../softlayer/softlayer-go/services/scale.go | 30 +- .../softlayer/softlayer-go/services/search.go | 0 .../softlayer-go/services/security.go | 0 .../softlayer-go/services/software.go | 0 .../softlayer/softlayer-go/services/survey.go | 0 .../softlayer/softlayer-go/services/tag.go | 0 .../softlayer/softlayer-go/services/ticket.go | 982 + .../softlayer/softlayer-go/services/user.go | 4388 + .../softlayer-go/services/utility.go | 0 .../softlayer-go/services/virtual.go | 3167 + .../softlayer/softlayer-go/session/rest.go | 314 + .../softlayer/softlayer-go/session/session.go | 359 + .../softlayer/softlayer-go/session/xmlrpc.go | 253 + .../softlayer/softlayer-go/sl/errors.go | 0 .../softlayer/softlayer-go/sl/helpers.go | 0 .../softlayer/softlayer-go/sl/options.go | 0 .../softlayer/softlayer-go/sl/version.go | 0 vendor/github.com/spf13/pflag/LICENSE | 28 - vendor/github.com/spf13/pflag/README.md | 296 - vendor/github.com/spf13/pflag/bool.go | 94 - vendor/github.com/spf13/pflag/bool_slice.go | 147 - vendor/github.com/spf13/pflag/count.go | 96 - vendor/github.com/spf13/pflag/duration.go | 86 - vendor/github.com/spf13/pflag/flag.go | 1132 - vendor/github.com/spf13/pflag/float32.go | 88 - vendor/github.com/spf13/pflag/float64.go | 84 - vendor/github.com/spf13/pflag/golangflag.go | 101 - vendor/github.com/spf13/pflag/int.go | 84 - vendor/github.com/spf13/pflag/int32.go | 88 - vendor/github.com/spf13/pflag/int64.go | 84 - vendor/github.com/spf13/pflag/int8.go | 88 - vendor/github.com/spf13/pflag/int_slice.go | 128 - vendor/github.com/spf13/pflag/ip.go | 94 - vendor/github.com/spf13/pflag/ip_slice.go | 148 - vendor/github.com/spf13/pflag/ipmask.go | 122 - vendor/github.com/spf13/pflag/ipnet.go | 98 - vendor/github.com/spf13/pflag/string.go | 80 - vendor/github.com/spf13/pflag/string_array.go | 103 - vendor/github.com/spf13/pflag/string_slice.go | 129 - vendor/github.com/spf13/pflag/uint.go | 88 - vendor/github.com/spf13/pflag/uint16.go | 88 - vendor/github.com/spf13/pflag/uint32.go | 88 - vendor/github.com/spf13/pflag/uint64.go | 88 - vendor/github.com/spf13/pflag/uint8.go | 88 - vendor/github.com/spf13/pflag/uint_slice.go | 126 - .../github.com/stretchr/objx/.codeclimate.yml | 21 + vendor/github.com/stretchr/objx/.gitignore | 11 + vendor/github.com/stretchr/objx/.travis.yml | 30 + vendor/github.com/stretchr/objx/LICENSE | 22 + vendor/github.com/stretchr/objx/LICENSE.md | 23 - vendor/github.com/stretchr/objx/README.md | 81 +- vendor/github.com/stretchr/objx/Taskfile.yml | 30 + vendor/github.com/stretchr/objx/accessors.go | 184 +- vendor/github.com/stretchr/objx/constants.go | 13 - .../github.com/stretchr/objx/conversions.go | 191 +- vendor/github.com/stretchr/objx/doc.go | 136 +- vendor/github.com/stretchr/objx/go.mod | 8 + vendor/github.com/stretchr/objx/go.sum | 8 + vendor/github.com/stretchr/objx/map.go | 94 +- vendor/github.com/stretchr/objx/mutations.go | 42 +- vendor/github.com/stretchr/objx/security.go | 8 +- .../github.com/stretchr/objx/type_specific.go | 346 + .../stretchr/objx/type_specific_codegen.go | 738 +- vendor/github.com/stretchr/objx/value.go | 109 +- .../tencentcloud/tencentcloud-sdk-go/LICENSE | 0 .../tencentcloud/common/client.go | 0 .../tencentcloud/common/credentials.go | 0 .../tencentcloud/common/errors/errors.go | 0 .../tencentcloud/common/http/request.go | 233 + .../tencentcloud/common/http/response.go | 0 .../common/profile/client_profile.go | 0 .../common/profile/http_profile.go | 0 .../tencentcloud/common/sign.go | 0 .../tencentcloud/common/types.go | 0 .../tencentcloud/cvm/v20170312/client.go | 0 .../tencentcloud/cvm/v20170312/models.go | 0 vendor/github.com/tv42/httpunix/.gitignore | 1 + vendor/github.com/ulikunitz/xz/.gitignore | 25 + vendor/github.com/ulikunitz/xz/README.md | 72 +- .../github.com/ulikunitz/xz/lzma/encoder.go | 2 +- vendor/github.com/ulikunitz/xz/make-docs | 0 .../github.com/vishvananda/netlink/.gitignore | 1 + .../vishvananda/netlink/.travis.yml | 19 + .../vmihailenco/msgpack/.travis.yml | 16 + .../vmihailenco/msgpack/appengine.go | 64 + vendor/github.com/vmware/govmomi/.gitignore | 2 + .../github.com/vmware/govmomi/.goreleaser.yml | 57 + vendor/github.com/vmware/govmomi/.mailmap | 20 + vendor/github.com/vmware/govmomi/.travis.yml | 30 + .../vmware/govmomi/CHANGELOG.md | 0 .../vmware/govmomi/CONTRIBUTING.md | 0 .../vmware/govmomi/CONTRIBUTORS | 0 .../github.com => }/vmware/govmomi/Dockerfile | 0 .../github.com => }/vmware/govmomi/Gopkg.lock | 0 .../github.com => }/vmware/govmomi/Gopkg.toml | 0 .../aws-sdk-go => vmware/govmomi}/LICENSE.txt | 0 .../github.com => }/vmware/govmomi/Makefile | 0 .../github.com => }/vmware/govmomi/README.md | 0 .../github.com => }/vmware/govmomi/client.go | 0 .../vmware/govmomi/find/doc.go | 0 .../vmware/govmomi/find/error.go | 0 .../vmware/govmomi/find/finder.go | 0 .../vmware/govmomi/find/recurser.go | 0 .../vmware/govmomi/list/lister.go | 0 .../vmware/govmomi/list/path.go | 0 .../vmware/govmomi/nfc/lease.go | 0 .../vmware/govmomi/nfc/lease_updater.go | 0 .../govmomi/object/authorization_manager.go | 0 .../object/authorization_manager_internal.go | 0 .../object/cluster_compute_resource.go | 0 .../vmware/govmomi/object/common.go | 0 .../vmware/govmomi/object/compute_resource.go | 0 .../govmomi/object/custom_fields_manager.go | 0 .../object/customization_spec_manager.go | 0 .../vmware/govmomi/object/datacenter.go | 0 .../vmware/govmomi/object/datastore.go | 0 .../vmware/govmomi/object/datastore_file.go | 0 .../govmomi/object/datastore_file_manager.go | 0 .../vmware/govmomi/object/datastore_path.go | 0 .../vmware/govmomi/object/diagnostic_log.go | 0 .../govmomi/object/diagnostic_manager.go | 0 .../object/distributed_virtual_portgroup.go | 0 .../object/distributed_virtual_switch.go | 0 .../govmomi/object/extension_manager.go | 0 .../vmware/govmomi/object/file_manager.go | 0 .../vmware/govmomi/object/folder.go | 0 .../govmomi/object/history_collector.go | 0 .../govmomi/object/host_account_manager.go | 0 .../govmomi/object/host_certificate_info.go | 0 .../object/host_certificate_manager.go | 0 .../govmomi/object/host_config_manager.go | 0 .../govmomi/object/host_datastore_browser.go | 0 .../govmomi/object/host_datastore_system.go | 0 .../govmomi/object/host_date_time_system.go | 0 .../govmomi/object/host_firewall_system.go | 0 .../govmomi/object/host_network_system.go | 0 .../govmomi/object/host_service_system.go | 0 .../govmomi/object/host_storage_system.go | 0 .../vmware/govmomi/object/host_system.go | 0 .../object/host_virtual_nic_manager.go | 0 .../object/host_vsan_internal_system.go | 0 .../vmware/govmomi/object/host_vsan_system.go | 0 .../govmomi/object/namespace_manager.go | 0 .../vmware/govmomi/object/network.go | 0 .../govmomi/object/network_reference.go | 0 .../vmware/govmomi/object/opaque_network.go | 0 .../vmware/govmomi/object/option_manager.go | 0 .../vmware/govmomi/object/resource_pool.go | 0 .../vmware/govmomi/object/search_index.go | 0 .../vmware/govmomi/object/storage_pod.go | 0 .../object/storage_resource_manager.go | 0 .../vmware/govmomi/object/task.go | 0 .../vmware/govmomi/object/types.go | 0 .../vmware/govmomi/object/virtual_app.go | 0 .../govmomi/object/virtual_device_list.go | 0 .../govmomi/object/virtual_disk_manager.go | 0 .../object/virtual_disk_manager_internal.go | 0 .../vmware/govmomi/object/virtual_machine.go | 0 .../vmware_distributed_virtual_switch.go | 0 .../vmware/govmomi/property/collector.go | 0 .../vmware/govmomi/property/filter.go | 0 .../vmware/govmomi/property/wait.go | 0 .../vmware/govmomi/session/keep_alive.go | 0 .../vmware/govmomi/session/manager.go | 0 .../vmware/govmomi/task/error.go | 0 .../vmware/govmomi/task/wait.go | 0 .../vmware/govmomi/vim25/client.go | 0 .../vmware/govmomi/vim25/debug/debug.go | 0 .../vmware/govmomi/vim25/doc.go | 0 .../vmware/govmomi/vim25/methods/methods.go | 0 .../govmomi/vim25/methods/service_content.go | 0 .../vmware/govmomi/vim25/mo/ancestors.go | 0 .../vmware/govmomi/vim25/mo/entity.go | 0 .../vmware/govmomi/vim25/mo/extra.go | 0 .../vmware/govmomi/vim25/mo/mo.go | 0 .../vmware/govmomi/vim25/mo/reference.go | 0 .../vmware/govmomi/vim25/mo/registry.go | 0 .../vmware/govmomi/vim25/mo/retrieve.go | 0 .../vmware/govmomi/vim25/mo/type_info.go | 0 .../govmomi/vim25/progress/aggregator.go | 0 .../vmware/govmomi/vim25/progress/doc.go | 0 .../vmware/govmomi/vim25/progress/prefix.go | 0 .../vmware/govmomi/vim25/progress/reader.go | 0 .../vmware/govmomi/vim25/progress/report.go | 0 .../vmware/govmomi/vim25/progress/scale.go | 0 .../vmware/govmomi/vim25/progress/sinker.go | 0 .../vmware/govmomi/vim25/progress/tee.go | 0 .../vmware/govmomi/vim25/retry.go | 0 .../vmware/govmomi/vim25/soap/client.go | 0 .../vmware/govmomi/vim25/soap/debug.go | 0 .../vmware/govmomi/vim25/soap/error.go | 0 .../vmware/govmomi/vim25/soap/soap.go | 0 .../vmware/govmomi/vim25/types/base.go | 0 .../vmware/govmomi/vim25/types/enum.go | 0 .../vmware/govmomi/vim25/types/fault.go | 0 .../vmware/govmomi/vim25/types/helpers.go | 0 .../vmware/govmomi/vim25/types/if.go | 0 .../vmware/govmomi/vim25/types/registry.go | 0 .../vmware/govmomi/vim25/types/types.go | 0 .../vmware/govmomi/vim25/xml/LICENSE | 0 .../vmware/govmomi/vim25/xml/extras.go | 0 .../vmware/govmomi/vim25/xml/marshal.go | 0 .../vmware/govmomi/vim25/xml/read.go | 0 .../vmware/govmomi/vim25/xml/typeinfo.go | 0 .../vmware/govmomi/vim25/xml/xml.go | 0 vendor/go.opencensus.io/.gitignore | 9 + vendor/go.opencensus.io/.travis.yml | 17 + .../go.opencensus.io/plugin/ocgrpc/client.go | 56 + .../plugin/ocgrpc/client_metrics.go | 107 + .../plugin/ocgrpc/client_stats_handler.go | 49 + vendor/go.opencensus.io/plugin/ocgrpc/doc.go | 19 + .../go.opencensus.io/plugin/ocgrpc/server.go | 80 + .../plugin/ocgrpc/server_metrics.go | 97 + .../plugin/ocgrpc/server_stats_handler.go | 63 + .../plugin/ocgrpc/stats_common.go | 227 + .../plugin/ocgrpc/trace_common.go | 107 + .../propagation/tracecontext/propagation.go | 187 + vendor/go4.org/LICENSE | 202 - vendor/go4.org/errorutil/highlight.go | 58 - vendor/golang.org/x/crypto/AUTHORS | 3 + vendor/golang.org/x/crypto/CONTRIBUTORS | 3 + vendor/golang.org/x/crypto/blowfish/block.go | 159 + vendor/golang.org/x/crypto/blowfish/cipher.go | 99 + vendor/golang.org/x/crypto/blowfish/const.go | 199 + .../x/crypto/chacha20/chacha_arm64.go | 16 + .../x/crypto/chacha20/chacha_arm64.s | 307 + .../x/crypto/chacha20/chacha_generic.go | 398 + .../x/crypto/chacha20/chacha_noasm.go | 13 + .../x/crypto/chacha20/chacha_ppc64le.go | 16 + .../x/crypto/chacha20/chacha_ppc64le.s | 449 + .../x/crypto/chacha20/chacha_s390x.go | 26 + .../x/crypto/chacha20/chacha_s390x.s | 224 + vendor/golang.org/x/crypto/chacha20/xor.go | 42 + .../x/crypto/curve25519/curve25519.go | 95 + .../x/crypto/curve25519/curve25519_amd64.go | 240 + .../x/crypto/curve25519/curve25519_amd64.s | 1793 + .../x/crypto/curve25519/curve25519_generic.go | 828 + .../x/crypto/curve25519/curve25519_noasm.go | 11 + .../x/crypto/internal/subtle/aliasing.go | 32 + .../internal/subtle/aliasing_appengine.go | 35 + .../golang.org/x/crypto/pkcs12/bmp-string.go | 0 .../golang.org/x/crypto/pkcs12/crypto.go | 0 .../golang.org/x/crypto/pkcs12/errors.go | 0 .../x/crypto/pkcs12/internal/rc2/rc2.go | 0 .../golang.org/x/crypto/pkcs12/mac.go | 0 .../golang.org/x/crypto/pkcs12/pbkdf.go | 0 .../golang.org/x/crypto/pkcs12/pkcs12.go | 0 .../golang.org/x/crypto/pkcs12/safebags.go | 0 .../x/crypto/poly1305/bits_compat.go | 39 + .../x/crypto/poly1305/bits_go1.13.go | 21 + .../golang.org/x/crypto/poly1305/mac_noasm.go | 9 + .../golang.org/x/crypto/poly1305/poly1305.go | 99 + .../golang.org/x/crypto/poly1305/sum_amd64.go | 47 + .../golang.org/x/crypto/poly1305/sum_amd64.s | 108 + .../x/crypto/poly1305/sum_generic.go | 310 + .../x/crypto/poly1305/sum_ppc64le.go | 47 + .../x/crypto/poly1305/sum_ppc64le.s | 181 + .../golang.org/x/crypto/poly1305/sum_s390x.go | 75 + .../golang.org/x/crypto/poly1305/sum_s390x.s | 503 + .../golang.org/x/crypto/ssh/agent/client.go | 813 + .../golang.org/x/crypto/ssh/agent/forward.go | 0 .../golang.org/x/crypto/ssh/agent/keyring.go | 30 +- .../golang.org/x/crypto/ssh/agent/server.go | 570 + .../golang.org/x/crypto/ssh/buffer.go | 0 .../golang.org/x/crypto/ssh/certs.go | 55 +- .../golang.org/x/crypto/ssh/channel.go | 0 vendor/golang.org/x/crypto/ssh/cipher.go | 781 + vendor/golang.org/x/crypto/ssh/client.go | 278 + .../golang.org/x/crypto/ssh/client_auth.go | 114 + vendor/golang.org/x/crypto/ssh/common.go | 404 + .../golang.org/x/crypto/ssh/connection.go | 0 .../golang.org/x/crypto/ssh/doc.go | 0 .../golang.org/x/crypto/ssh/handshake.go | 5 +- .../ssh/internal/bcrypt_pbkdf/bcrypt_pbkdf.go | 93 + vendor/golang.org/x/crypto/ssh/kex.go | 789 + vendor/golang.org/x/crypto/ssh/keys.go | 1474 + .../golang.org/x/crypto/ssh/mac.go | 0 .../golang.org/x/crypto/ssh/messages.go | 100 + .../golang.org/x/crypto/ssh/mux.go | 0 vendor/golang.org/x/crypto/ssh/server.go | 716 + .../golang.org/x/crypto/ssh/session.go | 0 vendor/golang.org/x/crypto/ssh/ssh_gss.go | 139 + .../golang.org/x/crypto/ssh/streamlocal.go | 1 + .../golang.org/x/crypto/ssh/tcpip.go | 9 + .../x/crypto/ssh/terminal/terminal.go | 8 + vendor/golang.org/x/crypto/ssh/transport.go | 353 + .../x/oauth2 => golang.org/x/exp}/AUTHORS | 0 .../oauth2 => golang.org/x/exp}/CONTRIBUTORS | 0 .../x/crypto => golang.org/x/exp}/LICENSE | 0 .../x/crypto => golang.org/x/exp}/PATENTS | 0 vendor/golang.org/x/exp/apidiff/README.md | 624 + vendor/golang.org/x/exp/apidiff/apidiff.go | 220 + .../golang.org/x/exp/apidiff/compatibility.go | 361 + .../x/exp/apidiff/correspondence.go | 219 + vendor/golang.org/x/exp/apidiff/messageset.go | 79 + vendor/golang.org/x/exp/apidiff/report.go | 71 + vendor/golang.org/x/exp/cmd/apidiff/main.go | 142 + vendor/golang.org/x/lint/.travis.yml | 19 + vendor/golang.org/x/lint/CONTRIBUTING.md | 15 + vendor/golang.org/x/lint/LICENSE | 27 + vendor/golang.org/x/lint/README.md | 88 + vendor/golang.org/x/lint/go.mod | 5 + vendor/golang.org/x/lint/go.sum | 8 + vendor/golang.org/x/lint/golint/golint.go | 159 + vendor/golang.org/x/lint/golint/import.go | 309 + .../golang.org/x/lint/golint/importcomment.go | 13 + vendor/golang.org/x/lint/lint.go | 1614 + .../x/net => golang.org/x/mod}/LICENSE | 0 .../x/net => golang.org/x/mod}/PATENTS | 0 vendor/golang.org/x/mod/module/module.go | 718 + vendor/golang.org/x/mod/semver/semver.go | 388 + .../x/oauth2 => golang.org/x/net}/AUTHORS | 0 .../oauth2 => golang.org/x/net}/CONTRIBUTORS | 0 .../vendor => }/golang.org/x/net/bpf/asm.go | 0 .../golang.org/x/net/bpf/constants.go | 0 .../vendor => }/golang.org/x/net/bpf/doc.go | 0 .../golang.org/x/net/bpf/instructions.go | 0 .../golang.org/x/net/bpf/setter.go | 0 .../vendor => }/golang.org/x/net/bpf/vm.go | 0 .../golang.org/x/net/bpf/vm_instructions.go | 3 +- vendor/golang.org/x/net/http2/.gitignore | 2 + .../golang.org/x/net/internal/iana/const.go | 0 .../x/net/internal/socket/cmsghdr.go | 2 +- .../x/net/internal/socket/cmsghdr_bsd.go | 2 +- .../internal/socket/cmsghdr_linux_32bit.go | 0 .../internal/socket/cmsghdr_linux_64bit.go | 2 +- .../internal/socket/cmsghdr_solaris_64bit.go | 0 .../x/net/internal/socket/cmsghdr_stub.go | 2 +- .../golang.org/x/net/internal/socket/empty.s | 7 + .../x/net/internal/socket/error_unix.go | 2 +- .../x/net/internal/socket/error_windows.go | 0 .../x/net/internal/socket/iovec_32bit.go | 0 .../x/net/internal/socket/iovec_64bit.go | 19 + .../internal/socket/iovec_solaris_64bit.go | 0 .../x/net/internal/socket/iovec_stub.go | 2 +- .../x/net/internal/socket/mmsghdr_stub.go | 2 +- .../x/net/internal/socket/mmsghdr_unix.go | 2 +- .../x/net/internal/socket/msghdr_bsd.go | 2 +- .../x/net/internal/socket/msghdr_bsdvar.go | 2 +- .../x/net/internal/socket/msghdr_linux.go | 0 .../net/internal/socket/msghdr_linux_32bit.go | 0 .../net/internal/socket/msghdr_linux_64bit.go | 2 +- .../x/net/internal/socket/msghdr_openbsd.go | 0 .../internal/socket/msghdr_solaris_64bit.go | 0 .../x/net/internal/socket/msghdr_stub.go | 2 +- .../x/net/internal/socket/norace.go | 12 + .../golang.org/x/net/internal/socket/race.go | 37 + .../x/net/internal/socket/rawconn.go | 2 - .../x/net/internal/socket/rawconn_mmsg.go | 7 +- .../x/net/internal/socket/rawconn_msg.go | 5 +- .../x/net/internal/socket/rawconn_nommsg.go | 15 + .../x/net/internal/socket/rawconn_nomsg.go | 15 + .../x/net/internal/socket/socket.go | 3 + .../golang.org/x/net/internal/socket/sys.go | 2 +- .../x/net/internal/socket/sys_bsd.go | 15 + .../x/net/internal/socket/sys_bsdvar.go | 23 + .../x/net/internal/socket/sys_const_unix.go | 17 + .../x/net/internal/socket/sys_darwin.go | 0 .../x/net/internal/socket/sys_dragonfly.go | 32 + .../net/internal/socket/sys_go1_11_darwin.go | 33 + .../x/net/internal/socket/sys_linkname.go | 42 + .../x/net/internal/socket/sys_linux.go | 0 .../x/net/internal/socket/sys_linux_386.go | 0 .../x/net/internal/socket/sys_linux_386.s | 0 .../x/net/internal/socket/sys_linux_amd64.go | 0 .../x/net/internal/socket/sys_linux_arm.go | 0 .../x/net/internal/socket/sys_linux_arm64.go | 0 .../x/net/internal/socket/sys_linux_mips.go | 0 .../x/net/internal/socket/sys_linux_mips64.go | 0 .../net/internal/socket/sys_linux_mips64le.go | 0 .../x/net/internal/socket/sys_linux_mipsle.go | 0 .../x/net/internal/socket/sys_linux_ppc64.go | 0 .../net/internal/socket/sys_linux_ppc64le.go | 0 .../net/internal/socket/sys_linux_riscv64.go | 12 + .../x/net/internal/socket/sys_linux_s390x.go | 0 .../x/net/internal/socket/sys_linux_s390x.s | 0 .../x/net/internal/socket/sys_netbsd.go | 0 .../x/net/internal/socket/sys_posix.go | 45 +- .../x/net/internal/socket/sys_solaris.go | 5 +- .../x/net/internal/socket/sys_solaris_amd64.s | 0 .../x/net/internal/socket/sys_stub.go | 63 + .../x/net/internal/socket/sys_unix.go | 2 +- .../x/net/internal/socket/sys_windows.go | 19 +- .../x/net/internal/socket/zsys_aix_ppc64.go | 60 + .../x/net/internal/socket/zsys_darwin_386.go | 10 +- .../net/internal/socket/zsys_darwin_amd64.go | 10 +- .../x/net/internal/socket/zsys_darwin_arm.go | 10 +- .../net/internal/socket/zsys_darwin_arm64.go | 10 +- .../internal/socket/zsys_dragonfly_amd64.go | 10 +- .../x/net/internal/socket/zsys_freebsd_386.go | 51 + .../net/internal/socket/zsys_freebsd_amd64.go | 53 + .../x/net/internal/socket/zsys_freebsd_arm.go | 51 + .../net/internal/socket/zsys_freebsd_arm64.go | 53 + .../x/net/internal/socket/zsys_linux_386.go | 54 + .../x/net/internal/socket/zsys_linux_amd64.go | 57 + .../x/net/internal/socket/zsys_linux_arm.go | 55 + .../x/net/internal/socket/zsys_linux_arm64.go | 58 + .../x/net/internal/socket/zsys_linux_mips.go | 55 + .../net/internal/socket/zsys_linux_mips64.go | 58 + .../internal/socket/zsys_linux_mips64le.go | 58 + .../net/internal/socket/zsys_linux_mipsle.go | 55 + .../x/net/internal/socket/zsys_linux_ppc64.go | 58 + .../net/internal/socket/zsys_linux_ppc64le.go | 58 + .../net/internal/socket/zsys_linux_riscv64.go | 59 + .../x/net/internal/socket/zsys_linux_s390x.go | 58 + .../x/net/internal/socket/zsys_netbsd_386.go | 16 +- .../net/internal/socket/zsys_netbsd_amd64.go | 16 +- .../x/net/internal/socket/zsys_netbsd_arm.go | 16 +- .../net/internal/socket/zsys_netbsd_arm64.go | 59 + .../x/net/internal/socket/zsys_openbsd_386.go | 10 +- .../net/internal/socket/zsys_openbsd_amd64.go | 10 +- .../x/net/internal/socket/zsys_openbsd_arm.go | 10 +- .../net/internal/socket/zsys_openbsd_arm64.go | 53 + .../net/internal/socket/zsys_solaris_amd64.go | 10 +- .../golang.org/x/net/internal/socks/client.go | 168 - .../golang.org/x/net/internal/socks/socks.go | 317 - vendor/golang.org/x/net/ipv4/batch.go | 194 + .../golang.org/x/net/ipv4/control.go | 0 .../golang.org/x/net/ipv4/control_bsd.go | 5 +- .../golang.org/x/net/ipv4/control_pktinfo.go | 0 vendor/golang.org/x/net/ipv4/control_stub.go | 13 + vendor/golang.org/x/net/ipv4/control_unix.go | 73 + .../golang.org/x/net/ipv4/control_windows.go | 12 + vendor/golang.org/x/net/ipv4/dgramopt.go | 264 + vendor/golang.org/x/net/ipv4/doc.go | 244 + vendor/golang.org/x/net/ipv4/endpoint.go | 186 + vendor/golang.org/x/net/ipv4/genericopt.go | 55 + .../golang.org/x/net/ipv4/header.go | 11 +- vendor/golang.org/x/net/ipv4/helper.go | 77 + .../vendor => }/golang.org/x/net/ipv4/iana.go | 0 .../vendor => }/golang.org/x/net/ipv4/icmp.go | 0 .../golang.org/x/net/ipv4/icmp_linux.go | 0 .../golang.org/x/net/ipv4/icmp_stub.go | 0 vendor/golang.org/x/net/ipv4/packet.go | 117 + .../golang.org/x/net/ipv4/payload.go | 0 vendor/golang.org/x/net/ipv4/payload_cmsg.go | 84 + .../golang.org/x/net/ipv4/payload_nocmsg.go | 39 + .../golang.org/x/net/ipv4/sockopt.go | 0 vendor/golang.org/x/net/ipv4/sockopt_posix.go | 71 + vendor/golang.org/x/net/ipv4/sockopt_stub.go | 42 + vendor/golang.org/x/net/ipv4/sys_aix.go | 38 + vendor/golang.org/x/net/ipv4/sys_asmreq.go | 122 + .../golang.org/x/net/ipv4/sys_asmreq_stub.go | 25 + .../golang.org/x/net/ipv4/sys_asmreqn.go | 0 .../golang.org/x/net/ipv4/sys_asmreqn_stub.go | 4 +- vendor/golang.org/x/net/ipv4/sys_bpf.go | 24 + vendor/golang.org/x/net/ipv4/sys_bpf_stub.go | 16 + .../golang.org/x/net/ipv4/sys_bsd.go | 0 vendor/golang.org/x/net/ipv4/sys_darwin.go | 65 + .../golang.org/x/net/ipv4/sys_dragonfly.go | 0 vendor/golang.org/x/net/ipv4/sys_freebsd.go | 76 + vendor/golang.org/x/net/ipv4/sys_linux.go | 60 + .../golang.org/x/net/ipv4/sys_solaris.go | 0 vendor/golang.org/x/net/ipv4/sys_ssmreq.go | 52 + .../golang.org/x/net/ipv4/sys_ssmreq_stub.go | 21 + vendor/golang.org/x/net/ipv4/sys_stub.go | 13 + .../golang.org/x/net/ipv4/sys_windows.go | 0 .../golang.org/x/net/ipv4/zsys_aix_ppc64.go | 33 + vendor/golang.org/x/net/ipv4/zsys_darwin.go | 99 + .../golang.org/x/net/ipv4/zsys_dragonfly.go | 31 + .../golang.org/x/net/ipv4/zsys_freebsd_386.go | 93 + .../x/net/ipv4/zsys_freebsd_amd64.go | 95 + .../golang.org/x/net/ipv4/zsys_freebsd_arm.go | 95 + .../x/net/ipv4/zsys_freebsd_arm64.go | 93 + .../golang.org/x/net/ipv4/zsys_linux_386.go | 130 + .../golang.org/x/net/ipv4/zsys_linux_amd64.go | 132 + .../golang.org/x/net/ipv4/zsys_linux_arm.go | 130 + .../golang.org/x/net/ipv4/zsys_linux_arm64.go | 132 + .../golang.org/x/net/ipv4/zsys_linux_mips.go | 130 + .../x/net/ipv4/zsys_linux_mips64.go | 132 + .../x/net/ipv4/zsys_linux_mips64le.go | 132 + .../x/net/ipv4/zsys_linux_mipsle.go | 130 + .../golang.org/x/net/ipv4/zsys_linux_ppc.go | 130 + .../golang.org/x/net/ipv4/zsys_linux_ppc64.go | 132 + .../x/net/ipv4/zsys_linux_ppc64le.go | 132 + .../x/net/ipv4/zsys_linux_riscv64.go | 134 + .../golang.org/x/net/ipv4/zsys_linux_s390x.go | 132 + vendor/golang.org/x/net/ipv4/zsys_netbsd.go | 30 + vendor/golang.org/x/net/ipv4/zsys_openbsd.go | 30 + vendor/golang.org/x/net/ipv4/zsys_solaris.go | 100 + vendor/golang.org/x/net/ipv6/batch.go | 116 + .../golang.org/x/net/ipv6/control.go | 0 .../x/net/ipv6/control_rfc2292_unix.go | 0 .../x/net/ipv6/control_rfc3542_unix.go | 2 +- vendor/golang.org/x/net/ipv6/control_stub.go | 13 + vendor/golang.org/x/net/ipv6/control_unix.go | 55 + .../golang.org/x/net/ipv6/control_windows.go | 12 + vendor/golang.org/x/net/ipv6/dgramopt.go | 301 + .../vendor => }/golang.org/x/net/ipv6/doc.go | 0 vendor/golang.org/x/net/ipv6/endpoint.go | 127 + vendor/golang.org/x/net/ipv6/genericopt.go | 56 + .../golang.org/x/net/ipv6/header.go | 0 vendor/golang.org/x/net/ipv6/helper.go | 58 + .../vendor => }/golang.org/x/net/ipv6/iana.go | 0 .../vendor => }/golang.org/x/net/ipv6/icmp.go | 0 .../golang.org/x/net/ipv6/icmp_bsd.go | 2 +- .../golang.org/x/net/ipv6/icmp_linux.go | 0 .../golang.org/x/net/ipv6/icmp_solaris.go | 0 .../golang.org/x/net/ipv6/icmp_stub.go | 2 +- .../golang.org/x/net/ipv6/icmp_windows.go | 0 .../golang.org/x/net/ipv6/payload.go | 0 vendor/golang.org/x/net/ipv6/payload_cmsg.go | 70 + .../golang.org/x/net/ipv6/payload_nocmsg.go | 38 + .../golang.org/x/net/ipv6/sockopt.go | 0 vendor/golang.org/x/net/ipv6/sockopt_posix.go | 89 + vendor/golang.org/x/net/ipv6/sockopt_stub.go | 46 + vendor/golang.org/x/net/ipv6/sys_aix.go | 77 + vendor/golang.org/x/net/ipv6/sys_asmreq.go | 24 + .../golang.org/x/net/ipv6/sys_asmreq_stub.go | 17 + vendor/golang.org/x/net/ipv6/sys_bpf.go | 24 + vendor/golang.org/x/net/ipv6/sys_bpf_stub.go | 16 + .../golang.org/x/net/ipv6/sys_bsd.go | 0 vendor/golang.org/x/net/ipv6/sys_darwin.go | 78 + vendor/golang.org/x/net/ipv6/sys_freebsd.go | 92 + vendor/golang.org/x/net/ipv6/sys_linux.go | 75 + .../golang.org/x/net/ipv6/sys_solaris.go | 0 vendor/golang.org/x/net/ipv6/sys_ssmreq.go | 54 + .../golang.org/x/net/ipv6/sys_ssmreq_stub.go | 21 + vendor/golang.org/x/net/ipv6/sys_stub.go | 13 + .../golang.org/x/net/ipv6/sys_windows.go | 0 .../golang.org/x/net/ipv6/zsys_aix_ppc64.go | 103 + vendor/golang.org/x/net/ipv6/zsys_darwin.go | 131 + .../golang.org/x/net/ipv6/zsys_dragonfly.go | 88 + .../golang.org/x/net/ipv6/zsys_freebsd_386.go | 122 + .../x/net/ipv6/zsys_freebsd_amd64.go | 124 + .../golang.org/x/net/ipv6/zsys_freebsd_arm.go | 124 + .../x/net/ipv6/zsys_freebsd_arm64.go | 122 + .../golang.org/x/net/ipv6/zsys_linux_386.go | 152 + .../golang.org/x/net/ipv6/zsys_linux_amd64.go | 154 + .../golang.org/x/net/ipv6/zsys_linux_arm.go | 152 + .../golang.org/x/net/ipv6/zsys_linux_arm64.go | 154 + .../golang.org/x/net/ipv6/zsys_linux_mips.go | 152 + .../x/net/ipv6/zsys_linux_mips64.go | 154 + .../x/net/ipv6/zsys_linux_mips64le.go | 154 + .../x/net/ipv6/zsys_linux_mipsle.go | 152 + .../golang.org/x/net/ipv6/zsys_linux_ppc.go | 152 + .../golang.org/x/net/ipv6/zsys_linux_ppc64.go | 154 + .../x/net/ipv6/zsys_linux_ppc64le.go | 154 + .../x/net/ipv6/zsys_linux_riscv64.go | 156 + .../golang.org/x/net/ipv6/zsys_linux_s390x.go | 154 + vendor/golang.org/x/net/ipv6/zsys_netbsd.go | 84 + vendor/golang.org/x/net/ipv6/zsys_openbsd.go | 93 + vendor/golang.org/x/net/ipv6/zsys_solaris.go | 131 + vendor/golang.org/x/net/proxy/dial.go | 54 - vendor/golang.org/x/net/proxy/direct.go | 31 - vendor/golang.org/x/net/proxy/per_host.go | 155 - vendor/golang.org/x/net/proxy/proxy.go | 149 - vendor/golang.org/x/net/proxy/socks5.go | 42 - .../golang.org/x/net/publicsuffix/list.go | 4 + vendor/golang.org/x/net/publicsuffix/table.go | 10046 ++ vendor/golang.org/x/oauth2/.travis.yml | 13 + vendor/golang.org/x/sync/AUTHORS | 3 + vendor/golang.org/x/sync/CONTRIBUTORS | 3 + .../golang.org/x/sync/semaphore/semaphore.go | 136 + vendor/golang.org/x/sys/AUTHORS | 3 + vendor/golang.org/x/sys/CONTRIBUTORS | 3 + vendor/golang.org/x/sys/cpu/cpu_aix.go | 34 + vendor/golang.org/x/sys/cpu/cpu_aix_ppc64.go | 34 - vendor/golang.org/x/sys/cpu/cpu_arm64.go | 8 +- .../golang.org/x/sys/cpu/syscall_aix_gccgo.go | 27 + .../sys/internal/unsafeheader/unsafeheader.go | 30 + vendor/golang.org/x/sys/unix/.gitignore | 2 + vendor/golang.org/x/sys/unix/mkall.sh | 0 vendor/golang.org/x/sys/unix/mkerrors.sh | 3 +- .../x/sys/unix/syscall_darwin.1_13.go | 21 +- .../golang.org/x/sys/unix/syscall_darwin.go | 1 + .../x/sys/unix/syscall_darwin_386.go | 11 - .../x/sys/unix/syscall_darwin_amd64.go | 11 - .../x/sys/unix/syscall_darwin_arm.go | 11 - .../x/sys/unix/syscall_darwin_arm64.go | 11 - vendor/golang.org/x/sys/unix/syscall_linux.go | 19 +- .../x/sys/unix/syscall_linux_386.go | 2 +- .../x/sys/unix/syscall_linux_amd64.go | 2 +- .../x/sys/unix/syscall_linux_arm.go | 2 +- .../x/sys/unix/syscall_linux_arm64.go | 28 +- .../x/sys/unix/syscall_linux_mips64x.go | 2 +- .../x/sys/unix/syscall_linux_mipsx.go | 2 +- .../x/sys/unix/syscall_linux_ppc64x.go | 2 +- .../x/sys/unix/syscall_linux_riscv64.go | 8 +- .../x/sys/unix/syscall_linux_s390x.go | 2 +- .../x/sys/unix/syscall_linux_sparc64.go | 2 +- vendor/golang.org/x/sys/unix/syscall_unix.go | 17 +- vendor/golang.org/x/sys/unix/zerrors_linux.go | 2 + .../x/sys/unix/zerrors_linux_386.go | 2 + .../x/sys/unix/zerrors_linux_amd64.go | 2 + .../x/sys/unix/zerrors_linux_arm.go | 2 + .../x/sys/unix/zerrors_linux_arm64.go | 2 + .../x/sys/unix/zerrors_linux_mips.go | 2 + .../x/sys/unix/zerrors_linux_mips64.go | 2 + .../x/sys/unix/zerrors_linux_mips64le.go | 2 + .../x/sys/unix/zerrors_linux_mipsle.go | 2 + .../x/sys/unix/zerrors_linux_ppc64.go | 2 + .../x/sys/unix/zerrors_linux_ppc64le.go | 2 + .../x/sys/unix/zerrors_linux_riscv64.go | 2 + .../x/sys/unix/zerrors_linux_s390x.go | 2 + .../x/sys/unix/zerrors_linux_sparc64.go | 2 + .../x/sys/unix/zsyscall_darwin_386.1_11.go | 22 +- .../x/sys/unix/zsyscall_darwin_386.go | 32 +- .../x/sys/unix/zsyscall_darwin_amd64.1_11.go | 22 +- .../x/sys/unix/zsyscall_darwin_amd64.go | 32 +- .../x/sys/unix/zsyscall_darwin_arm.1_11.go | 22 +- .../x/sys/unix/zsyscall_darwin_arm.go | 32 +- .../x/sys/unix/zsyscall_darwin_arm64.1_11.go | 22 +- .../x/sys/unix/zsyscall_darwin_arm64.go | 32 +- .../golang.org/x/sys/unix/zsyscall_linux.go | 47 +- .../x/sys/unix/zsyscall_linux_386.go | 2 +- .../x/sys/unix/zsyscall_linux_amd64.go | 2 +- .../x/sys/unix/zsyscall_linux_arm.go | 2 +- .../x/sys/unix/zsyscall_linux_arm64.go | 4 +- .../x/sys/unix/zsyscall_linux_mips.go | 2 +- .../x/sys/unix/zsyscall_linux_mips64.go | 2 +- .../x/sys/unix/zsyscall_linux_mips64le.go | 2 +- .../x/sys/unix/zsyscall_linux_mipsle.go | 2 +- .../x/sys/unix/zsyscall_linux_ppc64.go | 2 +- .../x/sys/unix/zsyscall_linux_ppc64le.go | 2 +- .../x/sys/unix/zsyscall_linux_s390x.go | 2 +- .../x/sys/unix/zsyscall_linux_sparc64.go | 2 +- .../x/sys/unix/zsysctl_openbsd_386.go | 3 +- .../x/sys/unix/zsysctl_openbsd_amd64.go | 1 + .../x/sys/unix/zsysctl_openbsd_arm.go | 1 + vendor/golang.org/x/sys/unix/ztypes_linux.go | 21 +- .../golang.org/x/sys/windows/dll_windows.go | 29 + .../golang.org/x/sys/windows/env_windows.go | 11 +- vendor/golang.org/x/sys/windows/mkerrors.bash | 0 .../x/sys/windows/mkknownfolderids.bash | 0 .../x/sys/windows/security_windows.go | 20 +- .../golang.org/x/sys/windows/svc/security.go | 7 +- .../golang.org/x/sys/windows/svc/service.go | 11 +- .../x/sys/windows/syscall_windows.go | 37 +- vendor/golang.org/x/text/AUTHORS | 3 + vendor/golang.org/x/text/CONTRIBUTORS | 3 + vendor/golang.org/x/text/internal/internal.go | 49 - vendor/golang.org/x/text/internal/match.go | 67 - vendor/golang.org/x/text/unicode/cldr/base.go | 105 - vendor/golang.org/x/text/unicode/cldr/cldr.go | 137 - .../golang.org/x/text/unicode/cldr/collate.go | 359 - .../golang.org/x/text/unicode/cldr/decode.go | 172 - .../golang.org/x/text/unicode/cldr/resolve.go | 602 - .../golang.org/x/text/unicode/cldr/slice.go | 144 - vendor/golang.org/x/text/unicode/cldr/xml.go | 1494 - vendor/golang.org/x/text/width/kind_string.go | 28 - .../golang.org/x/text/width/tables10.0.0.go | 1318 - .../golang.org/x/text/width/tables11.0.0.go | 1330 - .../golang.org/x/text/width/tables12.0.0.go | 1350 - vendor/golang.org/x/text/width/tables9.0.0.go | 1286 - vendor/golang.org/x/text/width/transform.go | 239 - vendor/golang.org/x/text/width/trieval.go | 30 - vendor/golang.org/x/text/width/width.go | 206 - vendor/golang.org/x/time/AUTHORS | 3 + vendor/golang.org/x/time/CONTRIBUTORS | 3 + vendor/golang.org/x/tools/AUTHORS | 3 + vendor/golang.org/x/tools/CONTRIBUTORS | 3 + .../x/oauth2 => golang.org/x/tools}/LICENSE | 0 .../x/net => golang.org/x/tools}/PATENTS | 0 .../golang.org/x/tools/cmd/goimports/doc.go | 43 + .../x/tools/cmd/goimports/goimports.go | 387 + .../x/tools/cmd/goimports/goimports_gc.go | 26 + .../x/tools/cmd/goimports/goimports_not_gc.go | 11 + .../x/tools/go/analysis/analysis.go | 237 + .../x/tools/go/analysis/diagnostic.go | 61 + vendor/golang.org/x/tools/go/analysis/doc.go | 301 + .../go/analysis/passes/inspect/inspect.go | 49 + .../x/tools/go/analysis/validate.go | 97 + .../x/tools/go/ast/astutil/enclosing.go | 627 + .../x/tools/go/ast/astutil/imports.go | 482 + .../x/tools/go/ast/astutil/rewrite.go | 477 + .../golang.org/x/tools/go/ast/astutil/util.go | 14 + .../x/tools/go/ast/inspector/inspector.go | 186 + .../x/tools/go/ast/inspector/typeof.go | 216 + .../x/tools/go/buildutil/allpackages.go | 198 + .../x/tools/go/buildutil/fakecontext.go | 109 + .../x/tools/go/buildutil/overlay.go | 103 + .../golang.org/x/tools/go/buildutil/tags.go | 75 + .../golang.org/x/tools/go/buildutil/util.go | 212 + .../x/tools/go/gcexportdata/gcexportdata.go | 105 + .../x/tools/go/gcexportdata/importer.go | 73 + .../golang.org/x/tools/go/internal/cgo/cgo.go | 220 + .../x/tools/go/internal/cgo/cgo_pkgconfig.go | 39 + .../go/internal/gcimporter/exportdata.go | 93 + .../go/internal/gcimporter/gcimporter.go | 1075 + .../x/tools/go/internal/gcimporter/iexport.go | 759 + .../x/tools/go/internal/gcimporter/iimport.go | 800 + .../go/internal/gcimporter/newInterface10.go | 21 + .../go/internal/gcimporter/newInterface11.go | 13 + .../tools/go/internal/packagesdriver/sizes.go | 117 + vendor/golang.org/x/tools/go/loader/doc.go | 204 + vendor/golang.org/x/tools/go/loader/loader.go | 1086 + vendor/golang.org/x/tools/go/loader/util.go | 124 + vendor/golang.org/x/tools/go/packages/doc.go | 221 + .../x/tools/go/packages/external.go | 101 + .../golang.org/x/tools/go/packages/golist.go | 907 + .../x/tools/go/packages/golist_overlay.go | 438 + .../x/tools/go/packages/loadmode_string.go | 57 + .../x/tools/go/packages/packages.go | 1200 + .../golang.org/x/tools/go/packages/visit.go | 55 + .../x/tools/go/types/objectpath/objectpath.go | 524 + .../x/tools/go/types/typeutil/callee.go | 46 + .../x/tools/go/types/typeutil/imports.go | 31 + .../x/tools/go/types/typeutil/map.go | 313 + .../tools/go/types/typeutil/methodsetcache.go | 72 + .../x/tools/go/types/typeutil/ui.go | 52 + .../internal/analysisinternal/analysis.go | 118 + .../x/tools/internal/event/core/event.go | 85 + .../x/tools/internal/event/core/export.go | 70 + .../x/tools/internal/event/core/fast.go | 77 + .../golang.org/x/tools/internal/event/doc.go | 7 + .../x/tools/internal/event/event.go | 127 + .../x/tools/internal/event/keys/keys.go | 564 + .../x/tools/internal/event/keys/standard.go | 22 + .../x/tools/internal/event/label/label.go | 213 + .../x/tools/internal/fastwalk/fastwalk.go | 196 + .../fastwalk/fastwalk_dirent_fileno.go | 13 + .../internal/fastwalk/fastwalk_dirent_ino.go | 14 + .../fastwalk/fastwalk_dirent_namlen_bsd.go | 13 + .../fastwalk/fastwalk_dirent_namlen_linux.go | 29 + .../internal/fastwalk/fastwalk_portable.go | 37 + .../tools/internal/fastwalk/fastwalk_unix.go | 128 + .../x/tools/internal/gocommand/invoke.go | 187 + .../x/tools/internal/gopathwalk/walk.go | 275 + .../x/tools/internal/imports/fix.go | 1581 + .../x/tools/internal/imports/imports.go | 413 + .../x/tools/internal/imports/mod.go | 718 + .../x/tools/internal/imports/mod_cache.go | 232 + .../x/tools/internal/imports/sortimports.go | 280 + .../x/tools/internal/imports/zstdlib.go | 10464 ++ .../internal/packagesinternal/packages.go | 12 + vendor/golang.org/x/xerrors/LICENSE | 27 + .../x/text => golang.org/x/xerrors}/PATENTS | 0 vendor/golang.org/x/xerrors/README | 2 + vendor/golang.org/x/xerrors/adaptor.go | 193 + vendor/golang.org/x/xerrors/codereview.cfg | 1 + vendor/golang.org/x/xerrors/doc.go | 22 + vendor/golang.org/x/xerrors/errors.go | 33 + vendor/golang.org/x/xerrors/fmt.go | 187 + vendor/golang.org/x/xerrors/format.go | 34 + vendor/golang.org/x/xerrors/frame.go | 56 + vendor/golang.org/x/xerrors/go.mod | 3 + .../golang.org/x/xerrors/internal/internal.go | 8 + vendor/golang.org/x/xerrors/wrap.go | 106 + vendor/google.golang.org/api/AUTHORS | 10 + vendor/google.golang.org/api/CONTRIBUTORS | 55 + .../api/compute/v1/compute-api.json | 46456 +++++ .../api/compute/v1/compute-gen.go | 130521 +++++++++++++++ .../google.golang.org/api/gensupport/doc.go | 10 - .../api/gensupport/jsonfloat.go | 57 - .../api/googleapi/googleapi.go | 14 +- .../internal/uritemplates/uritemplates.go | 2 +- .../api/googleapi/transport/apikey.go | 2 +- .../google.golang.org/api/googleapi/types.go | 2 +- .../google.golang.org/api/internal/creds.go | 16 +- .../api/{ => internal}/gensupport/buffer.go | 0 .../api/internal}/gensupport/doc.go | 0 .../api/{ => internal}/gensupport/json.go | 0 .../api/internal/gensupport/jsonfloat.go | 47 + .../api/{ => internal}/gensupport/media.go | 0 .../api/{ => internal}/gensupport/params.go | 0 .../{ => internal}/gensupport/resumable.go | 0 .../api/{ => internal}/gensupport/send.go | 0 vendor/google.golang.org/api/internal/pool.go | 16 +- .../api/internal/settings.go | 16 +- .../api/iterator/iterator.go | 36 +- .../api/option/credentials_go19.go | 16 +- .../api/option/credentials_notgo19.go | 16 +- vendor/google.golang.org/api/option/option.go | 16 +- .../api/storage/v1/storage-api.json | 17 +- .../api/storage/v1/storage-gen.go | 129 +- .../api/support/bundler/bundler.go | 339 + .../api/transport/http/dial.go | 16 +- .../api/transport/http/dial_appengine.go | 16 +- .../http/internal/propagation/http.go | 16 +- .../google.golang.org/appengine/.travis.yml | 20 + .../appengine/CONTRIBUTING.md | 0 .../appengine}/LICENSE | 0 vendor/google.golang.org/appengine/README.md | 100 + .../google.golang.org/appengine/appengine.go | 135 + .../appengine/appengine_vm.go | 0 .../appengine/datastore/datastore.go | 407 + .../appengine/datastore/doc.go | 361 + .../datastore/internal/cloudkey/cloudkey.go | 120 + .../datastore/internal/cloudpb/entity.pb.go | 344 + .../appengine/datastore/key.go | 400 + .../appengine/datastore/keycompat.go | 89 + .../appengine/datastore/load.go | 429 + .../appengine/datastore/metadata.go | 78 + .../appengine/datastore/prop.go | 330 + .../appengine/datastore/query.go | 774 + .../appengine/datastore/save.go | 333 + .../appengine/datastore/transaction.go | 96 + .../google.golang.org/appengine/errors.go | 0 vendor/google.golang.org/appengine/go.mod | 10 + vendor/google.golang.org/appengine/go.sum | 22 + .../google.golang.org/appengine/identity.go | 0 .../appengine/internal/api.go | 0 .../appengine/internal/api_classic.go | 0 .../appengine/internal/api_common.go | 0 .../appengine/internal/app_id.go | 0 .../app_identity/app_identity_service.pb.go | 611 + .../app_identity/app_identity_service.proto | 0 .../appengine/internal/base/api_base.pb.go | 0 .../appengine/internal/base/api_base.proto | 0 .../internal/datastore/datastore_v3.pb.go | 0 .../internal/datastore/datastore_v3.proto | 0 .../appengine/internal/identity.go | 0 .../appengine/internal/identity_classic.go | 0 .../appengine/internal/identity_flex.go | 0 .../appengine/internal/identity_vm.go | 0 .../appengine/internal/internal.go | 0 .../appengine/internal/log/log_service.pb.go | 0 .../appengine/internal/log/log_service.proto | 0 .../appengine/internal/main.go | 0 .../appengine/internal/main_common.go | 0 .../appengine/internal/main_vm.go | 0 .../appengine/internal/metadata.go | 0 .../internal/modules/modules_service.pb.go | 786 + .../internal/modules/modules_service.proto | 0 .../appengine/internal/net.go | 0 .../appengine/internal/regen.sh | 0 .../internal/remote_api/remote_api.pb.go | 0 .../internal/remote_api/remote_api.proto | 0 .../appengine/internal/transaction.go | 0 .../internal/urlfetch/urlfetch_service.pb.go | 0 .../internal/urlfetch/urlfetch_service.proto | 0 .../google.golang.org/appengine/namespace.go | 0 .../google.golang.org/appengine/timeout.go | 0 .../appengine/travis_install.sh | 18 + .../appengine/travis_test.sh | 12 + .../appengine/urlfetch/urlfetch.go | 0 .../genproto/LICENSE} | 0 .../googleapis/api/httpbody/httpbody.pb.go | 148 + .../protobuf/field_mask/field_mask.pb.go | 284 + vendor/google.golang.org/grpc/.travis.yml | 42 + vendor/google.golang.org/grpc/codegen.sh | 0 .../grpc/health/regenerate.sh | 0 vendor/google.golang.org/grpc/install_gae.sh | 0 .../grpc/internal/binarylog/regenerate.sh | 0 vendor/google.golang.org/grpc/vet.sh | 0 vendor/gopkg.in/fsnotify.v1/.editorconfig | 5 + vendor/gopkg.in/fsnotify.v1/.gitignore | 6 + vendor/gopkg.in/fsnotify.v1/.travis.yml | 30 + vendor/gopkg.in/fsnotify.v1/AUTHORS | 6 + vendor/gopkg.in/fsnotify.v1/CHANGELOG.md | 16 +- vendor/gopkg.in/fsnotify.v1/CONTRIBUTING.md | 6 +- vendor/gopkg.in/fsnotify.v1/README.md | 37 +- vendor/gopkg.in/fsnotify.v1/fsnotify.go | 4 + vendor/gopkg.in/fsnotify.v1/inotify.go | 66 +- vendor/gopkg.in/fsnotify.v1/kqueue.go | 62 +- vendor/gopkg.in/inf.v0/LICENSE | 28 - vendor/gopkg.in/inf.v0/dec.go | 615 - vendor/gopkg.in/inf.v0/rounder.go | 145 - vendor/gopkg.in/resty.v1/.gitignore | 28 + vendor/gopkg.in/resty.v1/.travis.yml | 28 + .../vendor => }/gopkg.in/resty.v1/BUILD.bazel | 0 .../vendor => }/gopkg.in/resty.v1/LICENSE | 0 .../vendor => }/gopkg.in/resty.v1/README.md | 0 .../vendor => }/gopkg.in/resty.v1/WORKSPACE | 0 .../vendor => }/gopkg.in/resty.v1/client.go | 0 .../vendor => }/gopkg.in/resty.v1/default.go | 0 .../vendor => }/gopkg.in/resty.v1/go.mod | 0 .../gopkg.in/resty.v1/middleware.go | 0 .../vendor => }/gopkg.in/resty.v1/redirect.go | 0 .../vendor => }/gopkg.in/resty.v1/request.go | 0 .../gopkg.in/resty.v1/request16.go | 0 .../gopkg.in/resty.v1/request17.go | 0 .../vendor => }/gopkg.in/resty.v1/response.go | 0 .../vendor => }/gopkg.in/resty.v1/resty.go | 0 .../vendor => }/gopkg.in/resty.v1/retry.go | 0 .../vendor => }/gopkg.in/resty.v1/util.go | 0 .../square/go-jose.v2/.gitcookies.sh.enc | 1 + vendor/gopkg.in/square/go-jose.v2/.gitignore | 7 + vendor/gopkg.in/square/go-jose.v2/.travis.yml | 44 + vendor/gopkg.in/yaml.v2/.travis.yml | 16 + vendor/gopkg.in/yaml.v2/LICENSE | 208 +- vendor/gopkg.in/yaml.v2/NOTICE | 13 + vendor/gopkg.in/yaml.v2/README.md | 2 + vendor/gopkg.in/yaml.v2/apic.go | 56 +- vendor/gopkg.in/yaml.v2/decode.go | 294 +- vendor/gopkg.in/yaml.v2/emitterc.go | 20 +- vendor/gopkg.in/yaml.v2/encode.go | 164 +- vendor/gopkg.in/yaml.v2/go.mod | 5 + vendor/gopkg.in/yaml.v2/parserc.go | 1 - vendor/gopkg.in/yaml.v2/readerc.go | 20 +- vendor/gopkg.in/yaml.v2/resolve.go | 91 +- vendor/gopkg.in/yaml.v2/scannerc.go | 163 +- vendor/gopkg.in/yaml.v2/sorter.go | 9 + vendor/gopkg.in/yaml.v2/writerc.go | 65 +- vendor/gopkg.in/yaml.v2/yaml.go | 136 +- vendor/gopkg.in/yaml.v2/yamlh.go | 33 +- vendor/honnef.co/go/tools/LICENSE | 20 + vendor/honnef.co/go/tools/LICENSE-THIRD-PARTY | 284 + vendor/honnef.co/go/tools/arg/arg.go | 48 + .../go/tools/cmd/staticcheck/README.md | 15 + .../go/tools/cmd/staticcheck/staticcheck.go | 44 + vendor/honnef.co/go/tools/code/code.go | 481 + vendor/honnef.co/go/tools/config/config.go | 245 + vendor/honnef.co/go/tools/config/example.conf | 10 + .../honnef.co/go/tools/deprecated/stdlib.go | 119 + vendor/honnef.co/go/tools/edit/edit.go | 67 + vendor/honnef.co/go/tools/facts/deprecated.go | 144 + vendor/honnef.co/go/tools/facts/generated.go | 93 + vendor/honnef.co/go/tools/facts/purity.go | 177 + vendor/honnef.co/go/tools/facts/token.go | 24 + vendor/honnef.co/go/tools/functions/loops.go | 54 + vendor/honnef.co/go/tools/functions/stub.go | 32 + .../go/tools/functions/terminates.go | 70 + .../go/tools/go/types/typeutil/callee.go | 46 + .../go/tools/go/types/typeutil/identical.go | 75 + .../go/tools/go/types/typeutil/imports.go | 31 + .../go/tools/go/types/typeutil/map.go | 319 + .../tools/go/types/typeutil/methodsetcache.go | 72 + .../go/tools/go/types/typeutil/ui.go | 52 + .../go/tools/internal/cache/cache.go | 496 + .../go/tools/internal/cache/default.go | 85 + .../honnef.co/go/tools/internal/cache/hash.go | 176 + .../tools/internal/passes/buildir/buildir.go | 113 + .../go/tools/internal/renameio/renameio.go | 93 + .../go/tools/internal/robustio/robustio.go | 53 + .../internal/robustio/robustio_darwin.go | 29 + .../tools/internal/robustio/robustio_flaky.go | 93 + .../tools/internal/robustio/robustio_other.go | 28 + .../internal/robustio/robustio_windows.go | 33 + .../go/tools/internal/sharedcheck/lint.go | 71 + vendor/honnef.co/go/tools/ir/LICENSE | 28 + vendor/honnef.co/go/tools/ir/blockopt.go | 209 + vendor/honnef.co/go/tools/ir/builder.go | 2474 + vendor/honnef.co/go/tools/ir/const.go | 153 + vendor/honnef.co/go/tools/ir/create.go | 275 + vendor/honnef.co/go/tools/ir/doc.go | 129 + vendor/honnef.co/go/tools/ir/dom.go | 461 + vendor/honnef.co/go/tools/ir/emit.go | 450 + vendor/honnef.co/go/tools/ir/exits.go | 271 + vendor/honnef.co/go/tools/ir/func.go | 961 + vendor/honnef.co/go/tools/ir/html.go | 1124 + vendor/honnef.co/go/tools/ir/identical.go | 7 + vendor/honnef.co/go/tools/ir/identical_17.go | 7 + vendor/honnef.co/go/tools/ir/irutil/load.go | 183 + vendor/honnef.co/go/tools/ir/irutil/switch.go | 264 + vendor/honnef.co/go/tools/ir/irutil/util.go | 70 + vendor/honnef.co/go/tools/ir/irutil/visit.go | 79 + vendor/honnef.co/go/tools/ir/lift.go | 1063 + vendor/honnef.co/go/tools/ir/lvalue.go | 116 + vendor/honnef.co/go/tools/ir/methods.go | 239 + vendor/honnef.co/go/tools/ir/mode.go | 98 + vendor/honnef.co/go/tools/ir/print.go | 472 + vendor/honnef.co/go/tools/ir/sanity.go | 555 + vendor/honnef.co/go/tools/ir/source.go | 270 + vendor/honnef.co/go/tools/ir/ssa.go | 1856 + vendor/honnef.co/go/tools/ir/staticcheck.conf | 3 + vendor/honnef.co/go/tools/ir/util.go | 89 + vendor/honnef.co/go/tools/ir/wrappers.go | 292 + vendor/honnef.co/go/tools/ir/write.go | 5 + vendor/honnef.co/go/tools/lint/LICENSE | 28 + vendor/honnef.co/go/tools/lint/lint.go | 539 + .../go/tools/lint/lintdsl/lintdsl.go | 58 + .../go/tools/lint/lintutil/format/format.go | 162 + .../honnef.co/go/tools/lint/lintutil/stats.go | 7 + .../go/tools/lint/lintutil/stats_bsd.go | 10 + .../go/tools/lint/lintutil/stats_posix.go | 10 + .../honnef.co/go/tools/lint/lintutil/util.go | 444 + vendor/honnef.co/go/tools/lint/runner.go | 1114 + vendor/honnef.co/go/tools/lint/stats.go | 38 + vendor/honnef.co/go/tools/loader/loader.go | 210 + vendor/honnef.co/go/tools/pattern/convert.go | 242 + vendor/honnef.co/go/tools/pattern/doc.go | 273 + vendor/honnef.co/go/tools/pattern/fuzz.go | 50 + vendor/honnef.co/go/tools/pattern/lexer.go | 221 + vendor/honnef.co/go/tools/pattern/match.go | 513 + vendor/honnef.co/go/tools/pattern/parser.go | 455 + vendor/honnef.co/go/tools/pattern/pattern.go | 497 + vendor/honnef.co/go/tools/printf/fuzz.go | 11 + vendor/honnef.co/go/tools/printf/printf.go | 197 + vendor/honnef.co/go/tools/report/report.go | 184 + vendor/honnef.co/go/tools/simple/analysis.go | 148 + vendor/honnef.co/go/tools/simple/doc.go | 485 + vendor/honnef.co/go/tools/simple/lint.go | 1868 + .../go/tools/staticcheck/analysis.go | 267 + .../go/tools/staticcheck/buildtag.go | 21 + vendor/honnef.co/go/tools/staticcheck/doc.go | 880 + vendor/honnef.co/go/tools/staticcheck/lint.go | 3825 + .../honnef.co/go/tools/staticcheck/rules.go | 315 + .../go/tools/staticcheck/structtag.go | 58 + .../honnef.co/go/tools/stylecheck/analysis.go | 81 + vendor/honnef.co/go/tools/stylecheck/doc.go | 231 + vendor/honnef.co/go/tools/stylecheck/lint.go | 914 + vendor/honnef.co/go/tools/stylecheck/names.go | 276 + vendor/honnef.co/go/tools/unused/edge.go | 54 + .../go/tools/unused/edgekind_string.go | 109 + .../honnef.co/go/tools/unused/implements.go | 82 + vendor/honnef.co/go/tools/unused/unused.go | 1978 + .../honnef.co/go/tools/version/buildinfo.go | 46 + .../go/tools/version/buildinfo111.go | 6 + vendor/honnef.co/go/tools/version/version.go | 42 + vendor/modules.txt | 1061 + vendor/vendor.json | 561 - 3837 files changed, 447184 insertions(+), 762743 deletions(-) create mode 100644 go.mod create mode 100644 go.sum rename {vendor/github.com/shirou/gopsutil/host => lib/darwin}/include/smc.c (100%) rename {vendor/github.com/shirou/gopsutil/host => lib/darwin}/include/smc.h (100%) create mode 100644 tools/go.mod create mode 100644 tools/go.sum create mode 100644 tools/tools.go create mode 100644 vendor/cloud.google.com/go/CHANGES.md create mode 100644 vendor/cloud.google.com/go/CODE_OF_CONDUCT.md create mode 100644 vendor/cloud.google.com/go/CONTRIBUTING.md create mode 100644 vendor/cloud.google.com/go/README.md create mode 100644 vendor/cloud.google.com/go/RELEASING.md create mode 100644 vendor/cloud.google.com/go/compute/metadata/.repo-metadata.json create mode 100644 vendor/cloud.google.com/go/doc.go create mode 100644 vendor/cloud.google.com/go/go.mod create mode 100644 vendor/cloud.google.com/go/go.sum create mode 100644 vendor/cloud.google.com/go/iam/.repo-metadata.json mode change 100755 => 100644 vendor/cloud.google.com/go/internal/version/update_version.sh create mode 100644 vendor/cloud.google.com/go/issue_template.md create mode 100644 vendor/cloud.google.com/go/regen-gapic.sh create mode 100644 vendor/cloud.google.com/go/storage/.repo-metadata.json create mode 100644 vendor/cloud.google.com/go/storage/CHANGES.md rename vendor/{github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine => cloud.google.com/go/storage}/LICENSE (100%) create mode 100644 vendor/cloud.google.com/go/storage/go.mod create mode 100644 vendor/cloud.google.com/go/storage/go.sum create mode 100644 vendor/cloud.google.com/go/storage/go_mod_tidy_hack.go create mode 100644 vendor/cloud.google.com/go/tidyall.sh create mode 100644 vendor/cloud.google.com/go/tools.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/.travis.yml create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/CONTRIBUTING.md create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/LICENSE create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/README.md create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/common.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/connection.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/go.mod create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/go.sum create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/nodeinfo.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/ocagent.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/options.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/transform_spans.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/transform_stats_to_metrics.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/version.go rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/LICENSE (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/NOTICE (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/applicationgateways.go (95%) create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/client.go rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitauthorizations.go (96%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitpeerings.go (96%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuits.go (96%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressrouteserviceproviders.go (97%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/interfacesgroup.go (96%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/loadbalancers.go (96%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/localnetworkgateways.go (96%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/models.go (99%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/publicipaddresses.go (96%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/routes.go (96%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/routetables.go (96%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/securitygroups.go (96%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/securityrules.go (96%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/subnets.go (96%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/usages.go (97%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/version.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworkgatewayconnections.go (96%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworkgateways.go (93%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworks.go (96%) create mode 100644 vendor/github.com/Azure/azure-sdk-for-go/version/version.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/README.md create mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/config.go rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/adal/devicetoken.go (83%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/adal/persist.go (100%) create mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/sender.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/adal/token.go rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/adal/version.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/authorization.go (81%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/autorest.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/azure/async.go (90%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/azure/auth/auth.go (95%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/azure/azure.go (94%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/azure/cli/profile.go (95%) create mode 100644 vendor/github.com/Azure/go-autorest/autorest/azure/cli/token.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/azure/environments.go rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/azure/metadata_environment.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/azure/rp.go (95%) create mode 100644 vendor/github.com/Azure/go-autorest/autorest/client.go rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/date/date.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/date/time.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/date/timerfc1123.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/date/unixtime.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/date/utility.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/error.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/preparer.go (86%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/responder.go (94%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/retriablerequest.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/retriablerequest_1.7.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/retriablerequest_1.8.go (100%) create mode 100644 vendor/github.com/Azure/go-autorest/autorest/sender.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/to/convert.go rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/utility.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/autorest/validation/error.go (100%) create mode 100644 vendor/github.com/Azure/go-autorest/autorest/validation/validation.go create mode 100644 vendor/github.com/Azure/go-autorest/autorest/version.go rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/Azure/go-autorest/logger/logger.go (100%) create mode 100644 vendor/github.com/Azure/go-autorest/tracing/tracing.go create mode 100644 vendor/github.com/BurntSushi/toml/.gitignore create mode 100644 vendor/github.com/BurntSushi/toml/.travis.yml create mode 100644 vendor/github.com/DataDog/datadog-go/statsd/buffer.go create mode 100644 vendor/github.com/DataDog/datadog-go/statsd/buffer_pool.go create mode 100644 vendor/github.com/DataDog/datadog-go/statsd/event.go create mode 100644 vendor/github.com/DataDog/datadog-go/statsd/format.go create mode 100644 vendor/github.com/DataDog/datadog-go/statsd/noop.go create mode 100644 vendor/github.com/DataDog/datadog-go/statsd/options.go create mode 100644 vendor/github.com/DataDog/datadog-go/statsd/sender.go create mode 100644 vendor/github.com/DataDog/datadog-go/statsd/service_check.go create mode 100644 vendor/github.com/LK4D4/joincontext/.travis.yml create mode 100644 vendor/github.com/Microsoft/go-winio/.gitignore delete mode 100644 vendor/github.com/NVIDIA/gpu-monitoring-tools/CLA delete mode 100644 vendor/github.com/NVIDIA/gpu-monitoring-tools/README.md create mode 100644 vendor/github.com/NYTimes/gziphandler/.gitignore create mode 100644 vendor/github.com/NYTimes/gziphandler/.travis.yml delete mode 100644 vendor/github.com/Nvveen/Gotty/LICENSE delete mode 100644 vendor/github.com/Nvveen/Gotty/README delete mode 100644 vendor/github.com/Nvveen/Gotty/TODO delete mode 100644 vendor/github.com/Nvveen/Gotty/attributes.go delete mode 100644 vendor/github.com/Nvveen/Gotty/gotty.go delete mode 100644 vendor/github.com/Nvveen/Gotty/parser.go delete mode 100644 vendor/github.com/Nvveen/Gotty/types.go create mode 100644 vendor/github.com/agext/levenshtein/.gitignore create mode 100644 vendor/github.com/agext/levenshtein/.travis.yml delete mode 100644 vendor/github.com/apparentlymart/go-textseg/LICENSE delete mode 100644 vendor/github.com/apparentlymart/go-textseg/v12/textseg/make_tables.go delete mode 100644 vendor/github.com/apparentlymart/go-textseg/v12/textseg/make_test_tables.go delete mode 100644 vendor/github.com/appc/spec/LICENSE delete mode 100644 vendor/github.com/appc/spec/schema/common/common.go delete mode 100644 vendor/github.com/appc/spec/schema/doc.go delete mode 100644 vendor/github.com/appc/spec/schema/image.go delete mode 100644 vendor/github.com/appc/spec/schema/kind.go delete mode 100644 vendor/github.com/appc/spec/schema/pod.go delete mode 100644 vendor/github.com/appc/spec/schema/types/acidentifier.go delete mode 100644 vendor/github.com/appc/spec/schema/types/ackind.go delete mode 100644 vendor/github.com/appc/spec/schema/types/acname.go delete mode 100644 vendor/github.com/appc/spec/schema/types/annotations.go delete mode 100644 vendor/github.com/appc/spec/schema/types/app.go delete mode 100644 vendor/github.com/appc/spec/schema/types/date.go delete mode 100644 vendor/github.com/appc/spec/schema/types/dependencies.go delete mode 100644 vendor/github.com/appc/spec/schema/types/doc.go delete mode 100644 vendor/github.com/appc/spec/schema/types/environment.go delete mode 100644 vendor/github.com/appc/spec/schema/types/errors.go delete mode 100644 vendor/github.com/appc/spec/schema/types/event_handler.go delete mode 100644 vendor/github.com/appc/spec/schema/types/exec.go delete mode 100644 vendor/github.com/appc/spec/schema/types/hash.go delete mode 100644 vendor/github.com/appc/spec/schema/types/isolator.go delete mode 100644 vendor/github.com/appc/spec/schema/types/isolator_linux_specific.go delete mode 100644 vendor/github.com/appc/spec/schema/types/isolator_resources.go delete mode 100644 vendor/github.com/appc/spec/schema/types/isolator_unix.go delete mode 100644 vendor/github.com/appc/spec/schema/types/labels.go delete mode 100644 vendor/github.com/appc/spec/schema/types/mountpoint.go delete mode 100644 vendor/github.com/appc/spec/schema/types/port.go delete mode 100644 vendor/github.com/appc/spec/schema/types/resource/README.md delete mode 100644 vendor/github.com/appc/spec/schema/types/resource/amount.go delete mode 100644 vendor/github.com/appc/spec/schema/types/resource/math.go delete mode 100644 vendor/github.com/appc/spec/schema/types/resource/quantity.go delete mode 100644 vendor/github.com/appc/spec/schema/types/resource/scale_int.go delete mode 100644 vendor/github.com/appc/spec/schema/types/resource/suffix.go delete mode 100644 vendor/github.com/appc/spec/schema/types/semver.go delete mode 100644 vendor/github.com/appc/spec/schema/types/url.go delete mode 100644 vendor/github.com/appc/spec/schema/types/user_annotations.go delete mode 100644 vendor/github.com/appc/spec/schema/types/user_labels.go delete mode 100644 vendor/github.com/appc/spec/schema/types/uuid.go delete mode 100644 vendor/github.com/appc/spec/schema/types/volume.go delete mode 100644 vendor/github.com/appc/spec/schema/version.go create mode 100644 vendor/github.com/armon/circbuf/.gitignore mode change 100755 => 100644 vendor/github.com/armon/circbuf/LICENSE create mode 100644 vendor/github.com/armon/go-metrics/.gitignore create mode 100644 vendor/github.com/armon/go-metrics/.travis.yml create mode 100644 vendor/github.com/armon/go-radix/.gitignore create mode 100644 vendor/github.com/armon/go-radix/.travis.yml create mode 100644 vendor/github.com/armon/go-radix/go.mod rename vendor/github.com/{hashicorp/go-discover/provider/aws/vendor/github.com => }/aws/aws-sdk-go/private/protocol/ec2query/build.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/aws/vendor/github.com => }/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/aws/vendor/github.com => }/aws/aws-sdk-go/service/ec2/api.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/aws/vendor/github.com => }/aws/aws-sdk-go/service/ec2/customizations.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/aws/vendor/github.com => }/aws/aws-sdk-go/service/ec2/doc.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/aws/vendor/github.com => }/aws/aws-sdk-go/service/ec2/errors.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/aws/vendor/github.com => }/aws/aws-sdk-go/service/ec2/service.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/aws/vendor/github.com => }/aws/aws-sdk-go/service/ec2/waiters.go (100%) create mode 100644 vendor/github.com/bgentry/speakeasy/.gitignore create mode 100644 vendor/github.com/bgentry/speakeasy/LICENSE create mode 100644 vendor/github.com/boltdb/bolt/.gitignore create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/AUTHORS rename vendor/github.com/{hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine => census-instrumentation/opencensus-proto}/LICENSE (100%) create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1/common.pb.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1/metrics_service.pb.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1/metrics_service.pb.gw.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.gw.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1/metrics.pb.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1/resource.pb.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace.pb.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace_config.pb.go create mode 100644 vendor/github.com/cespare/xxhash/v2/.travis.yml create mode 100644 vendor/github.com/cespare/xxhash/v2/LICENSE.txt create mode 100644 vendor/github.com/cespare/xxhash/v2/README.md create mode 100644 vendor/github.com/cespare/xxhash/v2/go.mod rename vendor/github.com/{godbus/dbus => cespare/xxhash/v2}/go.sum (100%) create mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash.go create mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go create mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s create mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_other.go create mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_safe.go create mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go create mode 100644 vendor/github.com/circonus-labs/circonus-gometrics/.gitignore create mode 100644 vendor/github.com/containerd/console/.travis.yml create mode 100644 vendor/github.com/containerd/continuity/AUTHORS delete mode 100644 vendor/github.com/containerd/continuity/pathdriver/path_driver.go mode change 100755 => 100644 vendor/github.com/containerd/continuity/sysx/generate.sh create mode 100644 vendor/github.com/containerd/go-cni/.travis.yml create mode 100644 vendor/github.com/coreos/go-semver/NOTICE delete mode 100644 vendor/github.com/creack/pty/Dockerfile.riscv delete mode 100644 vendor/github.com/creack/pty/LICENSE delete mode 100644 vendor/github.com/creack/pty/README.md delete mode 100644 vendor/github.com/creack/pty/doc.go delete mode 100644 vendor/github.com/creack/pty/go.mod delete mode 100644 vendor/github.com/creack/pty/ioctl.go delete mode 100644 vendor/github.com/creack/pty/ioctl_bsd.go delete mode 100644 vendor/github.com/creack/pty/ioctl_solaris.go delete mode 100755 vendor/github.com/creack/pty/mktypes.bash delete mode 100644 vendor/github.com/creack/pty/pty_darwin.go delete mode 100644 vendor/github.com/creack/pty/pty_dragonfly.go delete mode 100644 vendor/github.com/creack/pty/pty_freebsd.go delete mode 100644 vendor/github.com/creack/pty/pty_linux.go delete mode 100644 vendor/github.com/creack/pty/pty_openbsd.go delete mode 100644 vendor/github.com/creack/pty/pty_solaris.go delete mode 100644 vendor/github.com/creack/pty/pty_unsupported.go delete mode 100644 vendor/github.com/creack/pty/run.go delete mode 100755 vendor/github.com/creack/pty/test_crosscompile.sh delete mode 100644 vendor/github.com/creack/pty/util.go delete mode 100644 vendor/github.com/creack/pty/util_solaris.go delete mode 100644 vendor/github.com/creack/pty/ztypes_386.go delete mode 100644 vendor/github.com/creack/pty/ztypes_amd64.go delete mode 100644 vendor/github.com/creack/pty/ztypes_arm.go delete mode 100644 vendor/github.com/creack/pty/ztypes_arm64.go delete mode 100644 vendor/github.com/creack/pty/ztypes_dragonfly_amd64.go delete mode 100644 vendor/github.com/creack/pty/ztypes_freebsd_386.go delete mode 100644 vendor/github.com/creack/pty/ztypes_freebsd_amd64.go delete mode 100644 vendor/github.com/creack/pty/ztypes_freebsd_arm.go delete mode 100644 vendor/github.com/creack/pty/ztypes_freebsd_arm64.go delete mode 100644 vendor/github.com/creack/pty/ztypes_mipsx.go delete mode 100644 vendor/github.com/creack/pty/ztypes_openbsd_386.go delete mode 100644 vendor/github.com/creack/pty/ztypes_openbsd_amd64.go delete mode 100644 vendor/github.com/creack/pty/ztypes_ppc64.go delete mode 100644 vendor/github.com/creack/pty/ztypes_ppc64le.go delete mode 100644 vendor/github.com/creack/pty/ztypes_riscvx.go delete mode 100644 vendor/github.com/creack/pty/ztypes_s390x.go create mode 100644 vendor/github.com/cyphar/filepath-securejoin/.travis.yml rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/LICENSE.txt (100%) create mode 100644 vendor/github.com/denverdino/aliyungo/common/client.go create mode 100644 vendor/github.com/denverdino/aliyungo/common/endpoint.go rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/common/endpoints.xml (98%) create mode 100644 vendor/github.com/denverdino/aliyungo/common/regions.go create mode 100644 vendor/github.com/denverdino/aliyungo/common/request.go create mode 100644 vendor/github.com/denverdino/aliyungo/common/types.go rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/common/version.go (100%) create mode 100644 vendor/github.com/denverdino/aliyungo/ecs/client.go rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/disks.go (94%) create mode 100644 vendor/github.com/denverdino/aliyungo/ecs/eni.go rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/forward_entry.go (100%) create mode 100644 vendor/github.com/denverdino/aliyungo/ecs/images.go rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/instance_types.go (81%) create mode 100644 vendor/github.com/denverdino/aliyungo/ecs/instances.go rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/monitoring.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/nat_gateway.go (93%) rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/networks.go (80%) rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/regions.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/route_tables.go (97%) rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/router_interface.go (87%) rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/security_groups.go (89%) create mode 100644 vendor/github.com/denverdino/aliyungo/ecs/snapshots.go rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/snat_entry.go (96%) rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/ssh_key_pair.go (94%) rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/tags.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/vpcs.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/vrouters.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/ecs/vswitches.go (100%) create mode 100644 vendor/github.com/denverdino/aliyungo/ecs/zones.go rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/util/attempt.go (100%) create mode 100644 vendor/github.com/denverdino/aliyungo/util/encoding.go rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/util/iso6801.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/aliyun/vendor/github.com => }/denverdino/aliyungo/util/signature.go (99%) create mode 100644 vendor/github.com/denverdino/aliyungo/util/util.go create mode 100644 vendor/github.com/dgrijalva/jwt-go/.gitignore create mode 100644 vendor/github.com/dgrijalva/jwt-go/.travis.yml rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dgrijalva/jwt-go/LICENSE (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dgrijalva/jwt-go/MIGRATION_GUIDE.md (100%) create mode 100644 vendor/github.com/dgrijalva/jwt-go/README.md rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dgrijalva/jwt-go/VERSION_HISTORY.md (92%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dgrijalva/jwt-go/claims.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dgrijalva/jwt-go/doc.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dgrijalva/jwt-go/ecdsa.go (97%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dgrijalva/jwt-go/ecdsa_utils.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dgrijalva/jwt-go/errors.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dgrijalva/jwt-go/hmac.go (96%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dgrijalva/jwt-go/map_claims.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dgrijalva/jwt-go/none.go (100%) create mode 100644 vendor/github.com/dgrijalva/jwt-go/parser.go rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dgrijalva/jwt-go/rsa.go (91%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dgrijalva/jwt-go/rsa_pss.go (100%) create mode 100644 vendor/github.com/dgrijalva/jwt-go/rsa_utils.go rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dgrijalva/jwt-go/signing_method.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dgrijalva/jwt-go/token.go (100%) create mode 100644 vendor/github.com/digitalocean/godo/.gitignore create mode 100644 vendor/github.com/digitalocean/godo/.travis.yml create mode 100644 vendor/github.com/digitalocean/godo/CHANGELOG.md create mode 100644 vendor/github.com/digitalocean/godo/CONTRIBUTING.md rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/LICENSE.txt (100%) create mode 100644 vendor/github.com/digitalocean/godo/README.md create mode 100644 vendor/github.com/digitalocean/godo/account.go rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/action.go (98%) create mode 100644 vendor/github.com/digitalocean/godo/cdn.go rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/certificates.go (79%) create mode 100644 vendor/github.com/digitalocean/godo/databases.go create mode 100644 vendor/github.com/digitalocean/godo/doc.go rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/domains.go (93%) rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/droplet_actions.go (97%) rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/droplets.go (99%) rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/errors.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/firewalls.go (99%) rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/floating_ips.go (97%) rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/floating_ips_actions.go (98%) rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/godo.go (91%) rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/image_actions.go (98%) create mode 100644 vendor/github.com/digitalocean/godo/images.go create mode 100644 vendor/github.com/digitalocean/godo/keys.go create mode 100644 vendor/github.com/digitalocean/godo/kubernetes.go rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/links.go (97%) rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/load_balancers.go (87%) create mode 100644 vendor/github.com/digitalocean/godo/projects.go create mode 100644 vendor/github.com/digitalocean/godo/regions.go create mode 100644 vendor/github.com/digitalocean/godo/sizes.go create mode 100644 vendor/github.com/digitalocean/godo/snapshots.go create mode 100644 vendor/github.com/digitalocean/godo/storage.go rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/storage_actions.go (99%) rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/strings.go (87%) create mode 100644 vendor/github.com/digitalocean/godo/tags.go rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/digitalocean/godo/timestamp.go (100%) create mode 100644 vendor/github.com/dimchansky/utfbom/.gitignore create mode 100644 vendor/github.com/dimchansky/utfbom/.travis.yml rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dimchansky/utfbom/LICENSE (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dimchansky/utfbom/README.md (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dimchansky/utfbom/go.mod (100%) rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/dimchansky/utfbom/utfbom.go (100%) create mode 100644 vendor/github.com/docker/cli/AUTHORS create mode 100644 vendor/github.com/docker/distribution/.gitignore create mode 100644 vendor/github.com/docker/distribution/.gometalinter.json create mode 100644 vendor/github.com/docker/distribution/.mailmap create mode 100644 vendor/github.com/docker/distribution/.travis.yml create mode 100644 vendor/github.com/docker/docker/AUTHORS create mode 100644 vendor/github.com/docker/docker/api/types/error_response_ext.go create mode 100644 vendor/github.com/docker/docker/oci/caps/defaults.go delete mode 100644 vendor/github.com/docker/docker/opts/address_pools.go delete mode 100644 vendor/github.com/docker/docker/opts/env.go delete mode 100644 vendor/github.com/docker/docker/opts/hosts.go delete mode 100644 vendor/github.com/docker/docker/opts/hosts_unix.go delete mode 100644 vendor/github.com/docker/docker/opts/hosts_windows.go delete mode 100644 vendor/github.com/docker/docker/opts/ip.go delete mode 100644 vendor/github.com/docker/docker/opts/opts.go delete mode 100644 vendor/github.com/docker/docker/opts/opts_unix.go delete mode 100644 vendor/github.com/docker/docker/opts/opts_windows.go delete mode 100644 vendor/github.com/docker/docker/opts/quotedstring.go delete mode 100644 vendor/github.com/docker/docker/opts/runtime.go delete mode 100644 vendor/github.com/docker/docker/opts/ulimit.go delete mode 100644 vendor/github.com/docker/docker/volume/mounts/lcow_parser.go delete mode 100644 vendor/github.com/docker/docker/volume/mounts/linux_parser.go delete mode 100644 vendor/github.com/docker/docker/volume/mounts/mounts.go delete mode 100644 vendor/github.com/docker/docker/volume/mounts/parser.go delete mode 100644 vendor/github.com/docker/docker/volume/mounts/validate.go delete mode 100644 vendor/github.com/docker/docker/volume/mounts/volume_copy.go delete mode 100644 vendor/github.com/docker/docker/volume/mounts/volume_unix.go delete mode 100644 vendor/github.com/docker/docker/volume/mounts/volume_windows.go delete mode 100644 vendor/github.com/docker/docker/volume/mounts/windows_parser.go delete mode 100644 vendor/github.com/docker/docker/volume/volume.go delete mode 100644 vendor/github.com/docker/go-connections/sockets/README.md delete mode 100644 vendor/github.com/docker/go-connections/sockets/inmem_socket.go delete mode 100644 vendor/github.com/docker/go-connections/sockets/proxy.go delete mode 100644 vendor/github.com/docker/go-connections/sockets/sockets.go delete mode 100644 vendor/github.com/docker/go-connections/sockets/sockets_unix.go delete mode 100644 vendor/github.com/docker/go-connections/sockets/sockets_windows.go delete mode 100644 vendor/github.com/docker/go-connections/sockets/tcp_socket.go delete mode 100644 vendor/github.com/docker/go-connections/sockets/unix_socket.go rename vendor/github.com/docker/go-units/{LICENSE.code => LICENSE} (100%) delete mode 100644 vendor/github.com/docker/go-units/LICENSE.docs delete mode 100644 vendor/github.com/docker/libnetwork/LICENSE delete mode 100644 vendor/github.com/docker/libnetwork/ipamutils/utils.go create mode 100644 vendor/github.com/dustin/go-humanize/.travis.yml create mode 100644 vendor/github.com/dustin/go-humanize/commaf.go delete mode 100644 vendor/github.com/fatih/color/Gopkg.lock delete mode 100644 vendor/github.com/fatih/color/Gopkg.toml create mode 100644 vendor/github.com/fatih/color/go.mod create mode 100644 vendor/github.com/fatih/color/go.sum create mode 100644 vendor/github.com/fsouza/go-dockerclient/.gitattributes create mode 100644 vendor/github.com/fsouza/go-dockerclient/.gitignore create mode 100644 vendor/github.com/fsouza/go-dockerclient/.golangci.yaml create mode 100644 vendor/github.com/go-ole/go-ole/.travis.yml create mode 100644 vendor/github.com/go-ole/go-ole/LICENSE create mode 100644 vendor/github.com/godbus/dbus/.travis.yml delete mode 100644 vendor/github.com/godbus/dbus/match.go create mode 100644 vendor/github.com/gogo/protobuf/AUTHORS create mode 100644 vendor/github.com/gogo/protobuf/CONTRIBUTORS create mode 100644 vendor/github.com/gogo/protobuf/proto/custom_gogo.go delete mode 100644 vendor/github.com/gogo/protobuf/proto/decode_gogo.go rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com/golang => gogo}/protobuf/proto/deprecated.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com/golang => gogo}/protobuf/proto/discard.go (98%) create mode 100644 vendor/github.com/gogo/protobuf/proto/pointer_reflect.go create mode 100644 vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com/golang => gogo}/protobuf/proto/table_marshal.go (90%) create mode 100644 vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com/golang => gogo}/protobuf/proto/table_merge.go (94%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com/golang => gogo}/protobuf/proto/table_unmarshal.go (86%) create mode 100644 vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go create mode 100644 vendor/github.com/gogo/protobuf/proto/wrappers.go create mode 100644 vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2 => golang/protobuf}/AUTHORS (100%) rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2 => golang/protobuf}/CONTRIBUTORS (100%) create mode 100644 vendor/github.com/golang/protobuf/jsonpb/jsonpb.go create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/doc.go create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/generator/internal/remap/remap.go create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/grpc/grpc.go create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/link_grpc.go create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/main.go create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.golden create mode 100644 vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.proto create mode 100644 vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go create mode 100644 vendor/github.com/golang/protobuf/ptypes/struct/struct.proto create mode 100644 vendor/github.com/golang/snappy/.gitignore create mode 100644 vendor/github.com/golang/snappy/go.mod create mode 100644 vendor/github.com/google/btree/.travis.yml delete mode 100644 vendor/github.com/google/go-cmp/cmp/cmpopts/sort_go17.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/cmpopts/sort_go18.go create mode 100644 vendor/github.com/google/go-cmp/cmp/cmpopts/xform.go create mode 100644 vendor/github.com/google/go-cmp/cmp/export_panic.go create mode 100644 vendor/github.com/google/go-cmp/cmp/export_unsafe.go create mode 100644 vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go create mode 100644 vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go create mode 100644 vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/internal/value/format.go create mode 100644 vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go create mode 100644 vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go create mode 100644 vendor/github.com/google/go-cmp/cmp/internal/value/zero.go create mode 100644 vendor/github.com/google/go-cmp/cmp/report.go create mode 100644 vendor/github.com/google/go-cmp/cmp/report_compare.go create mode 100644 vendor/github.com/google/go-cmp/cmp/report_reflect.go create mode 100644 vendor/github.com/google/go-cmp/cmp/report_slices.go create mode 100644 vendor/github.com/google/go-cmp/cmp/report_text.go create mode 100644 vendor/github.com/google/go-cmp/cmp/report_value.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/reporter.go delete mode 100644 vendor/github.com/google/go-cmp/cmp/unsafe_reflect.go rename vendor/github.com/{hashicorp/go-discover/provider/digitalocean/vendor/github.com => }/google/go-querystring/query/encode.go (100%) rename vendor/github.com/googleapis/gax-go/{ => v2}/LICENSE (100%) create mode 100644 vendor/github.com/gophercloud/gophercloud/.gitignore create mode 100644 vendor/github.com/gophercloud/gophercloud/.travis.yml create mode 100644 vendor/github.com/gophercloud/gophercloud/.zuul.yaml rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/CHANGELOG.md (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/LICENSE (100%) create mode 100644 vendor/github.com/gophercloud/gophercloud/README.md rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/auth_options.go (87%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/doc.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/endpoint_search.go (100%) create mode 100644 vendor/github.com/gophercloud/gophercloud/errors.go create mode 100644 vendor/github.com/gophercloud/gophercloud/openstack/auth_env.go create mode 100644 vendor/github.com/gophercloud/gophercloud/openstack/client.go create mode 100644 vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/doc.go create mode 100644 vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/requests.go create mode 100644 vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/results.go create mode 100644 vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/urls.go rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/compute/v2/images/doc.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/compute/v2/images/requests.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/compute/v2/images/results.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/compute/v2/images/urls.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/compute/v2/servers/doc.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/compute/v2/servers/errors.go (100%) create mode 100644 vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go create mode 100644 vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/results.go rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/compute/v2/servers/urls.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/compute/v2/servers/util.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/doc.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/endpoint_location.go (97%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/errors.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/identity/v2/tenants/doc.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/identity/v2/tenants/requests.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/identity/v2/tenants/results.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/identity/v2/tenants/urls.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/identity/v2/tokens/doc.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/identity/v2/tokens/requests.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/identity/v2/tokens/results.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/identity/v2/tokens/urls.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/identity/v3/tokens/doc.go (100%) create mode 100644 vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/requests.go create mode 100644 vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/results.go rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/identity/v3/tokens/urls.go (100%) create mode 100644 vendor/github.com/gophercloud/gophercloud/openstack/utils/base_endpoint.go rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/openstack/utils/choose_version.go (77%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/pagination/http.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/pagination/linked.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/pagination/marker.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/pagination/pager.go (91%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/pagination/pkg.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/pagination/single.go (100%) create mode 100644 vendor/github.com/gophercloud/gophercloud/params.go create mode 100644 vendor/github.com/gophercloud/gophercloud/provider_client.go create mode 100644 vendor/github.com/gophercloud/gophercloud/results.go rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/service_client.go (80%) rename vendor/github.com/{hashicorp/go-discover/provider/os/vendor/github.com => }/gophercloud/gophercloud/util.go (100%) delete mode 100644 vendor/github.com/gorilla/context/LICENSE delete mode 100644 vendor/github.com/gorilla/context/README.md delete mode 100644 vendor/github.com/gorilla/context/context.go delete mode 100644 vendor/github.com/gorilla/context/doc.go delete mode 100644 vendor/github.com/gorilla/mux/ISSUE_TEMPLATE.md delete mode 100644 vendor/github.com/gorilla/mux/context_gorilla.go delete mode 100644 vendor/github.com/gorilla/mux/context_native.go create mode 100644 vendor/github.com/gorilla/websocket/.gitignore create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/internal/BUILD.bazel create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/internal/stream_chunk.pb.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/internal/stream_chunk.proto create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/BUILD.bazel create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/convert.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/doc.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/errors.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/fieldmask.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/handler.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_httpbodyproto.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_proto.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler_registry.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto2_convert.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto_errors.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/BUILD.bazel create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/doc.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/pattern.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/readerfactory.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/trie.go delete mode 100644 vendor/github.com/hashicorp/consul-template/CHANGELOG.md delete mode 100644 vendor/github.com/hashicorp/consul-template/Makefile delete mode 100644 vendor/github.com/hashicorp/consul-template/README.md delete mode 100644 vendor/github.com/hashicorp/consul-template/cli.go delete mode 100644 vendor/github.com/hashicorp/consul-template/flags.go delete mode 100644 vendor/github.com/hashicorp/consul-template/go.mod delete mode 100644 vendor/github.com/hashicorp/consul-template/go.sum delete mode 100644 vendor/github.com/hashicorp/consul-template/logging/logging.go delete mode 100644 vendor/github.com/hashicorp/consul-template/logging/syslog.go delete mode 100644 vendor/github.com/hashicorp/consul-template/main.go create mode 100644 vendor/github.com/hashicorp/consul/api/LICENSE create mode 100644 vendor/github.com/hashicorp/consul/sdk/LICENSE create mode 100644 vendor/github.com/hashicorp/errwrap/go.mod create mode 100644 vendor/github.com/hashicorp/go-cleanhttp/go.mod create mode 100644 vendor/github.com/hashicorp/go-cleanhttp/handlers.go create mode 100644 vendor/github.com/hashicorp/go-discover/.gitignore create mode 100644 vendor/github.com/hashicorp/go-discover/.travis.yml delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/README.md delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/common/client.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/common/endpoint.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/common/regions.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/common/request.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/common/types.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/client.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/images.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/instances.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/snapshots.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/zones.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/util/encoding.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/util/util.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/vendor.json delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/NOTICE.txt delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/awsutil/copy.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/awsutil/path_value.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/awsutil/prettify.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/awsutil/string_value.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/client/client.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/client/metadata/client_info.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/client/no_op_retryer.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/config.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/context_1_5.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/context_1_9.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/context_background_1_5.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/context_background_1_7.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/context_sleep.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/convert_types.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/param_validator.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/user_agent.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/credentials/chain_provider.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds/ec2_role_provider.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/credentials/endpointcreds/provider.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/credentials/env_provider.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/credentials/example.ini delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/credentials/processcreds/provider.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/credentials/shared_credentials_provider.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/credentials/static_provider.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/web_identity_provider.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/csm/doc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/csm/enable.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/csm/metric.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_chan.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_exception.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/defaults/shared_config.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/doc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/token_provider.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/endpoints/dep_service_ids.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/endpoints/doc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/endpoints/legacy_regions.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/endpoints/v3model_codegen.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/errors.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/jsonvalue.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/logger.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/request/http_request.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/request/offset_reader.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/request/request.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/request/request_context.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/request/request_context_1_6.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/request/timeout_read_closer.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/request/waiter.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_5.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_6.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/session/session.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/session/shared_config.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/header_rules.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/options.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/uri_path.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/types.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/url.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/url_1_7.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/aws/version.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/ast.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/comma_token.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/comment_token.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/doc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/empty_token.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/expression.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/fuzz.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/ini.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_lexer.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/literal_tokens.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/newline_token.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/number_helper.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/op_tokens.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_error.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_stack.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/sep_tokens.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/skipper.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/statement.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/value_util.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/visitor.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/walker.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/ini/ws_token.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/sdkio/byte.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.6.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/sdkio/io_go1.7.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/sdkmath/floor_go1.9.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/locked_source.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/read_1_5.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/sdkuri/path.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/ecs_container.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/shared_config.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/host.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/host_prefix.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/idempotency.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/build.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/payload.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/query/queryutil/queryutil.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_error.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/payload.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/timestamp.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/unmarshal.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/build.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/sort.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/unmarshal.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil/xml_to_struct.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/sts/api.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/sts/doc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/sts/service.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/sts/stsiface/interface.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/go-ini/ini/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/go-ini/ini/Makefile delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/go-ini/ini/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/go-ini/ini/README_ZH.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/go-ini/ini/error.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/go-ini/ini/ini.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/go-ini/ini/key.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/go-ini/ini/parser.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/go-ini/ini/section.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/go-ini/ini/struct.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/jmespath/go-jmespath/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/jmespath/go-jmespath/Makefile delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/jmespath/go-jmespath/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/jmespath/go-jmespath/api.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/jmespath/go-jmespath/astnodetype_string.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/jmespath/go-jmespath/functions.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/jmespath/go-jmespath/interpreter.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/jmespath/go-jmespath/lexer.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/jmespath/go-jmespath/parser.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/jmespath/go-jmespath/toktype_string.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/jmespath/go-jmespath/util.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/aws/vendor/vendor.json delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/client.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/version/version.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/adal/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/adal/config.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/adal/go.mod delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/adal/go.sum delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/adal/go_mod_tidy_hack.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/adal/token.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/authorization_sas.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/authorization_storage.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/auth/go.mod delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/auth/go.sum delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/auth/go_mod_tidy_hack.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/cli/go.mod delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/cli/go.sum delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/cli/go_mod_tidy_hack.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/cli/token.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/client.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/date/go.mod delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/date/go.sum delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/date/go_mod_tidy_hack.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/go.mod delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/go.sum delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/sender.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/to/convert.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/to/go.mod delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/to/go.sum delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/to/go_mod_tidy_hack.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/validation/go.mod delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/validation/go.sum delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/validation/go_mod_tidy_hack.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/version.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/logger/go.mod delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/tracing/go.mod delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/tracing/tracing.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/parser.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/mitchellh/go-homedir/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/mitchellh/go-homedir/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/mitchellh/go-homedir/homedir.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/azure/vendor/vendor.json delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/CHANGELOG.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/CONTRIBUTING.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/account.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/context/context.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/context/context_go17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/context/context_pre_go17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/doc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/images.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/keys.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/regions.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/sizes.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/snapshots.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/storage.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/tags.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/golang/protobuf/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/golang/protobuf/proto/Makefile delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/golang/protobuf/proto/clone.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/golang/protobuf/proto/decode.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/golang/protobuf/proto/encode.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/golang/protobuf/proto/equal.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/golang/protobuf/proto/extensions.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/golang/protobuf/proto/lib.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/golang/protobuf/proto/message_set.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/golang/protobuf/proto/pointer_reflect.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/golang/protobuf/proto/properties.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/golang/protobuf/proto/text.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/golang/protobuf/proto/text_parser.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/google/go-querystring/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/tent/http-link-go/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/tent/http-link-go/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/tent/http-link-go/link.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/net/context/context.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/net/context/go17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/net/context/go19.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/net/context/pre_go17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/net/context/pre_go19.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2/CONTRIBUTING.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2/client_appengine.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2/internal/oauth2.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2/internal/token.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2/internal/transport.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2/oauth2.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2/token.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2/transport.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/internal/api.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/internal/api_classic.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/internal/base/api_base.pb.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/internal/identity.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/internal/identity_classic.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/internal/identity_vm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/internal/log/log_service.pb.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/internal/main.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/internal/main_vm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/internal/metadata.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/internal/transaction.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/vendor.json delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/cloud.google.com/go/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/cloud.google.com/go/compute/metadata/metadata.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/cloud.google.com/go/internal/cloud.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/cloud.google.com/go/internal/retry.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/golang/protobuf/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/golang/protobuf/proto/Makefile delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/golang/protobuf/proto/clone.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/golang/protobuf/proto/decode.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/golang/protobuf/proto/encode.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/golang/protobuf/proto/equal.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/golang/protobuf/proto/extensions.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/golang/protobuf/proto/lib.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/golang/protobuf/proto/message_set.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/golang/protobuf/proto/pointer_reflect.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/golang/protobuf/proto/properties.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/golang/protobuf/proto/text.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/golang/protobuf/proto/text_parser.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/googleapis/gax-go/CONTRIBUTING.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/googleapis/gax-go/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/googleapis/gax-go/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/googleapis/gax-go/call_option.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/googleapis/gax-go/gax.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/googleapis/gax-go/invoke.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/googleapis/gax-go/path_template.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/github.com/googleapis/gax-go/path_template_parser.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/context/context.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/context/go17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/context/pre_go17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/Dockerfile delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/Makefile delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/README delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/client_conn_pool.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/configure_transport.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/errors.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/fixed_buffer.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/flow.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/frame.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/go16.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/go17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/go17_not18.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/go18.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/gotrack.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/headermap.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/hpack/encode.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/hpack/hpack.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/hpack/huffman.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/hpack/tables.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/http2.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/not_go16.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/not_go17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/not_go18.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/pipe.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/server.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/transport.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/write.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/writesched.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/writesched_priority.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/http2/writesched_random.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/idna/idna.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/idna/punycode.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/idna/tables.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/idna/trie.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/idna/trieval.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/internal/timeseries/timeseries.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/lex/httplex/httplex.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/trace/events.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/trace/histogram.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net/trace/trace.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/CONTRIBUTING.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/client_appengine.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/google/appengine.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/google/appengine_hook.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/google/appenginevm_hook.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/google/default.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/google/google.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/google/jwt.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/google/sdk.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/internal/oauth2.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/internal/token.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/internal/transport.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/jws/jws.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/jwt/jwt.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/oauth2.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/token.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2/transport.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/secure/bidirule/bidirule.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/transform/transform.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/unicode/bidi/bidi.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/unicode/bidi/bracket.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/unicode/bidi/core.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/unicode/bidi/prop.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/unicode/bidi/tables.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/unicode/bidi/trieval.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/unicode/norm/composition.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/unicode/norm/forminfo.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/unicode/norm/input.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/unicode/norm/iter.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/unicode/norm/normalize.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/unicode/norm/readwriter.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/unicode/norm/tables.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/unicode/norm/transform.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text/unicode/norm/trie.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/compute/v1/compute-api.json delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/compute/v1/compute-gen.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/gensupport/backoff.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/gensupport/buffer.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/gensupport/json.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/gensupport/jsonfloat.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/gensupport/media.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/gensupport/params.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/gensupport/resumable.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/gensupport/retry.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/gensupport/send.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/googleapi/googleapi.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/googleapi/internal/uritemplates/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/googleapi/internal/uritemplates/uritemplates.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/googleapi/internal/uritemplates/utils.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api/googleapi/types.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/appengine.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/api.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/api_classic.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/api_common.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/app_id.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.pb.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/base/api_base.pb.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/base/api_base.proto delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/identity.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/identity_classic.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/identity_vm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/internal.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/log/log_service.pb.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/log/log_service.proto delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/main.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/main_vm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/metadata.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/modules/modules_service.pb.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/net.go delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/regen.sh delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/transaction.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/urlfetch/urlfetch.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/CONTRIBUTING.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/Makefile delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/PATENTS delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/backoff.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/balancer.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/call.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/clientconn.go delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/codegen.sh delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/codes/code_string.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/codes/codes.go delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/coverage.sh delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/credentials/credentials.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/doc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/grpclog/logger.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/interceptor.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/internal/internal.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/metadata/metadata.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/naming/naming.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/peer/peer.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/rpc_util.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/server.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/stats/handlers.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/stats/stats.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/stream.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/tap/tap.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/trace.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/transport/control.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/transport/go16.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/transport/go17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/transport/handler_server.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/transport/http2_client.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/transport/http2_server.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/transport/http_util.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/transport/pre_go16.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/grpc/transport/transport.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/gce/vendor/vendor.json delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/k8s/k8s_discover.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/clone.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/decode.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/encode.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/equal.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/extensions.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/lib.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/message_set.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/pointer_reflect.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/properties.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/text.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/text_parser.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/net/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/net/PATENTS delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/net/context/context.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/net/context/go17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/net/context/go19.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/net/context/pre_go17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/net/context/pre_go19.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/net/publicsuffix/table.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/oauth2/CONTRIBUTING.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/oauth2/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/oauth2/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/oauth2/client_appengine.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/oauth2/internal/oauth2.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/oauth2/internal/token.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/oauth2/internal/transport.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/oauth2/oauth2.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/oauth2/token.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/oauth2/transport.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/google.golang.org/appengine/internal/api_common.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/google.golang.org/appengine/internal/app_id.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/google.golang.org/appengine/internal/base/api_base.proto delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/google.golang.org/appengine/internal/internal.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/google.golang.org/appengine/internal/log/log_service.proto delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/google.golang.org/appengine/internal/net.go delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/google.golang.org/appengine/internal/regen.sh delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/google.golang.org/appengine/urlfetch/urlfetch.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/linode/vendor/vendor.json delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/AUTHORS delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/CONTRIBUTORS delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/COPYRIGHT delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/Gopkg.lock delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/Gopkg.toml delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/client.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/clientconfig.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/compress_generate.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/defaults.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/dns.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/dnssec.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/dnssec_keygen.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/dnssec_keyscan.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/dnssec_privkey.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/doc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/duplicate.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/duplicate_generate.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/edns.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/format.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/fuzz.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/labels.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/msg.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/msg_generate.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/nsecx.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/privaterr.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/rawmsg.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/reverse.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/sanitize.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/scan_rr.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/server.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/sig0.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/singleinflight.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/tlsa.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/tsig.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/types.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/types_generate.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/udp.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/udp_windows.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/update.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/version.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/xfr.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/zcompress.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/zduplicate.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/zmsg.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/github.com/miekg/dns/ztypes.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/crypto/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/crypto/PATENTS delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/crypto/ed25519/ed25519.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/const.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/PATENTS delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/iovec_64bit.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/rawconn_stub.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/reflect.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/sys_bsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/sys_bsdvar.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/sys_dragonfly.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/sys_stub.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/zsys_linux_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/batch.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/control_stub.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/control_unix.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/control_windows.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/dgramopt.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/doc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/endpoint.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/genericopt.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/helper.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/packet.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/packet_go1_8.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/packet_go1_9.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/payload_cmsg.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/payload_cmsg_go1_8.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/payload_cmsg_go1_9.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/payload_nocmsg.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/sockopt_posix.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/sockopt_stub.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/sys_asmreq.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/sys_bpf.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/sys_darwin.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/sys_freebsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/sys_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/sys_ssmreq.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/sys_stub.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_darwin.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_dragonfly.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_linux_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_linux_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_linux_mips.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_netbsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_openbsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv4/zsys_solaris.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/batch.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/control_stub.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/control_unix.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/control_windows.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/dgramopt.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/endpoint.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/genericopt.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/helper.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/payload_cmsg.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/payload_cmsg_go1_8.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/payload_cmsg_go1_9.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/payload_nocmsg.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/sockopt_posix.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/sockopt_stub.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/sys_asmreq.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/sys_asmreq_stub.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/sys_bpf.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/sys_bpf_stub.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/sys_darwin.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/sys_freebsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/sys_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/sys_ssmreq.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/sys_ssmreq_stub.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/sys_stub.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_darwin.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_dragonfly.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_freebsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_freebsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_freebsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_linux_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_linux_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_linux_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_linux_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_linux_mips.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_linux_mips64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_linux_mips64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_linux_mipsle.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_linux_ppc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_linux_s390x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_netbsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_openbsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/net/ipv6/zsys_solaris.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/PATENTS delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/affinity_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/aliases.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_aix_ppc64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_darwin_386.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_darwin_arm.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_freebsd_386.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_linux_386.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_linux_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_linux_arm.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_linux_arm64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_linux_s390x.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_netbsd_386.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_openbsd_386.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/bluetooth_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/cap_freebsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/constants.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/dev_aix_ppc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/dev_darwin.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/dev_dragonfly.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/dev_freebsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/dev_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/dev_netbsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/dev_openbsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/dirent.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/endian_big.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/endian_little.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/env_unix.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/errors_freebsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/fcntl.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/gccgo.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/gccgo_c.c delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ioctl.go delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/mkall.sh delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/mkerrors.sh delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/mksyscall.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/mksysnum_darwin.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/openbsd_pledge.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/openbsd_unveil.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/pagesize_unix.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/race.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/race0.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/sockcmsg_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/sockcmsg_unix.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/str.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_aix.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_bsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_darwin.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_darwin_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_dragonfly.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_freebsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux_gc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux_gc_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux_riscv64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_netbsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_openbsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_solaris.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_unix.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/syscall_unix_gc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/timestruct.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/xattr_bsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_aix_ppc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_linux_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zptrace386_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zptracearm_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zptracemips_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zptracemipsle_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_aix_ppc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_linux_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/mdns/vendor/vendor.json delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/FAQ.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/MIGRATING.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/STYLEGUIDE.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/errors.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/auth_env.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/client.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/doc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/requests.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/results.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/urls.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/results.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/requests.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/results.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/params.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/provider_client.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/results.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/os/vendor/vendor.json delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/packet/vendor/vendor.json delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/scaleway/vendor/github.com/nicolai86/scaleway-sdk/api.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/scaleway/vendor/golang.org/x/net/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/scaleway/vendor/golang.org/x/net/PATENTS delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/scaleway/vendor/golang.org/x/net/context/context.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/scaleway/vendor/golang.org/x/net/context/go17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/scaleway/vendor/golang.org/x/net/context/go19.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/scaleway/vendor/golang.org/x/net/context/pre_go17.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/scaleway/vendor/golang.org/x/net/context/pre_go19.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/scaleway/vendor/golang.org/x/sync/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/scaleway/vendor/golang.org/x/sync/PATENTS delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/scaleway/vendor/golang.org/x/sync/errgroup/errgroup.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/scaleway/vendor/vendor.json delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/datatypes/account.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/datatypes/billing.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/datatypes/brand.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/datatypes/hardware.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/datatypes/locale.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/datatypes/location.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/datatypes/network.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/datatypes/product.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/datatypes/ticket.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/datatypes/user.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/datatypes/virtual.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/services/account.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/services/billing.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/services/brand.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/services/hardware.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/services/locale.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/services/location.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/services/network.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/services/product.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/services/ticket.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/services/user.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/services/virtual.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/session/rest.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/session/session.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go/session/xmlrpc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/golang.org/x/text/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/golang.org/x/text/PATENTS delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/golang.org/x/text/encoding/charmap/charmap.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/golang.org/x/text/encoding/charmap/tables.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/golang.org/x/text/encoding/encoding.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/golang.org/x/text/encoding/internal/identifier/mib.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/golang.org/x/text/encoding/internal/internal.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/golang.org/x/text/transform/transform.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/softlayer/vendor/vendor.json delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/tencentcloud/vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/tencentcloud/vendor/vendor.json delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/github.com/joyent/triton-go/CHANGELOG.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/github.com/joyent/triton-go/GNUmakefile delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/github.com/joyent/triton-go/Gopkg.lock delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/github.com/joyent/triton-go/Gopkg.toml delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/github.com/joyent/triton-go/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/github.com/joyent/triton-go/client/client.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/github.com/joyent/triton-go/compute/client.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/github.com/joyent/triton-go/compute/instances.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/github.com/joyent/triton-go/version.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/github.com/pkg/errors/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/github.com/pkg/errors/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/github.com/pkg/errors/appveyor.yml delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/github.com/pkg/errors/errors.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/github.com/pkg/errors/stack.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/PATENTS delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/curve25519/const_amd64.h delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/curve25519/const_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/curve25519/cswap_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/curve25519/curve25519.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/curve25519/doc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/curve25519/freeze_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/curve25519/ladderstep_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/curve25519/mont25519_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/curve25519/mul_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/curve25519/square_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/ed25519/ed25519.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/const.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/ed25519/internal/edwards25519/edwards25519.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/internal/chacha20/chacha_generic.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/poly1305/poly1305.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/poly1305/sum_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/poly1305/sum_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/poly1305/sum_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/poly1305/sum_arm.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/poly1305/sum_ref.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/ssh/agent/client.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/ssh/agent/server.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/ssh/cipher.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/ssh/client.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/ssh/common.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/ssh/kex.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/ssh/keys.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/ssh/server.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/golang.org/x/crypto/ssh/transport.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/triton/vendor/vendor.json delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/pkg/errors/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/pkg/errors/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/pkg/errors/appveyor.yml delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/pkg/errors/errors.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/pkg/errors/stack.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/CHANGELOG.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/alt_exit.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/appveyor.yml delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/doc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/entry.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/exported.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/formatter.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/hooks.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/json_formatter.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/logger.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/logrus.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/terminal_bsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/terminal_check_appengine.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/terminal_check_notappengine.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/terminal_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/text_formatter.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/sirupsen/logrus/writer.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/crypto/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/crypto/PATENTS delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/crypto/ssh/terminal/terminal.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/crypto/ssh/terminal/util.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/crypto/ssh/terminal/util_bsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/crypto/ssh/terminal/util_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/crypto/ssh/terminal/util_plan9.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/crypto/ssh/terminal/util_solaris.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/LICENSE delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/PATENTS delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/README.md delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/affinity_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_darwin_386.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_darwin_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_darwin_arm.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_darwin_arm64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_freebsd_386.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_freebsd_arm.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_linux_386.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_linux_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_linux_arm.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_linux_arm64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_linux_mips64x.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_linux_mipsx.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_linux_s390x.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_netbsd_386.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_netbsd_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_netbsd_arm.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_openbsd_386.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_openbsd_arm.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/asm_solaris_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/bluetooth_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/cap_freebsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/constants.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/dev_darwin.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/dev_dragonfly.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/dev_freebsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/dev_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/dev_netbsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/dev_openbsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/dirent.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/endian_big.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/endian_little.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/env_unix.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/errors_freebsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/errors_freebsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/errors_freebsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/fcntl.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/gccgo.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/gccgo_c.c delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/mkall.sh delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/mkerrors.sh delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/mksyscall.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/mksyscall_solaris.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/mksysctl_openbsd.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/mksysnum_darwin.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl delete mode 100755 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/openbsd_pledge.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/pagesize_unix.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/race.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/race0.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/sockcmsg_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/sockcmsg_unix.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/str.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_bsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_darwin.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_darwin_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_darwin_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_dragonfly.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_freebsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_linux_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_linux_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_linux_gc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_linux_gccgo.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_linux_s390x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_linux_sparc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_netbsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_netbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_netbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_openbsd.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_openbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_openbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_solaris.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_solaris_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_unix.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/syscall_unix_gc.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/timestruct.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_darwin_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_linux_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_netbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_openbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zptrace386_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zptracearm_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zptracemips_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zptracemipsle_linux.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_darwin_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_darwin_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_darwin_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_darwin_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_linux_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_netbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_openbsd_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/asm_windows_386.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/asm_windows_amd64.s delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/dll_windows.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/env_windows.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/eventlog.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/exec_windows.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/memory_windows.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/mksyscall.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/race.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/race0.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/security_windows.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/service.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/str.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/syscall.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/syscall_windows.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/types_windows.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/types_windows_386.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/types_windows_amd64.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/golang.org/x/sys/windows/zsyscall_windows.go delete mode 100644 vendor/github.com/hashicorp/go-discover/provider/vsphere/vendor/vendor.json create mode 100644 vendor/github.com/hashicorp/go-envparse/.appveyor.yml create mode 100644 vendor/github.com/hashicorp/go-envparse/.gitignore create mode 100644 vendor/github.com/hashicorp/go-envparse/.travis.yml create mode 100644 vendor/github.com/hashicorp/go-getter/.travis.yml create mode 100644 vendor/github.com/hashicorp/go-getter/appveyor.yml create mode 100644 vendor/github.com/hashicorp/go-hclog/.gitignore create mode 100644 vendor/github.com/hashicorp/go-immutable-radix/.gitignore create mode 100644 vendor/github.com/hashicorp/go-memdb/.gitignore mode change 100755 => 100644 vendor/github.com/hashicorp/go-msgpack/codec/build.sh mode change 100755 => 100644 vendor/github.com/hashicorp/go-msgpack/codec/test.py create mode 100644 vendor/github.com/hashicorp/go-multierror/.travis.yml create mode 100644 vendor/github.com/hashicorp/go-plugin/.gitignore create mode 100644 vendor/github.com/hashicorp/go-retryablehttp/.gitignore create mode 100644 vendor/github.com/hashicorp/go-retryablehttp/.travis.yml create mode 100644 vendor/github.com/hashicorp/go-rootcerts/.travis.yml create mode 100644 vendor/github.com/hashicorp/go-safetemp/go.mod create mode 100644 vendor/github.com/hashicorp/go-sockaddr/.gitignore create mode 100644 vendor/github.com/hashicorp/go-sockaddr/go.mod create mode 100644 vendor/github.com/hashicorp/go-sockaddr/go.sum create mode 100644 vendor/github.com/hashicorp/go-sockaddr/route_info_android.go create mode 100644 vendor/github.com/hashicorp/go-syslog/.gitignore create mode 100644 vendor/github.com/hashicorp/go-uuid/.travis.yml create mode 100644 vendor/github.com/hashicorp/golang-lru/.gitignore create mode 100644 vendor/github.com/hashicorp/golang-lru/doc.go create mode 100644 vendor/github.com/hashicorp/golang-lru/go.mod create mode 100644 vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go create mode 100644 vendor/github.com/hashicorp/hcl/.gitignore create mode 100644 vendor/github.com/hashicorp/hcl/.travis.yml delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/nodes.go delete mode 100644 vendor/github.com/hashicorp/hcl/hcl/printer/printer.go mode change 100755 => 100644 vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_vars.go create mode 100644 vendor/github.com/hashicorp/logutils/.gitignore create mode 100644 vendor/github.com/hashicorp/logutils/go.mod create mode 100644 vendor/github.com/hashicorp/mdns/.gitignore rename vendor/github.com/hashicorp/{go-discover/provider/mdns/vendor/github.com/hashicorp => }/mdns/LICENSE (100%) rename vendor/github.com/hashicorp/{go-discover/provider/mdns/vendor/github.com/hashicorp => }/mdns/README.md (100%) rename vendor/github.com/hashicorp/{go-discover/provider/mdns/vendor/github.com/hashicorp => }/mdns/client.go (100%) rename vendor/github.com/hashicorp/{go-discover/provider/mdns/vendor/github.com/hashicorp => }/mdns/go.mod (100%) rename vendor/github.com/hashicorp/{go-discover/provider/mdns/vendor/github.com/hashicorp => }/mdns/go.sum (100%) rename vendor/github.com/hashicorp/{go-discover/provider/mdns/vendor/github.com/hashicorp => }/mdns/server.go (100%) rename vendor/github.com/hashicorp/{go-discover/provider/mdns/vendor/github.com/hashicorp => }/mdns/zone.go (100%) create mode 100644 vendor/github.com/hashicorp/memberlist/.gitignore mode change 100755 => 100644 vendor/github.com/hashicorp/memberlist/tag.sh create mode 100644 vendor/github.com/hashicorp/nomad/api/acl.go create mode 100644 vendor/github.com/hashicorp/nomad/api/agent.go create mode 100644 vendor/github.com/hashicorp/nomad/api/allocations.go create mode 100644 vendor/github.com/hashicorp/nomad/api/api.go create mode 100644 vendor/github.com/hashicorp/nomad/api/constraint.go create mode 100644 vendor/github.com/hashicorp/nomad/api/contexts/contexts.go create mode 100644 vendor/github.com/hashicorp/nomad/api/csi.go create mode 100644 vendor/github.com/hashicorp/nomad/api/deployments.go create mode 100644 vendor/github.com/hashicorp/nomad/api/evaluations.go create mode 100644 vendor/github.com/hashicorp/nomad/api/fs.go create mode 100644 vendor/github.com/hashicorp/nomad/api/go.mod create mode 100644 vendor/github.com/hashicorp/nomad/api/go.sum create mode 100644 vendor/github.com/hashicorp/nomad/api/ioutil.go create mode 100644 vendor/github.com/hashicorp/nomad/api/jobs.go create mode 100644 vendor/github.com/hashicorp/nomad/api/namespace.go create mode 100644 vendor/github.com/hashicorp/nomad/api/nodes.go create mode 100644 vendor/github.com/hashicorp/nomad/api/operator.go create mode 100644 vendor/github.com/hashicorp/nomad/api/operator_autopilot.go create mode 100644 vendor/github.com/hashicorp/nomad/api/quota.go create mode 100644 vendor/github.com/hashicorp/nomad/api/raw.go create mode 100644 vendor/github.com/hashicorp/nomad/api/regions.go create mode 100644 vendor/github.com/hashicorp/nomad/api/resources.go create mode 100644 vendor/github.com/hashicorp/nomad/api/scaling.go create mode 100644 vendor/github.com/hashicorp/nomad/api/search.go create mode 100644 vendor/github.com/hashicorp/nomad/api/sentinel.go create mode 100644 vendor/github.com/hashicorp/nomad/api/services.go create mode 100644 vendor/github.com/hashicorp/nomad/api/status.go create mode 100644 vendor/github.com/hashicorp/nomad/api/system.go create mode 100644 vendor/github.com/hashicorp/nomad/api/tasks.go create mode 100644 vendor/github.com/hashicorp/nomad/api/utils.go create mode 100644 vendor/github.com/hashicorp/raft-boltdb/.travis.yml create mode 100644 vendor/github.com/hashicorp/raft-boltdb/Makefile create mode 100644 vendor/github.com/hashicorp/raft/.gitignore create mode 100644 vendor/github.com/hashicorp/raft/.golangci-lint.yml create mode 100644 vendor/github.com/hashicorp/raft/.travis.yml delete mode 100644 vendor/github.com/hashicorp/raft/leadership_delegate.go mode change 100755 => 100644 vendor/github.com/hashicorp/raft/tag.sh delete mode 100644 vendor/github.com/hashicorp/serf/CHANGELOG.md delete mode 100644 vendor/github.com/hashicorp/serf/GNUmakefile delete mode 100644 vendor/github.com/hashicorp/serf/README.md delete mode 100644 vendor/github.com/hashicorp/serf/ops-misc/debian/copyright delete mode 100644 vendor/github.com/hashicorp/serf/website/LICENSE.md delete mode 100644 vendor/github.com/hashicorp/serf/website/source/LICENSE rename vendor/github.com/hashicorp/vault/{ => api}/LICENSE (100%) delete mode 100644 vendor/github.com/hashicorp/vault/main.go create mode 100644 vendor/github.com/hashicorp/vault/sdk/LICENSE rename vendor/github.com/hashicorp/{go-discover/provider/vsphere/vendor/github.com/hashicorp => }/vic/LICENSE (100%) rename vendor/github.com/hashicorp/{go-discover/provider/vsphere/vendor/github.com/hashicorp => }/vic/pkg/vsphere/tags/categories.go (100%) rename vendor/github.com/hashicorp/{go-discover/provider/vsphere/vendor/github.com/hashicorp => }/vic/pkg/vsphere/tags/rest_client.go (100%) rename vendor/github.com/hashicorp/{go-discover/provider/vsphere/vendor/github.com/hashicorp => }/vic/pkg/vsphere/tags/tag_association.go (100%) rename vendor/github.com/hashicorp/{go-discover/provider/vsphere/vendor/github.com/hashicorp => }/vic/pkg/vsphere/tags/tags.go (100%) create mode 100644 vendor/github.com/hashicorp/yamux/.gitignore create mode 100644 vendor/github.com/hpcloud/tail/.gitignore create mode 100644 vendor/github.com/hpcloud/tail/.travis.yml create mode 100644 vendor/github.com/hpcloud/tail/CHANGES.md create mode 100644 vendor/github.com/hpcloud/tail/Dockerfile create mode 100644 vendor/github.com/hpcloud/tail/Makefile create mode 100644 vendor/github.com/hpcloud/tail/README.md create mode 100644 vendor/github.com/hpcloud/tail/appveyor.yml create mode 100644 vendor/github.com/hpcloud/tail/ratelimiter/Licence create mode 100644 vendor/github.com/hpcloud/tail/ratelimiter/leakybucket.go create mode 100644 vendor/github.com/hpcloud/tail/ratelimiter/memory.go create mode 100644 vendor/github.com/hpcloud/tail/ratelimiter/storage.go create mode 100644 vendor/github.com/hpcloud/tail/tail.go create mode 100644 vendor/github.com/hpcloud/tail/tail_posix.go create mode 100644 vendor/github.com/hpcloud/tail/tail_windows.go create mode 100644 vendor/github.com/hpcloud/tail/winfile/winfile.go create mode 100644 vendor/github.com/jmespath/go-jmespath/.gitignore create mode 100644 vendor/github.com/jmespath/go-jmespath/.travis.yml delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/basic.json delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/boolean.json delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/current.json delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/escape.json delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/filters.json delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/functions.json delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/identifiers.json delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/indices.json delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/literal.json delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/multiselect.json delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/ormatch.json delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/pipe.json delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/slice.json delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/syntax.json delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/unicode.json delete mode 100644 vendor/github.com/jmespath/go-jmespath/compliance/wildcard.json create mode 100644 vendor/github.com/joyent/triton-go/.gitignore create mode 100644 vendor/github.com/joyent/triton-go/.travis.yml create mode 100644 vendor/github.com/joyent/triton-go/CHANGELOG.md create mode 100644 vendor/github.com/joyent/triton-go/GNUmakefile create mode 100644 vendor/github.com/joyent/triton-go/Gopkg.lock create mode 100644 vendor/github.com/joyent/triton-go/Gopkg.toml rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/LICENSE (100%) create mode 100644 vendor/github.com/joyent/triton-go/README.md rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/authentication/agent_key_identifier.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/authentication/dummy.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/authentication/ecdsa_signature.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/authentication/private_key_signer.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/authentication/rsa_signature.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/authentication/signature.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/authentication/signer.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/authentication/ssh_agent_signer.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/authentication/test_signer.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/authentication/util.go (100%) create mode 100644 vendor/github.com/joyent/triton-go/client/client.go create mode 100644 vendor/github.com/joyent/triton-go/compute/client.go rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/compute/datacenters.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/compute/images.go (100%) create mode 100644 vendor/github.com/joyent/triton-go/compute/instances.go rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/compute/packages.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/compute/ping.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/compute/services.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/compute/snapshots.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/compute/volumes.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/errors/errors.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/triton/vendor/github.com => }/joyent/triton-go/triton.go (100%) create mode 100644 vendor/github.com/joyent/triton-go/version.go create mode 100644 vendor/github.com/jstemmer/go-junit-report/.gitignore create mode 100644 vendor/github.com/jstemmer/go-junit-report/.travis.yml create mode 100644 vendor/github.com/jstemmer/go-junit-report/LICENSE create mode 100644 vendor/github.com/jstemmer/go-junit-report/README.md create mode 100644 vendor/github.com/jstemmer/go-junit-report/formatter/formatter.go create mode 100644 vendor/github.com/jstemmer/go-junit-report/go-junit-report.go create mode 100644 vendor/github.com/jstemmer/go-junit-report/parser/parser.go create mode 100644 vendor/github.com/kr/pretty/.gitignore create mode 100644 vendor/github.com/kr/pretty/go.mod create mode 100644 vendor/github.com/kr/pretty/go.sum create mode 100644 vendor/github.com/kr/pty/.gitignore mode change 100755 => 100644 vendor/github.com/kr/pty/mktypes.bash delete mode 100644 vendor/github.com/kr/pty/types.go delete mode 100644 vendor/github.com/kr/pty/types_dragonfly.go delete mode 100644 vendor/github.com/kr/pty/types_freebsd.go delete mode 100644 vendor/github.com/kr/pty/types_openbsd.go create mode 100644 vendor/github.com/kr/text/go.mod create mode 100644 vendor/github.com/linode/linodego/.gitignore create mode 100644 vendor/github.com/linode/linodego/.travis.yml rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/API_SUPPORT.md (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/CHANGELOG.md (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/Gopkg.lock (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/Gopkg.toml (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/LICENSE (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/Makefile (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/README.md (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/account.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/account_events.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/account_invoices.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/account_notifications.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/account_users.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/client.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/domain_records.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/domains.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/env.sample (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/errors.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/images.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/instance_configs.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/instance_disks.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/instance_ips.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/instance_snapshots.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/instance_volumes.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/instances.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/kernels.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/longview.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/longview_subscriptions.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/managed.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/network_ips.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/network_pools.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/network_ranges.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/nodebalancer.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/nodebalancer_config_nodes.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/nodebalancer_configs.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/pagination.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/profile.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/profile_sshkeys.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/profile_tokens.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/regions.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/resources.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/stackscripts.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/support.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/tags.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/types.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/util.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/volumes.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/github.com => }/linode/linodego/waitfor.go (100%) create mode 100644 vendor/github.com/mattn/go-colorable/.travis.yml create mode 100644 vendor/github.com/mattn/go-colorable/go.mod create mode 100644 vendor/github.com/mattn/go-colorable/go.sum create mode 100644 vendor/github.com/mattn/go-colorable/go.test.sh create mode 100644 vendor/github.com/mattn/go-isatty/.travis.yml create mode 100644 vendor/github.com/mattn/go-isatty/go.mod create mode 100644 vendor/github.com/mattn/go-isatty/go.sum create mode 100644 vendor/github.com/mattn/go-isatty/go.test.sh delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_linux.go delete mode 100644 vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go create mode 100644 vendor/github.com/mattn/go-isatty/isatty_plan9.go create mode 100644 vendor/github.com/mattn/go-isatty/isatty_tcgets.go create mode 100644 vendor/github.com/mattn/go-isatty/renovate.json create mode 100644 vendor/github.com/mattn/go-shellwords/.travis.yml create mode 100644 vendor/github.com/mattn/go-shellwords/LICENSE create mode 100644 vendor/github.com/mattn/go-shellwords/go.mod create mode 100644 vendor/github.com/mattn/go-shellwords/util_go15.go create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore create mode 100644 vendor/github.com/miekg/dns/.codecov.yml create mode 100644 vendor/github.com/miekg/dns/.gitignore create mode 100644 vendor/github.com/miekg/dns/.travis.yml create mode 100644 vendor/github.com/miekg/dns/CODEOWNERS rename vendor/github.com/{hashicorp/go-discover/provider/mdns/vendor/github.com => }/miekg/dns/Makefile.fuzz (100%) rename vendor/github.com/{hashicorp/go-discover/provider/mdns/vendor/github.com => }/miekg/dns/Makefile.release (100%) create mode 100644 vendor/github.com/miekg/dns/acceptfunc.go rename vendor/github.com/{hashicorp/go-discover/provider/mdns/vendor/github.com => }/miekg/dns/dane.go (100%) create mode 100644 vendor/github.com/miekg/dns/duplicate.go create mode 100644 vendor/github.com/miekg/dns/fuzz.go rename vendor/github.com/{hashicorp/go-discover/provider/mdns/vendor/github.com => }/miekg/dns/generate.go (95%) create mode 100644 vendor/github.com/miekg/dns/go.mod create mode 100644 vendor/github.com/miekg/dns/go.sum rename vendor/github.com/{hashicorp/go-discover/provider/mdns/vendor/github.com => }/miekg/dns/listen_go111.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/mdns/vendor/github.com => }/miekg/dns/listen_go_not111.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/mdns/vendor/github.com => }/miekg/dns/msg_helpers.go (84%) create mode 100644 vendor/github.com/miekg/dns/msg_truncate.go delete mode 100644 vendor/github.com/miekg/dns/rawmsg.go create mode 100644 vendor/github.com/miekg/dns/reverse.go rename vendor/github.com/{hashicorp/go-discover/provider/mdns/vendor/github.com => }/miekg/dns/scan.go (88%) create mode 100644 vendor/github.com/miekg/dns/scan_rr.go delete mode 100644 vendor/github.com/miekg/dns/scanner.go rename vendor/github.com/{hashicorp/go-discover/provider/mdns/vendor/github.com => }/miekg/dns/serve_mux.go (88%) rename vendor/github.com/{hashicorp/go-discover/provider/mdns/vendor/github.com => }/miekg/dns/smimea.go (96%) delete mode 100644 vendor/github.com/miekg/dns/types_generate.go delete mode 100644 vendor/github.com/miekg/dns/udp_linux.go delete mode 100644 vendor/github.com/miekg/dns/udp_other.go delete mode 100644 vendor/github.com/miekg/dns/udp_plan9.go create mode 100644 vendor/github.com/miekg/dns/version.go create mode 100644 vendor/github.com/miekg/dns/zduplicate.go delete mode 100644 vendor/github.com/miekg/dns/zgenerate.go create mode 100644 vendor/github.com/miekg/dns/zmsg.go delete mode 100644 vendor/github.com/miekg/dns/zscan.go delete mode 100644 vendor/github.com/miekg/dns/zscan_rr.go create mode 100644 vendor/github.com/mitchellh/cli/.travis.yml create mode 100644 vendor/github.com/mitchellh/cli/go.mod create mode 100644 vendor/github.com/mitchellh/cli/go.sum create mode 100644 vendor/github.com/mitchellh/colorstring/.travis.yml create mode 100644 vendor/github.com/mitchellh/copystructure/.travis.yml create mode 100644 vendor/github.com/mitchellh/copystructure/go.mod create mode 100644 vendor/github.com/mitchellh/copystructure/go.sum rename vendor/github.com/{hashicorp/go-discover/provider/azure/vendor/github.com => }/mitchellh/go-homedir/go.mod (100%) create mode 100644 vendor/github.com/mitchellh/go-ps/.gitignore create mode 100644 vendor/github.com/mitchellh/go-ps/.travis.yml create mode 100644 vendor/github.com/mitchellh/go-testing-interface/.travis.yml create mode 100644 vendor/github.com/mitchellh/go-testing-interface/go.mod create mode 100644 vendor/github.com/mitchellh/go-wordwrap/go.mod create mode 100644 vendor/github.com/mitchellh/hashstructure/go.mod create mode 100644 vendor/github.com/mitchellh/mapstructure/.travis.yml create mode 100644 vendor/github.com/mitchellh/mapstructure/CHANGELOG.md create mode 100644 vendor/github.com/mitchellh/mapstructure/go.mod create mode 100644 vendor/github.com/mitchellh/reflectwalk/.travis.yml create mode 100644 vendor/github.com/mitchellh/reflectwalk/go.mod create mode 100644 vendor/github.com/mrunalp/fileutils/.gitignore rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/LICENSE.md (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/README.md (100%) create mode 100644 vendor/github.com/nicolai86/scaleway-sdk/api.go rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/availability.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/bootscript.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/container.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/dashboard.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/image.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/ip.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/organization.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/permissions.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/quota.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/security_group.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/security_group_rule.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/server.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/snapshot.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/tasks.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/tokens.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/user.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/user_data.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/scaleway/vendor/github.com => }/nicolai86/scaleway-sdk/volume.go (100%) create mode 100644 vendor/github.com/oklog/run/.gitignore create mode 100644 vendor/github.com/oklog/run/.travis.yml create mode 100644 vendor/github.com/onsi/ginkgo/.gitignore create mode 100644 vendor/github.com/onsi/ginkgo/.travis.yml create mode 100644 vendor/github.com/onsi/ginkgo/RELEASING.md delete mode 100755 vendor/github.com/onsi/ginkgo/before_pr.sh delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/bootstrap_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/build_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/convert/ginkgo_ast_nodes.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/convert/import.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/convert/package_rewriter.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/convert/test_finder.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/convert/testfile_rewriter.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/convert/testing_t_rewriter.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/convert_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/generate_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/help_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/interrupthandler/interrupt_handler.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/interrupthandler/sigquit_swallower_unix.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/interrupthandler/sigquit_swallower_windows.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/main.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/nodot/nodot.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/nodot_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/notifications.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/run_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/run_watch_and_build_command_flags.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/suite_runner.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/testrunner/log_writer.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/testrunner/run_result.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/testrunner/test_runner.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/testsuite/test_suite.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/testsuite/vendor_check_go15.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/testsuite/vendor_check_go16.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/unfocus_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/version_command.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/watch/delta.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/watch/delta_tracker.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/watch/dependencies.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/watch/package_hash.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/watch/package_hashes.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/watch/suite.go delete mode 100644 vendor/github.com/onsi/ginkgo/ginkgo/watch_command.go create mode 100644 vendor/github.com/onsi/ginkgo/go.mod create mode 100644 vendor/github.com/onsi/ginkgo/go.sum create mode 100644 vendor/github.com/onsi/ginkgo/internal/remote/syscall_dup_linux_riscv64.go create mode 100644 vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/isatty_appengine.go create mode 100644 vendor/github.com/onsi/gomega/.gitignore create mode 100644 vendor/github.com/onsi/gomega/.travis.yml create mode 100644 vendor/github.com/onsi/gomega/Makefile create mode 100644 vendor/github.com/onsi/gomega/go.mod create mode 100644 vendor/github.com/onsi/gomega/go.sum create mode 100644 vendor/github.com/onsi/gomega/matchers/be_element_of_matcher.go create mode 100644 vendor/github.com/onsi/gomega/matchers/contain_elements_matcher.go create mode 100644 vendor/github.com/onsi/gomega/matchers/semi_structured_data_support.go create mode 100644 vendor/github.com/opencontainers/go-digest/.mailmap create mode 100644 vendor/github.com/opencontainers/go-digest/.pullapprove.yml create mode 100644 vendor/github.com/opencontainers/go-digest/.travis.yml create mode 100644 vendor/github.com/packethost/packngo/.drone.yml create mode 100644 vendor/github.com/packethost/packngo/.gitignore rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/CHANGELOG.md (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/LICENSE.txt (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/README.md (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/billing_address.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/devices.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/email.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/facilities.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/ip.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/operatingsystems.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/organizations.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/packngo.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/payment_methods.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/plans.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/ports.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/projects.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/rate.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/spotmarket.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/sshkeys.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/timestamp.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/user.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/utils.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/virtualnetworks.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/packet/vendor/github.com => }/packethost/packngo/volumes.go (100%) create mode 100644 vendor/github.com/pierrec/lz4/.gitignore create mode 100644 vendor/github.com/pierrec/lz4/.travis.yml create mode 100644 vendor/github.com/pkg/errors/.gitignore create mode 100644 vendor/github.com/pkg/errors/.travis.yml create mode 100644 vendor/github.com/posener/complete/.gitignore create mode 100644 vendor/github.com/posener/complete/.travis.yml create mode 100644 vendor/github.com/posener/complete/cmd/install/fish.go create mode 100644 vendor/github.com/posener/complete/go.mod create mode 100644 vendor/github.com/posener/complete/go.sum delete mode 100644 vendor/github.com/posener/complete/metalinter.json mode change 100755 => 100644 vendor/github.com/posener/complete/test.sh create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/.gitignore delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/http.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go delete mode 100644 vendor/github.com/prometheus/client_golang/prometheus/push/deprecated.go create mode 100644 vendor/github.com/prometheus/common/expfmt/openmetrics_create.go create mode 100644 vendor/github.com/prometheus/procfs/.gitignore create mode 100644 vendor/github.com/prometheus/procfs/.golangci.yml create mode 100644 vendor/github.com/prometheus/procfs/arp.go create mode 100644 vendor/github.com/prometheus/procfs/cpuinfo.go create mode 100644 vendor/github.com/prometheus/procfs/crypto.go create mode 100644 vendor/github.com/prometheus/procfs/internal/util/parse.go create mode 100644 vendor/github.com/prometheus/procfs/internal/util/readfile.go create mode 100644 vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go create mode 100644 vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go create mode 100644 vendor/github.com/prometheus/procfs/internal/util/valueparser.go create mode 100644 vendor/github.com/prometheus/procfs/meminfo.go create mode 100644 vendor/github.com/prometheus/procfs/mountinfo.go create mode 100644 vendor/github.com/prometheus/procfs/net_sockstat.go create mode 100644 vendor/github.com/prometheus/procfs/net_softnet.go create mode 100644 vendor/github.com/prometheus/procfs/proc_environ.go create mode 100644 vendor/github.com/prometheus/procfs/proc_fdinfo.go create mode 100644 vendor/github.com/prometheus/procfs/schedstat.go mode change 100755 => 100644 vendor/github.com/prometheus/procfs/ttar create mode 100644 vendor/github.com/prometheus/procfs/vm.go create mode 100644 vendor/github.com/prometheus/procfs/zoneinfo.go create mode 100644 vendor/github.com/renier/xmlrpc/.gitignore rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/renier/xmlrpc/LICENSE (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/renier/xmlrpc/README.md (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/renier/xmlrpc/client.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/renier/xmlrpc/decoder.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/renier/xmlrpc/encoder.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/renier/xmlrpc/request.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/renier/xmlrpc/response.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/renier/xmlrpc/test_server.rb (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/renier/xmlrpc/xmlrpc.go (100%) create mode 100644 vendor/github.com/rs/cors/.travis.yml create mode 100644 vendor/github.com/ryanuber/columnize/.travis.yml create mode 100644 vendor/github.com/ryanuber/go-glob/.travis.yml create mode 100644 vendor/github.com/ryanuber/go-glob/go.mod create mode 100644 vendor/github.com/sean-/seed/.gitignore create mode 100644 vendor/github.com/seccomp/libseccomp-golang/.gitignore create mode 100644 vendor/github.com/seccomp/libseccomp-golang/.travis.yml delete mode 100644 vendor/github.com/shirou/gopsutil/host/freebsd_headers/utxdb.h create mode 100644 vendor/github.com/sirupsen/logrus/.gitignore create mode 100644 vendor/github.com/sirupsen/logrus/.golangci.yml create mode 100644 vendor/github.com/sirupsen/logrus/.travis.yml create mode 100644 vendor/github.com/sirupsen/logrus/terminal_check_js.go rename vendor/github.com/{hashicorp/go-discover/provider/linode/vendor/google.golang.org/appengine => softlayer/softlayer-go}/LICENSE (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/config/config.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/abuse.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/datatypes/account.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/auxiliary.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/datatypes/billing.go create mode 100644 vendor/github.com/softlayer/softlayer-go/datatypes/brand.go create mode 100644 vendor/github.com/softlayer/softlayer-go/datatypes/business.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/catalyst.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/compliance.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/configuration.go (98%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/container.go (83%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/dns.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/datatypes/email.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/entity.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/event.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/flexiblecredit.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/datatypes/hardware.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/layout.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/legal.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/datatypes/locale.go create mode 100644 vendor/github.com/softlayer/softlayer-go/datatypes/location.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/marketplace.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/mcafee.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/metric.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/monitoring.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/datatypes/network.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/notification.go (96%) create mode 100644 vendor/github.com/softlayer/softlayer-go/datatypes/policy.go create mode 100644 vendor/github.com/softlayer/softlayer-go/datatypes/product.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/provisioning.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/resource.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/sales.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/scale.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/search.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/security.go (97%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/service.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/softlayer.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/software.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/survey.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/tag.go (95%) create mode 100644 vendor/github.com/softlayer/softlayer-go/datatypes/ticket.go create mode 100644 vendor/github.com/softlayer/softlayer-go/datatypes/user.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/datatypes/utility.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/datatypes/virtual.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/filter/filters.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/services/account.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/auxiliary.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/services/billing.go create mode 100644 vendor/github.com/softlayer/softlayer-go/services/brand.go create mode 100644 vendor/github.com/softlayer/softlayer-go/services/business.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/catalyst.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/compliance.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/configuration.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/dns.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/services/email.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/event.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/flexiblecredit.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/services/hardware.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/layout.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/services/locale.go create mode 100644 vendor/github.com/softlayer/softlayer-go/services/location.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/marketplace.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/metric.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/monitoring.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/services/network.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/notification.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/services/product.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/provisioning.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/resource.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/sales.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/scale.go (92%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/search.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/security.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/software.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/survey.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/tag.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/services/ticket.go create mode 100644 vendor/github.com/softlayer/softlayer-go/services/user.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/services/utility.go (100%) create mode 100644 vendor/github.com/softlayer/softlayer-go/services/virtual.go create mode 100644 vendor/github.com/softlayer/softlayer-go/session/rest.go create mode 100644 vendor/github.com/softlayer/softlayer-go/session/session.go create mode 100644 vendor/github.com/softlayer/softlayer-go/session/xmlrpc.go rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/sl/errors.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/sl/helpers.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/sl/options.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/softlayer/vendor/github.com => }/softlayer/softlayer-go/sl/version.go (100%) delete mode 100644 vendor/github.com/spf13/pflag/LICENSE delete mode 100644 vendor/github.com/spf13/pflag/README.md delete mode 100644 vendor/github.com/spf13/pflag/bool.go delete mode 100644 vendor/github.com/spf13/pflag/bool_slice.go delete mode 100644 vendor/github.com/spf13/pflag/count.go delete mode 100644 vendor/github.com/spf13/pflag/duration.go delete mode 100644 vendor/github.com/spf13/pflag/flag.go delete mode 100644 vendor/github.com/spf13/pflag/float32.go delete mode 100644 vendor/github.com/spf13/pflag/float64.go delete mode 100644 vendor/github.com/spf13/pflag/golangflag.go delete mode 100644 vendor/github.com/spf13/pflag/int.go delete mode 100644 vendor/github.com/spf13/pflag/int32.go delete mode 100644 vendor/github.com/spf13/pflag/int64.go delete mode 100644 vendor/github.com/spf13/pflag/int8.go delete mode 100644 vendor/github.com/spf13/pflag/int_slice.go delete mode 100644 vendor/github.com/spf13/pflag/ip.go delete mode 100644 vendor/github.com/spf13/pflag/ip_slice.go delete mode 100644 vendor/github.com/spf13/pflag/ipmask.go delete mode 100644 vendor/github.com/spf13/pflag/ipnet.go delete mode 100644 vendor/github.com/spf13/pflag/string.go delete mode 100644 vendor/github.com/spf13/pflag/string_array.go delete mode 100644 vendor/github.com/spf13/pflag/string_slice.go delete mode 100644 vendor/github.com/spf13/pflag/uint.go delete mode 100644 vendor/github.com/spf13/pflag/uint16.go delete mode 100644 vendor/github.com/spf13/pflag/uint32.go delete mode 100644 vendor/github.com/spf13/pflag/uint64.go delete mode 100644 vendor/github.com/spf13/pflag/uint8.go delete mode 100644 vendor/github.com/spf13/pflag/uint_slice.go create mode 100644 vendor/github.com/stretchr/objx/.codeclimate.yml create mode 100644 vendor/github.com/stretchr/objx/.gitignore create mode 100644 vendor/github.com/stretchr/objx/.travis.yml create mode 100644 vendor/github.com/stretchr/objx/LICENSE delete mode 100644 vendor/github.com/stretchr/objx/LICENSE.md create mode 100644 vendor/github.com/stretchr/objx/Taskfile.yml delete mode 100644 vendor/github.com/stretchr/objx/constants.go create mode 100644 vendor/github.com/stretchr/objx/go.mod create mode 100644 vendor/github.com/stretchr/objx/go.sum create mode 100644 vendor/github.com/stretchr/objx/type_specific.go rename vendor/github.com/{hashicorp/go-discover/provider/tencentcloud/vendor/github.com => }/tencentcloud/tencentcloud-sdk-go/LICENSE (100%) rename vendor/github.com/{hashicorp/go-discover/provider/tencentcloud/vendor/github.com => }/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/client.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/tencentcloud/vendor/github.com => }/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/credentials.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/tencentcloud/vendor/github.com => }/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/errors/errors.go (100%) create mode 100644 vendor/github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/request.go rename vendor/github.com/{hashicorp/go-discover/provider/tencentcloud/vendor/github.com => }/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/http/response.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/tencentcloud/vendor/github.com => }/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/client_profile.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/tencentcloud/vendor/github.com => }/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/profile/http_profile.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/tencentcloud/vendor/github.com => }/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/sign.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/tencentcloud/vendor/github.com => }/tencentcloud/tencentcloud-sdk-go/tencentcloud/common/types.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/tencentcloud/vendor/github.com => }/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/client.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/tencentcloud/vendor/github.com => }/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm/v20170312/models.go (100%) create mode 100644 vendor/github.com/tv42/httpunix/.gitignore create mode 100644 vendor/github.com/ulikunitz/xz/.gitignore mode change 100755 => 100644 vendor/github.com/ulikunitz/xz/make-docs create mode 100644 vendor/github.com/vishvananda/netlink/.gitignore create mode 100644 vendor/github.com/vishvananda/netlink/.travis.yml create mode 100644 vendor/github.com/vmihailenco/msgpack/.travis.yml create mode 100644 vendor/github.com/vmihailenco/msgpack/appengine.go create mode 100644 vendor/github.com/vmware/govmomi/.gitignore create mode 100644 vendor/github.com/vmware/govmomi/.goreleaser.yml create mode 100644 vendor/github.com/vmware/govmomi/.mailmap create mode 100644 vendor/github.com/vmware/govmomi/.travis.yml rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/CHANGELOG.md (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/CONTRIBUTING.md (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/CONTRIBUTORS (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/Dockerfile (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/Gopkg.lock (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/Gopkg.toml (100%) rename vendor/github.com/{hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go => vmware/govmomi}/LICENSE.txt (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/Makefile (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/README.md (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/client.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/find/doc.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/find/error.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/find/finder.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/find/recurser.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/list/lister.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/list/path.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/nfc/lease.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/nfc/lease_updater.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/authorization_manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/authorization_manager_internal.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/cluster_compute_resource.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/common.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/compute_resource.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/custom_fields_manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/customization_spec_manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/datacenter.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/datastore.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/datastore_file.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/datastore_file_manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/datastore_path.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/diagnostic_log.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/diagnostic_manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/distributed_virtual_portgroup.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/distributed_virtual_switch.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/extension_manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/file_manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/folder.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/history_collector.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/host_account_manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/host_certificate_info.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/host_certificate_manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/host_config_manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/host_datastore_browser.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/host_datastore_system.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/host_date_time_system.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/host_firewall_system.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/host_network_system.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/host_service_system.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/host_storage_system.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/host_system.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/host_virtual_nic_manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/host_vsan_internal_system.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/host_vsan_system.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/namespace_manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/network.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/network_reference.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/opaque_network.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/option_manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/resource_pool.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/search_index.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/storage_pod.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/storage_resource_manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/task.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/types.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/virtual_app.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/virtual_device_list.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/virtual_disk_manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/virtual_disk_manager_internal.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/virtual_machine.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/object/vmware_distributed_virtual_switch.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/property/collector.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/property/filter.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/property/wait.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/session/keep_alive.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/session/manager.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/task/error.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/task/wait.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/client.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/debug/debug.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/doc.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/methods/methods.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/methods/service_content.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/mo/ancestors.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/mo/entity.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/mo/extra.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/mo/mo.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/mo/reference.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/mo/registry.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/mo/retrieve.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/mo/type_info.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/progress/aggregator.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/progress/doc.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/progress/prefix.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/progress/reader.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/progress/report.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/progress/scale.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/progress/sinker.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/progress/tee.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/retry.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/soap/client.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/soap/debug.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/soap/error.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/soap/soap.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/types/base.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/types/enum.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/types/fault.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/types/helpers.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/types/if.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/types/registry.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/types/types.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/xml/LICENSE (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/xml/extras.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/xml/marshal.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/xml/read.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/xml/typeinfo.go (100%) rename vendor/github.com/{hashicorp/go-discover/provider/vsphere/vendor/github.com => }/vmware/govmomi/vim25/xml/xml.go (100%) create mode 100644 vendor/go.opencensus.io/.gitignore create mode 100644 vendor/go.opencensus.io/.travis.yml create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/client.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/client_metrics.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/client_stats_handler.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/doc.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/server.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/server_metrics.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/server_stats_handler.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/stats_common.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/trace_common.go create mode 100644 vendor/go.opencensus.io/plugin/ochttp/propagation/tracecontext/propagation.go delete mode 100644 vendor/go4.org/LICENSE delete mode 100644 vendor/go4.org/errorutil/highlight.go create mode 100644 vendor/golang.org/x/crypto/AUTHORS create mode 100644 vendor/golang.org/x/crypto/CONTRIBUTORS create mode 100644 vendor/golang.org/x/crypto/blowfish/block.go create mode 100644 vendor/golang.org/x/crypto/blowfish/cipher.go create mode 100644 vendor/golang.org/x/crypto/blowfish/const.go create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_arm64.go create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_arm64.s create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_generic.go create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_noasm.go create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.go create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_s390x.go create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_s390x.s create mode 100644 vendor/golang.org/x/crypto/chacha20/xor.go create mode 100644 vendor/golang.org/x/crypto/curve25519/curve25519.go create mode 100644 vendor/golang.org/x/crypto/curve25519/curve25519_amd64.go create mode 100644 vendor/golang.org/x/crypto/curve25519/curve25519_amd64.s create mode 100644 vendor/golang.org/x/crypto/curve25519/curve25519_generic.go create mode 100644 vendor/golang.org/x/crypto/curve25519/curve25519_noasm.go create mode 100644 vendor/golang.org/x/crypto/internal/subtle/aliasing.go create mode 100644 vendor/golang.org/x/crypto/internal/subtle/aliasing_appengine.go rename vendor/{github.com/hashicorp/go-discover/provider/azure/vendor => }/golang.org/x/crypto/pkcs12/bmp-string.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/azure/vendor => }/golang.org/x/crypto/pkcs12/crypto.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/azure/vendor => }/golang.org/x/crypto/pkcs12/errors.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/azure/vendor => }/golang.org/x/crypto/pkcs12/internal/rc2/rc2.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/azure/vendor => }/golang.org/x/crypto/pkcs12/mac.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/azure/vendor => }/golang.org/x/crypto/pkcs12/pbkdf.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/azure/vendor => }/golang.org/x/crypto/pkcs12/pkcs12.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/azure/vendor => }/golang.org/x/crypto/pkcs12/safebags.go (100%) create mode 100644 vendor/golang.org/x/crypto/poly1305/bits_compat.go create mode 100644 vendor/golang.org/x/crypto/poly1305/bits_go1.13.go create mode 100644 vendor/golang.org/x/crypto/poly1305/mac_noasm.go create mode 100644 vendor/golang.org/x/crypto/poly1305/poly1305.go create mode 100644 vendor/golang.org/x/crypto/poly1305/sum_amd64.go create mode 100644 vendor/golang.org/x/crypto/poly1305/sum_amd64.s create mode 100644 vendor/golang.org/x/crypto/poly1305/sum_generic.go create mode 100644 vendor/golang.org/x/crypto/poly1305/sum_ppc64le.go create mode 100644 vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s create mode 100644 vendor/golang.org/x/crypto/poly1305/sum_s390x.go create mode 100644 vendor/golang.org/x/crypto/poly1305/sum_s390x.s create mode 100644 vendor/golang.org/x/crypto/ssh/agent/client.go rename vendor/{github.com/hashicorp/go-discover/provider/triton/vendor => }/golang.org/x/crypto/ssh/agent/forward.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/triton/vendor => }/golang.org/x/crypto/ssh/agent/keyring.go (80%) create mode 100644 vendor/golang.org/x/crypto/ssh/agent/server.go rename vendor/{github.com/hashicorp/go-discover/provider/triton/vendor => }/golang.org/x/crypto/ssh/buffer.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/triton/vendor => }/golang.org/x/crypto/ssh/certs.go (89%) rename vendor/{github.com/hashicorp/go-discover/provider/triton/vendor => }/golang.org/x/crypto/ssh/channel.go (100%) create mode 100644 vendor/golang.org/x/crypto/ssh/cipher.go create mode 100644 vendor/golang.org/x/crypto/ssh/client.go rename vendor/{github.com/hashicorp/go-discover/provider/triton/vendor => }/golang.org/x/crypto/ssh/client_auth.go (79%) create mode 100644 vendor/golang.org/x/crypto/ssh/common.go rename vendor/{github.com/hashicorp/go-discover/provider/triton/vendor => }/golang.org/x/crypto/ssh/connection.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/triton/vendor => }/golang.org/x/crypto/ssh/doc.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/triton/vendor => }/golang.org/x/crypto/ssh/handshake.go (99%) create mode 100644 vendor/golang.org/x/crypto/ssh/internal/bcrypt_pbkdf/bcrypt_pbkdf.go create mode 100644 vendor/golang.org/x/crypto/ssh/kex.go create mode 100644 vendor/golang.org/x/crypto/ssh/keys.go rename vendor/{github.com/hashicorp/go-discover/provider/triton/vendor => }/golang.org/x/crypto/ssh/mac.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/triton/vendor => }/golang.org/x/crypto/ssh/messages.go (87%) rename vendor/{github.com/hashicorp/go-discover/provider/triton/vendor => }/golang.org/x/crypto/ssh/mux.go (100%) create mode 100644 vendor/golang.org/x/crypto/ssh/server.go rename vendor/{github.com/hashicorp/go-discover/provider/triton/vendor => }/golang.org/x/crypto/ssh/session.go (100%) create mode 100644 vendor/golang.org/x/crypto/ssh/ssh_gss.go rename vendor/{github.com/hashicorp/go-discover/provider/triton/vendor => }/golang.org/x/crypto/ssh/streamlocal.go (98%) rename vendor/{github.com/hashicorp/go-discover/provider/triton/vendor => }/golang.org/x/crypto/ssh/tcpip.go (96%) create mode 100644 vendor/golang.org/x/crypto/ssh/transport.go rename vendor/{github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2 => golang.org/x/exp}/AUTHORS (100%) rename vendor/{github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/oauth2 => golang.org/x/exp}/CONTRIBUTORS (100%) rename vendor/{github.com/hashicorp/go-discover/provider/azure/vendor/golang.org/x/crypto => golang.org/x/exp}/LICENSE (100%) rename vendor/{github.com/hashicorp/go-discover/provider/azure/vendor/golang.org/x/crypto => golang.org/x/exp}/PATENTS (100%) create mode 100644 vendor/golang.org/x/exp/apidiff/README.md create mode 100644 vendor/golang.org/x/exp/apidiff/apidiff.go create mode 100644 vendor/golang.org/x/exp/apidiff/compatibility.go create mode 100644 vendor/golang.org/x/exp/apidiff/correspondence.go create mode 100644 vendor/golang.org/x/exp/apidiff/messageset.go create mode 100644 vendor/golang.org/x/exp/apidiff/report.go create mode 100644 vendor/golang.org/x/exp/cmd/apidiff/main.go create mode 100644 vendor/golang.org/x/lint/.travis.yml create mode 100644 vendor/golang.org/x/lint/CONTRIBUTING.md create mode 100644 vendor/golang.org/x/lint/LICENSE create mode 100644 vendor/golang.org/x/lint/README.md create mode 100644 vendor/golang.org/x/lint/go.mod create mode 100644 vendor/golang.org/x/lint/go.sum create mode 100644 vendor/golang.org/x/lint/golint/golint.go create mode 100644 vendor/golang.org/x/lint/golint/import.go create mode 100644 vendor/golang.org/x/lint/golint/importcomment.go create mode 100644 vendor/golang.org/x/lint/lint.go rename vendor/{github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/net => golang.org/x/mod}/LICENSE (100%) rename vendor/{github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/net => golang.org/x/mod}/PATENTS (100%) create mode 100644 vendor/golang.org/x/mod/module/module.go create mode 100644 vendor/golang.org/x/mod/semver/semver.go rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/oauth2 => golang.org/x/net}/AUTHORS (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor/golang.org/x/oauth2 => golang.org/x/net}/CONTRIBUTORS (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/bpf/asm.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/bpf/constants.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/bpf/doc.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/bpf/instructions.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/bpf/setter.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/bpf/vm.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/bpf/vm_instructions.go (98%) create mode 100644 vendor/golang.org/x/net/http2/.gitignore rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/iana/const.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/cmsghdr.go (82%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/cmsghdr_bsd.go (83%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go (81%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/cmsghdr_stub.go (83%) create mode 100644 vendor/golang.org/x/net/internal/socket/empty.s rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/error_unix.go (90%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/error_windows.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/iovec_32bit.go (100%) create mode 100644 vendor/golang.org/x/net/internal/socket/iovec_64bit.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/iovec_solaris_64bit.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/iovec_stub.go (75%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/mmsghdr_stub.go (94%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/mmsghdr_unix.go (97%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/msghdr_bsd.go (93%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/msghdr_bsdvar.go (86%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/msghdr_linux.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/msghdr_linux_32bit.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/msghdr_linux_64bit.go (87%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/msghdr_openbsd.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/msghdr_stub.go (87%) create mode 100644 vendor/golang.org/x/net/internal/socket/norace.go create mode 100644 vendor/golang.org/x/net/internal/socket/race.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/rawconn.go (98%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/rawconn_mmsg.go (94%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/rawconn_msg.go (93%) create mode 100644 vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go create mode 100644 vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/socket.go (98%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys.go (92%) create mode 100644 vendor/golang.org/x/net/internal/socket/sys_bsd.go create mode 100644 vendor/golang.org/x/net/internal/socket/sys_bsdvar.go create mode 100644 vendor/golang.org/x/net/internal/socket/sys_const_unix.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_darwin.go (100%) create mode 100644 vendor/golang.org/x/net/internal/socket/sys_dragonfly.go create mode 100644 vendor/golang.org/x/net/internal/socket/sys_go1_11_darwin.go create mode 100644 vendor/golang.org/x/net/internal/socket/sys_linkname.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_linux.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_linux_386.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_linux_386.s (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_linux_amd64.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_linux_arm.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_linux_arm64.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_linux_mips.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_linux_mips64.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_linux_mips64le.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_linux_mipsle.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_linux_ppc64.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_linux_ppc64le.go (100%) create mode 100644 vendor/golang.org/x/net/internal/socket/sys_linux_riscv64.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_linux_s390x.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_linux_s390x.s (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_netbsd.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_posix.go (77%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_solaris.go (96%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_solaris_amd64.s (100%) create mode 100644 vendor/golang.org/x/net/internal/socket/sys_stub.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_unix.go (94%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/sys_windows.go (82%) create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_aix_ppc64.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/zsys_darwin_386.go (84%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/zsys_darwin_amd64.go (85%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/zsys_darwin_arm.go (84%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/zsys_darwin_arm64.go (85%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go (85%) create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm64.go create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_386.go create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_riscv64.go create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/zsys_netbsd_386.go (78%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go (80%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/zsys_netbsd_arm.go (78%) create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm64.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/zsys_openbsd_386.go (84%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go (85%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/zsys_openbsd_arm.go (84%) create mode 100644 vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm64.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/internal/socket/zsys_solaris_amd64.go (85%) delete mode 100644 vendor/golang.org/x/net/internal/socks/client.go delete mode 100644 vendor/golang.org/x/net/internal/socks/socks.go create mode 100644 vendor/golang.org/x/net/ipv4/batch.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/control.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/control_bsd.go (85%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/control_pktinfo.go (100%) create mode 100644 vendor/golang.org/x/net/ipv4/control_stub.go create mode 100644 vendor/golang.org/x/net/ipv4/control_unix.go create mode 100644 vendor/golang.org/x/net/ipv4/control_windows.go create mode 100644 vendor/golang.org/x/net/ipv4/dgramopt.go create mode 100644 vendor/golang.org/x/net/ipv4/doc.go create mode 100644 vendor/golang.org/x/net/ipv4/endpoint.go create mode 100644 vendor/golang.org/x/net/ipv4/genericopt.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/header.go (96%) create mode 100644 vendor/golang.org/x/net/ipv4/helper.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/iana.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/icmp.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/icmp_linux.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/icmp_stub.go (100%) create mode 100644 vendor/golang.org/x/net/ipv4/packet.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/payload.go (100%) create mode 100644 vendor/golang.org/x/net/ipv4/payload_cmsg.go create mode 100644 vendor/golang.org/x/net/ipv4/payload_nocmsg.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/sockopt.go (100%) create mode 100644 vendor/golang.org/x/net/ipv4/sockopt_posix.go create mode 100644 vendor/golang.org/x/net/ipv4/sockopt_stub.go create mode 100644 vendor/golang.org/x/net/ipv4/sys_aix.go create mode 100644 vendor/golang.org/x/net/ipv4/sys_asmreq.go create mode 100644 vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/sys_asmreqn.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/sys_asmreqn_stub.go (88%) create mode 100644 vendor/golang.org/x/net/ipv4/sys_bpf.go create mode 100644 vendor/golang.org/x/net/ipv4/sys_bpf_stub.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/sys_bsd.go (100%) create mode 100644 vendor/golang.org/x/net/ipv4/sys_darwin.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/sys_dragonfly.go (100%) create mode 100644 vendor/golang.org/x/net/ipv4/sys_freebsd.go create mode 100644 vendor/golang.org/x/net/ipv4/sys_linux.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/sys_solaris.go (100%) create mode 100644 vendor/golang.org/x/net/ipv4/sys_ssmreq.go create mode 100644 vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go create mode 100644 vendor/golang.org/x/net/ipv4/sys_stub.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv4/sys_windows.go (100%) create mode 100644 vendor/golang.org/x/net/ipv4/zsys_aix_ppc64.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_darwin.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_dragonfly.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_freebsd_arm64.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_386.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_arm.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_mips.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_riscv64.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_netbsd.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_openbsd.go create mode 100644 vendor/golang.org/x/net/ipv4/zsys_solaris.go create mode 100644 vendor/golang.org/x/net/ipv6/batch.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/control.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/control_rfc2292_unix.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/control_rfc3542_unix.go (97%) create mode 100644 vendor/golang.org/x/net/ipv6/control_stub.go create mode 100644 vendor/golang.org/x/net/ipv6/control_unix.go create mode 100644 vendor/golang.org/x/net/ipv6/control_windows.go create mode 100644 vendor/golang.org/x/net/ipv6/dgramopt.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/doc.go (100%) create mode 100644 vendor/golang.org/x/net/ipv6/endpoint.go create mode 100644 vendor/golang.org/x/net/ipv6/genericopt.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/header.go (100%) create mode 100644 vendor/golang.org/x/net/ipv6/helper.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/iana.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/icmp.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/icmp_bsd.go (91%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/icmp_linux.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/icmp_solaris.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/icmp_stub.go (83%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/icmp_windows.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/payload.go (100%) create mode 100644 vendor/golang.org/x/net/ipv6/payload_cmsg.go create mode 100644 vendor/golang.org/x/net/ipv6/payload_nocmsg.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/sockopt.go (100%) create mode 100644 vendor/golang.org/x/net/ipv6/sockopt_posix.go create mode 100644 vendor/golang.org/x/net/ipv6/sockopt_stub.go create mode 100644 vendor/golang.org/x/net/ipv6/sys_aix.go create mode 100644 vendor/golang.org/x/net/ipv6/sys_asmreq.go create mode 100644 vendor/golang.org/x/net/ipv6/sys_asmreq_stub.go create mode 100644 vendor/golang.org/x/net/ipv6/sys_bpf.go create mode 100644 vendor/golang.org/x/net/ipv6/sys_bpf_stub.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/sys_bsd.go (100%) create mode 100644 vendor/golang.org/x/net/ipv6/sys_darwin.go create mode 100644 vendor/golang.org/x/net/ipv6/sys_freebsd.go create mode 100644 vendor/golang.org/x/net/ipv6/sys_linux.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/sys_solaris.go (100%) create mode 100644 vendor/golang.org/x/net/ipv6/sys_ssmreq.go create mode 100644 vendor/golang.org/x/net/ipv6/sys_ssmreq_stub.go create mode 100644 vendor/golang.org/x/net/ipv6/sys_stub.go rename vendor/{github.com/hashicorp/go-discover/provider/mdns/vendor => }/golang.org/x/net/ipv6/sys_windows.go (100%) create mode 100644 vendor/golang.org/x/net/ipv6/zsys_aix_ppc64.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_darwin.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_dragonfly.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_freebsd_386.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_freebsd_amd64.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_freebsd_arm.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_freebsd_arm64.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_linux_386.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_linux_amd64.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_linux_arm.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_linux_arm64.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_linux_mips.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_linux_mips64.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_linux_mips64le.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_linux_mipsle.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_linux_ppc.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_linux_ppc64.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_linux_ppc64le.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_linux_riscv64.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_linux_s390x.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_netbsd.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_openbsd.go create mode 100644 vendor/golang.org/x/net/ipv6/zsys_solaris.go delete mode 100644 vendor/golang.org/x/net/proxy/dial.go delete mode 100644 vendor/golang.org/x/net/proxy/direct.go delete mode 100644 vendor/golang.org/x/net/proxy/per_host.go delete mode 100644 vendor/golang.org/x/net/proxy/proxy.go delete mode 100644 vendor/golang.org/x/net/proxy/socks5.go rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/golang.org/x/net/publicsuffix/list.go (97%) create mode 100644 vendor/golang.org/x/net/publicsuffix/table.go create mode 100644 vendor/golang.org/x/oauth2/.travis.yml create mode 100644 vendor/golang.org/x/sync/AUTHORS create mode 100644 vendor/golang.org/x/sync/CONTRIBUTORS create mode 100644 vendor/golang.org/x/sync/semaphore/semaphore.go create mode 100644 vendor/golang.org/x/sys/AUTHORS create mode 100644 vendor/golang.org/x/sys/CONTRIBUTORS create mode 100644 vendor/golang.org/x/sys/cpu/cpu_aix.go delete mode 100644 vendor/golang.org/x/sys/cpu/cpu_aix_ppc64.go create mode 100644 vendor/golang.org/x/sys/cpu/syscall_aix_gccgo.go create mode 100644 vendor/golang.org/x/sys/internal/unsafeheader/unsafeheader.go create mode 100644 vendor/golang.org/x/sys/unix/.gitignore mode change 100755 => 100644 vendor/golang.org/x/sys/unix/mkall.sh mode change 100755 => 100644 vendor/golang.org/x/sys/unix/mkerrors.sh mode change 100755 => 100644 vendor/golang.org/x/sys/windows/mkerrors.bash mode change 100755 => 100644 vendor/golang.org/x/sys/windows/mkknownfolderids.bash create mode 100644 vendor/golang.org/x/text/AUTHORS create mode 100644 vendor/golang.org/x/text/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/text/internal/internal.go delete mode 100644 vendor/golang.org/x/text/internal/match.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/base.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/cldr.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/collate.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/decode.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/resolve.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/slice.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/xml.go delete mode 100644 vendor/golang.org/x/text/width/kind_string.go delete mode 100644 vendor/golang.org/x/text/width/tables10.0.0.go delete mode 100644 vendor/golang.org/x/text/width/tables11.0.0.go delete mode 100644 vendor/golang.org/x/text/width/tables12.0.0.go delete mode 100644 vendor/golang.org/x/text/width/tables9.0.0.go delete mode 100644 vendor/golang.org/x/text/width/transform.go delete mode 100644 vendor/golang.org/x/text/width/trieval.go delete mode 100644 vendor/golang.org/x/text/width/width.go create mode 100644 vendor/golang.org/x/time/AUTHORS create mode 100644 vendor/golang.org/x/time/CONTRIBUTORS create mode 100644 vendor/golang.org/x/tools/AUTHORS create mode 100644 vendor/golang.org/x/tools/CONTRIBUTORS rename vendor/{github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2 => golang.org/x/tools}/LICENSE (100%) rename vendor/{github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/net => golang.org/x/tools}/PATENTS (100%) create mode 100644 vendor/golang.org/x/tools/cmd/goimports/doc.go create mode 100644 vendor/golang.org/x/tools/cmd/goimports/goimports.go create mode 100644 vendor/golang.org/x/tools/cmd/goimports/goimports_gc.go create mode 100644 vendor/golang.org/x/tools/cmd/goimports/goimports_not_gc.go create mode 100644 vendor/golang.org/x/tools/go/analysis/analysis.go create mode 100644 vendor/golang.org/x/tools/go/analysis/diagnostic.go create mode 100644 vendor/golang.org/x/tools/go/analysis/doc.go create mode 100644 vendor/golang.org/x/tools/go/analysis/passes/inspect/inspect.go create mode 100644 vendor/golang.org/x/tools/go/analysis/validate.go create mode 100644 vendor/golang.org/x/tools/go/ast/astutil/enclosing.go create mode 100644 vendor/golang.org/x/tools/go/ast/astutil/imports.go create mode 100644 vendor/golang.org/x/tools/go/ast/astutil/rewrite.go create mode 100644 vendor/golang.org/x/tools/go/ast/astutil/util.go create mode 100644 vendor/golang.org/x/tools/go/ast/inspector/inspector.go create mode 100644 vendor/golang.org/x/tools/go/ast/inspector/typeof.go create mode 100644 vendor/golang.org/x/tools/go/buildutil/allpackages.go create mode 100644 vendor/golang.org/x/tools/go/buildutil/fakecontext.go create mode 100644 vendor/golang.org/x/tools/go/buildutil/overlay.go create mode 100644 vendor/golang.org/x/tools/go/buildutil/tags.go create mode 100644 vendor/golang.org/x/tools/go/buildutil/util.go create mode 100644 vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go create mode 100644 vendor/golang.org/x/tools/go/gcexportdata/importer.go create mode 100644 vendor/golang.org/x/tools/go/internal/cgo/cgo.go create mode 100644 vendor/golang.org/x/tools/go/internal/cgo/cgo_pkgconfig.go create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/exportdata.go create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/gcimporter.go create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/iexport.go create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go create mode 100644 vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go create mode 100644 vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go create mode 100644 vendor/golang.org/x/tools/go/loader/doc.go create mode 100644 vendor/golang.org/x/tools/go/loader/loader.go create mode 100644 vendor/golang.org/x/tools/go/loader/util.go create mode 100644 vendor/golang.org/x/tools/go/packages/doc.go create mode 100644 vendor/golang.org/x/tools/go/packages/external.go create mode 100644 vendor/golang.org/x/tools/go/packages/golist.go create mode 100644 vendor/golang.org/x/tools/go/packages/golist_overlay.go create mode 100644 vendor/golang.org/x/tools/go/packages/loadmode_string.go create mode 100644 vendor/golang.org/x/tools/go/packages/packages.go create mode 100644 vendor/golang.org/x/tools/go/packages/visit.go create mode 100644 vendor/golang.org/x/tools/go/types/objectpath/objectpath.go create mode 100644 vendor/golang.org/x/tools/go/types/typeutil/callee.go create mode 100644 vendor/golang.org/x/tools/go/types/typeutil/imports.go create mode 100644 vendor/golang.org/x/tools/go/types/typeutil/map.go create mode 100644 vendor/golang.org/x/tools/go/types/typeutil/methodsetcache.go create mode 100644 vendor/golang.org/x/tools/go/types/typeutil/ui.go create mode 100644 vendor/golang.org/x/tools/internal/analysisinternal/analysis.go create mode 100644 vendor/golang.org/x/tools/internal/event/core/event.go create mode 100644 vendor/golang.org/x/tools/internal/event/core/export.go create mode 100644 vendor/golang.org/x/tools/internal/event/core/fast.go create mode 100644 vendor/golang.org/x/tools/internal/event/doc.go create mode 100644 vendor/golang.org/x/tools/internal/event/event.go create mode 100644 vendor/golang.org/x/tools/internal/event/keys/keys.go create mode 100644 vendor/golang.org/x/tools/internal/event/keys/standard.go create mode 100644 vendor/golang.org/x/tools/internal/event/label/label.go create mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk.go create mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_fileno.go create mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_ino.go create mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_bsd.go create mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_dirent_namlen_linux.go create mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_portable.go create mode 100644 vendor/golang.org/x/tools/internal/fastwalk/fastwalk_unix.go create mode 100644 vendor/golang.org/x/tools/internal/gocommand/invoke.go create mode 100644 vendor/golang.org/x/tools/internal/gopathwalk/walk.go create mode 100644 vendor/golang.org/x/tools/internal/imports/fix.go create mode 100644 vendor/golang.org/x/tools/internal/imports/imports.go create mode 100644 vendor/golang.org/x/tools/internal/imports/mod.go create mode 100644 vendor/golang.org/x/tools/internal/imports/mod_cache.go create mode 100644 vendor/golang.org/x/tools/internal/imports/sortimports.go create mode 100644 vendor/golang.org/x/tools/internal/imports/zstdlib.go create mode 100644 vendor/golang.org/x/tools/internal/packagesinternal/packages.go create mode 100644 vendor/golang.org/x/xerrors/LICENSE rename vendor/{github.com/hashicorp/go-discover/provider/gce/vendor/golang.org/x/text => golang.org/x/xerrors}/PATENTS (100%) create mode 100644 vendor/golang.org/x/xerrors/README create mode 100644 vendor/golang.org/x/xerrors/adaptor.go create mode 100644 vendor/golang.org/x/xerrors/codereview.cfg create mode 100644 vendor/golang.org/x/xerrors/doc.go create mode 100644 vendor/golang.org/x/xerrors/errors.go create mode 100644 vendor/golang.org/x/xerrors/fmt.go create mode 100644 vendor/golang.org/x/xerrors/format.go create mode 100644 vendor/golang.org/x/xerrors/frame.go create mode 100644 vendor/golang.org/x/xerrors/go.mod create mode 100644 vendor/golang.org/x/xerrors/internal/internal.go create mode 100644 vendor/golang.org/x/xerrors/wrap.go create mode 100644 vendor/google.golang.org/api/AUTHORS create mode 100644 vendor/google.golang.org/api/CONTRIBUTORS create mode 100644 vendor/google.golang.org/api/compute/v1/compute-api.json create mode 100644 vendor/google.golang.org/api/compute/v1/compute-gen.go delete mode 100644 vendor/google.golang.org/api/gensupport/doc.go delete mode 100644 vendor/google.golang.org/api/gensupport/jsonfloat.go rename vendor/google.golang.org/api/{ => internal}/gensupport/buffer.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/api => google.golang.org/api/internal}/gensupport/doc.go (100%) rename vendor/google.golang.org/api/{ => internal}/gensupport/json.go (100%) create mode 100644 vendor/google.golang.org/api/internal/gensupport/jsonfloat.go rename vendor/google.golang.org/api/{ => internal}/gensupport/media.go (100%) rename vendor/google.golang.org/api/{ => internal}/gensupport/params.go (100%) rename vendor/google.golang.org/api/{ => internal}/gensupport/resumable.go (100%) rename vendor/google.golang.org/api/{ => internal}/gensupport/send.go (100%) create mode 100644 vendor/google.golang.org/api/support/bundler/bundler.go create mode 100644 vendor/google.golang.org/appengine/.travis.yml rename vendor/{github.com/hashicorp/go-discover/provider/gce/vendor => }/google.golang.org/appengine/CONTRIBUTING.md (100%) rename vendor/{github.com/hashicorp/go-discover/provider/softlayer/vendor/github.com/softlayer/softlayer-go => google.golang.org/appengine}/LICENSE (100%) create mode 100644 vendor/google.golang.org/appengine/README.md create mode 100644 vendor/google.golang.org/appengine/appengine.go rename vendor/{github.com/hashicorp/go-discover/provider/gce/vendor => }/google.golang.org/appengine/appengine_vm.go (100%) create mode 100644 vendor/google.golang.org/appengine/datastore/datastore.go create mode 100644 vendor/google.golang.org/appengine/datastore/doc.go create mode 100644 vendor/google.golang.org/appengine/datastore/internal/cloudkey/cloudkey.go create mode 100644 vendor/google.golang.org/appengine/datastore/internal/cloudpb/entity.pb.go create mode 100644 vendor/google.golang.org/appengine/datastore/key.go create mode 100644 vendor/google.golang.org/appengine/datastore/keycompat.go create mode 100644 vendor/google.golang.org/appengine/datastore/load.go create mode 100644 vendor/google.golang.org/appengine/datastore/metadata.go create mode 100644 vendor/google.golang.org/appengine/datastore/prop.go create mode 100644 vendor/google.golang.org/appengine/datastore/query.go create mode 100644 vendor/google.golang.org/appengine/datastore/save.go create mode 100644 vendor/google.golang.org/appengine/datastore/transaction.go rename vendor/{github.com/hashicorp/go-discover/provider/gce/vendor => }/google.golang.org/appengine/errors.go (100%) create mode 100644 vendor/google.golang.org/appengine/go.mod create mode 100644 vendor/google.golang.org/appengine/go.sum rename vendor/{github.com/hashicorp/go-discover/provider/gce/vendor => }/google.golang.org/appengine/identity.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/api.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/api_classic.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/digitalocean/vendor => }/google.golang.org/appengine/internal/api_common.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/digitalocean/vendor => }/google.golang.org/appengine/internal/app_id.go (100%) create mode 100644 vendor/google.golang.org/appengine/internal/app_identity/app_identity_service.pb.go rename vendor/{github.com/hashicorp/go-discover/provider/gce/vendor => }/google.golang.org/appengine/internal/app_identity/app_identity_service.proto (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/base/api_base.pb.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/digitalocean/vendor => }/google.golang.org/appengine/internal/base/api_base.proto (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/datastore/datastore_v3.proto (100%) mode change 100755 => 100644 rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/identity.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/identity_classic.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/identity_flex.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/identity_vm.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/digitalocean/vendor => }/google.golang.org/appengine/internal/internal.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/log/log_service.pb.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/digitalocean/vendor => }/google.golang.org/appengine/internal/log/log_service.proto (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/main.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/main_common.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/main_vm.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/metadata.go (100%) create mode 100644 vendor/google.golang.org/appengine/internal/modules/modules_service.pb.go rename vendor/{github.com/hashicorp/go-discover/provider/gce/vendor => }/google.golang.org/appengine/internal/modules/modules_service.proto (100%) rename vendor/{github.com/hashicorp/go-discover/provider/digitalocean/vendor => }/google.golang.org/appengine/internal/net.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/digitalocean/vendor => }/google.golang.org/appengine/internal/regen.sh (100%) mode change 100755 => 100644 rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/remote_api/remote_api.pb.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/digitalocean/vendor => }/google.golang.org/appengine/internal/remote_api/remote_api.proto (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/transaction.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/digitalocean/vendor => }/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto (100%) rename vendor/{github.com/hashicorp/go-discover/provider/gce/vendor => }/google.golang.org/appengine/namespace.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/gce/vendor => }/google.golang.org/appengine/timeout.go (100%) create mode 100644 vendor/google.golang.org/appengine/travis_install.sh create mode 100644 vendor/google.golang.org/appengine/travis_test.sh rename vendor/{github.com/hashicorp/go-discover/provider/digitalocean/vendor => }/google.golang.org/appengine/urlfetch/urlfetch.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/vsphere/vendor/github.com/vmware/govmomi/LICENSE.txt => google.golang.org/genproto/LICENSE} (100%) create mode 100644 vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go create mode 100644 vendor/google.golang.org/genproto/protobuf/field_mask/field_mask.pb.go create mode 100644 vendor/google.golang.org/grpc/.travis.yml mode change 100755 => 100644 vendor/google.golang.org/grpc/codegen.sh mode change 100755 => 100644 vendor/google.golang.org/grpc/health/regenerate.sh mode change 100755 => 100644 vendor/google.golang.org/grpc/install_gae.sh mode change 100755 => 100644 vendor/google.golang.org/grpc/internal/binarylog/regenerate.sh mode change 100755 => 100644 vendor/google.golang.org/grpc/vet.sh create mode 100644 vendor/gopkg.in/fsnotify.v1/.editorconfig create mode 100644 vendor/gopkg.in/fsnotify.v1/.gitignore create mode 100644 vendor/gopkg.in/fsnotify.v1/.travis.yml delete mode 100644 vendor/gopkg.in/inf.v0/LICENSE delete mode 100644 vendor/gopkg.in/inf.v0/dec.go delete mode 100644 vendor/gopkg.in/inf.v0/rounder.go create mode 100644 vendor/gopkg.in/resty.v1/.gitignore create mode 100644 vendor/gopkg.in/resty.v1/.travis.yml rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/BUILD.bazel (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/LICENSE (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/README.md (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/WORKSPACE (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/client.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/default.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/go.mod (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/middleware.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/redirect.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/request.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/request16.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/request17.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/response.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/resty.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/retry.go (100%) rename vendor/{github.com/hashicorp/go-discover/provider/linode/vendor => }/gopkg.in/resty.v1/util.go (100%) create mode 100644 vendor/gopkg.in/square/go-jose.v2/.gitcookies.sh.enc create mode 100644 vendor/gopkg.in/square/go-jose.v2/.gitignore create mode 100644 vendor/gopkg.in/square/go-jose.v2/.travis.yml create mode 100644 vendor/gopkg.in/yaml.v2/.travis.yml create mode 100644 vendor/gopkg.in/yaml.v2/NOTICE create mode 100644 vendor/gopkg.in/yaml.v2/go.mod create mode 100644 vendor/honnef.co/go/tools/LICENSE create mode 100644 vendor/honnef.co/go/tools/LICENSE-THIRD-PARTY create mode 100644 vendor/honnef.co/go/tools/arg/arg.go create mode 100644 vendor/honnef.co/go/tools/cmd/staticcheck/README.md create mode 100644 vendor/honnef.co/go/tools/cmd/staticcheck/staticcheck.go create mode 100644 vendor/honnef.co/go/tools/code/code.go create mode 100644 vendor/honnef.co/go/tools/config/config.go create mode 100644 vendor/honnef.co/go/tools/config/example.conf create mode 100644 vendor/honnef.co/go/tools/deprecated/stdlib.go create mode 100644 vendor/honnef.co/go/tools/edit/edit.go create mode 100644 vendor/honnef.co/go/tools/facts/deprecated.go create mode 100644 vendor/honnef.co/go/tools/facts/generated.go create mode 100644 vendor/honnef.co/go/tools/facts/purity.go create mode 100644 vendor/honnef.co/go/tools/facts/token.go create mode 100644 vendor/honnef.co/go/tools/functions/loops.go create mode 100644 vendor/honnef.co/go/tools/functions/stub.go create mode 100644 vendor/honnef.co/go/tools/functions/terminates.go create mode 100644 vendor/honnef.co/go/tools/go/types/typeutil/callee.go create mode 100644 vendor/honnef.co/go/tools/go/types/typeutil/identical.go create mode 100644 vendor/honnef.co/go/tools/go/types/typeutil/imports.go create mode 100644 vendor/honnef.co/go/tools/go/types/typeutil/map.go create mode 100644 vendor/honnef.co/go/tools/go/types/typeutil/methodsetcache.go create mode 100644 vendor/honnef.co/go/tools/go/types/typeutil/ui.go create mode 100644 vendor/honnef.co/go/tools/internal/cache/cache.go create mode 100644 vendor/honnef.co/go/tools/internal/cache/default.go create mode 100644 vendor/honnef.co/go/tools/internal/cache/hash.go create mode 100644 vendor/honnef.co/go/tools/internal/passes/buildir/buildir.go create mode 100644 vendor/honnef.co/go/tools/internal/renameio/renameio.go create mode 100644 vendor/honnef.co/go/tools/internal/robustio/robustio.go create mode 100644 vendor/honnef.co/go/tools/internal/robustio/robustio_darwin.go create mode 100644 vendor/honnef.co/go/tools/internal/robustio/robustio_flaky.go create mode 100644 vendor/honnef.co/go/tools/internal/robustio/robustio_other.go create mode 100644 vendor/honnef.co/go/tools/internal/robustio/robustio_windows.go create mode 100644 vendor/honnef.co/go/tools/internal/sharedcheck/lint.go create mode 100644 vendor/honnef.co/go/tools/ir/LICENSE create mode 100644 vendor/honnef.co/go/tools/ir/blockopt.go create mode 100644 vendor/honnef.co/go/tools/ir/builder.go create mode 100644 vendor/honnef.co/go/tools/ir/const.go create mode 100644 vendor/honnef.co/go/tools/ir/create.go create mode 100644 vendor/honnef.co/go/tools/ir/doc.go create mode 100644 vendor/honnef.co/go/tools/ir/dom.go create mode 100644 vendor/honnef.co/go/tools/ir/emit.go create mode 100644 vendor/honnef.co/go/tools/ir/exits.go create mode 100644 vendor/honnef.co/go/tools/ir/func.go create mode 100644 vendor/honnef.co/go/tools/ir/html.go create mode 100644 vendor/honnef.co/go/tools/ir/identical.go create mode 100644 vendor/honnef.co/go/tools/ir/identical_17.go create mode 100644 vendor/honnef.co/go/tools/ir/irutil/load.go create mode 100644 vendor/honnef.co/go/tools/ir/irutil/switch.go create mode 100644 vendor/honnef.co/go/tools/ir/irutil/util.go create mode 100644 vendor/honnef.co/go/tools/ir/irutil/visit.go create mode 100644 vendor/honnef.co/go/tools/ir/lift.go create mode 100644 vendor/honnef.co/go/tools/ir/lvalue.go create mode 100644 vendor/honnef.co/go/tools/ir/methods.go create mode 100644 vendor/honnef.co/go/tools/ir/mode.go create mode 100644 vendor/honnef.co/go/tools/ir/print.go create mode 100644 vendor/honnef.co/go/tools/ir/sanity.go create mode 100644 vendor/honnef.co/go/tools/ir/source.go create mode 100644 vendor/honnef.co/go/tools/ir/ssa.go create mode 100644 vendor/honnef.co/go/tools/ir/staticcheck.conf create mode 100644 vendor/honnef.co/go/tools/ir/util.go create mode 100644 vendor/honnef.co/go/tools/ir/wrappers.go create mode 100644 vendor/honnef.co/go/tools/ir/write.go create mode 100644 vendor/honnef.co/go/tools/lint/LICENSE create mode 100644 vendor/honnef.co/go/tools/lint/lint.go create mode 100644 vendor/honnef.co/go/tools/lint/lintdsl/lintdsl.go create mode 100644 vendor/honnef.co/go/tools/lint/lintutil/format/format.go create mode 100644 vendor/honnef.co/go/tools/lint/lintutil/stats.go create mode 100644 vendor/honnef.co/go/tools/lint/lintutil/stats_bsd.go create mode 100644 vendor/honnef.co/go/tools/lint/lintutil/stats_posix.go create mode 100644 vendor/honnef.co/go/tools/lint/lintutil/util.go create mode 100644 vendor/honnef.co/go/tools/lint/runner.go create mode 100644 vendor/honnef.co/go/tools/lint/stats.go create mode 100644 vendor/honnef.co/go/tools/loader/loader.go create mode 100644 vendor/honnef.co/go/tools/pattern/convert.go create mode 100644 vendor/honnef.co/go/tools/pattern/doc.go create mode 100644 vendor/honnef.co/go/tools/pattern/fuzz.go create mode 100644 vendor/honnef.co/go/tools/pattern/lexer.go create mode 100644 vendor/honnef.co/go/tools/pattern/match.go create mode 100644 vendor/honnef.co/go/tools/pattern/parser.go create mode 100644 vendor/honnef.co/go/tools/pattern/pattern.go create mode 100644 vendor/honnef.co/go/tools/printf/fuzz.go create mode 100644 vendor/honnef.co/go/tools/printf/printf.go create mode 100644 vendor/honnef.co/go/tools/report/report.go create mode 100644 vendor/honnef.co/go/tools/simple/analysis.go create mode 100644 vendor/honnef.co/go/tools/simple/doc.go create mode 100644 vendor/honnef.co/go/tools/simple/lint.go create mode 100644 vendor/honnef.co/go/tools/staticcheck/analysis.go create mode 100644 vendor/honnef.co/go/tools/staticcheck/buildtag.go create mode 100644 vendor/honnef.co/go/tools/staticcheck/doc.go create mode 100644 vendor/honnef.co/go/tools/staticcheck/lint.go create mode 100644 vendor/honnef.co/go/tools/staticcheck/rules.go create mode 100644 vendor/honnef.co/go/tools/staticcheck/structtag.go create mode 100644 vendor/honnef.co/go/tools/stylecheck/analysis.go create mode 100644 vendor/honnef.co/go/tools/stylecheck/doc.go create mode 100644 vendor/honnef.co/go/tools/stylecheck/lint.go create mode 100644 vendor/honnef.co/go/tools/stylecheck/names.go create mode 100644 vendor/honnef.co/go/tools/unused/edge.go create mode 100644 vendor/honnef.co/go/tools/unused/edgekind_string.go create mode 100644 vendor/honnef.co/go/tools/unused/implements.go create mode 100644 vendor/honnef.co/go/tools/unused/unused.go create mode 100644 vendor/honnef.co/go/tools/version/buildinfo.go create mode 100644 vendor/honnef.co/go/tools/version/buildinfo111.go create mode 100644 vendor/honnef.co/go/tools/version/version.go create mode 100644 vendor/modules.txt delete mode 100644 vendor/vendor.json diff --git a/.circleci/config.yml b/.circleci/config.yml index 15d665df8164..1e7e646e8b1b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,6 +17,7 @@ jobs: - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat + - GOTEST_MOD: '' - GOTEST_PKGS: ./nomad/... - GOTEST_PKGS_EXCLUDE: '' - GOTESTARCH: amd64 @@ -109,7 +110,12 @@ jobs: mkdir -p /tmp/test-reports sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make generate-structs - sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + + if [ ! -z $GOTEST_MOD ]; then + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad-module + else + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + fi name: Running Nomad Tests no_output_timeout: 20m - store_test_results: @@ -129,7 +135,8 @@ jobs: - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat - - GOTEST_PKGS: ./api/... + - GOTEST_MOD: api + - GOTEST_PKGS: '' - GOTEST_PKGS_EXCLUDE: '' - GOTESTARCH: amd64 steps: @@ -221,7 +228,12 @@ jobs: mkdir -p /tmp/test-reports sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make generate-structs - sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + + if [ ! -z $GOTEST_MOD ]; then + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad-module + else + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + fi name: Running Nomad Tests no_output_timeout: 20m - store_test_results: @@ -241,6 +253,7 @@ jobs: - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat + - GOTEST_MOD: '' - GOTEST_PKGS: ./drivers/exec - GOTEST_PKGS_EXCLUDE: '' - GOTESTARCH: amd64 @@ -333,7 +346,12 @@ jobs: mkdir -p /tmp/test-reports sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make generate-structs - sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + + if [ ! -z $GOTEST_MOD ]; then + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad-module + else + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + fi name: Running Nomad Tests no_output_timeout: 20m - store_test_results: @@ -353,6 +371,7 @@ jobs: - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat + - GOTEST_MOD: '' - GOTEST_PKGS: ./client/... - GOTEST_PKGS_EXCLUDE: '' - GOTESTARCH: amd64 @@ -445,7 +464,12 @@ jobs: mkdir -p /tmp/test-reports sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make generate-structs - sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + + if [ ! -z $GOTEST_MOD ]; then + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad-module + else + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + fi name: Running Nomad Tests no_output_timeout: 20m - store_test_results: @@ -570,6 +594,7 @@ jobs: - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat + - GOTEST_MOD: '' - GOTEST_PKGS: ./drivers/shared/executor - GOTEST_PKGS_EXCLUDE: '' - GOTESTARCH: amd64 @@ -662,7 +687,12 @@ jobs: mkdir -p /tmp/test-reports sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make generate-structs - sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + + if [ ! -z $GOTEST_MOD ]; then + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad-module + else + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + fi name: Running Nomad Tests no_output_timeout: 20m - store_test_results: @@ -773,6 +803,7 @@ jobs: - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat + - GOTEST_MOD: '' - GOTEST_PKGS: '' - GOTEST_PKGS_EXCLUDE: ./api|./client|./drivers/docker|./drivers/exec|./drivers/shared/executor|./nomad|./devices - GOTESTARCH: amd64 @@ -865,7 +896,12 @@ jobs: mkdir -p /tmp/test-reports sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make generate-structs - sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + + if [ ! -z $GOTEST_MOD ]; then + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad-module + else + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + fi name: Running Nomad Tests no_output_timeout: 20m - store_test_results: @@ -941,7 +977,12 @@ jobs: mkdir -p /tmp/test-reports sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make generate-structs - sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + + if [ ! -z $GOTEST_MOD ]; then + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad-module + else + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + fi name: Running Nomad Tests no_output_timeout: 20m - store_test_results: @@ -990,7 +1031,7 @@ jobs: - run: command: brew install protobuf - run: - command: sudo -E PATH="$GOPATH/bin:${HOME}/goinstall/go/bin:$PATH" make generate-structs + command: PATH="$GOPATH/bin:${HOME}/goinstall/go/bin:$PATH" make generate-structs - run: command: source ${BASH_ENV} && make pkg/darwin_amd64.zip - store_artifacts: @@ -1018,6 +1059,7 @@ jobs: - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat + - GOTEST_MOD: '' - GOTEST_PKGS: ./drivers/docker - GOTEST_PKGS_EXCLUDE: '' - GOTESTARCH: amd64 @@ -1110,7 +1152,12 @@ jobs: mkdir -p /tmp/test-reports sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make generate-structs - sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + + if [ ! -z $GOTEST_MOD ]; then + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad-module + else + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + fi name: Running Nomad Tests no_output_timeout: 20m - store_test_results: @@ -1192,6 +1239,7 @@ jobs: - GOTESTSUM_JUNITFILE: /tmp/test-reports/results.xml - NOMAD_SLOW_TEST: 1 - PAGER: cat + - GOTEST_MOD: '' - GOTEST_PKGS: ./client/fingerprint - GOTEST_PKGS_EXCLUDE: '' - GOTESTARCH: '386' @@ -1284,7 +1332,12 @@ jobs: mkdir -p /tmp/test-reports sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make generate-structs - sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + + if [ ! -z $GOTEST_MOD ]; then + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad-module + else + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + fi name: Running Nomad Tests no_output_timeout: 20m - store_test_results: diff --git a/.circleci/config/commands/run-tests.yml b/.circleci/config/commands/run-tests.yml index 9a90841d382b..a67ee28bf3a2 100644 --- a/.circleci/config/commands/run-tests.yml +++ b/.circleci/config/commands/run-tests.yml @@ -16,4 +16,9 @@ steps: mkdir -p /tmp/test-reports sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make generate-structs - sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + + if [ ! -z $GOTEST_MOD ]; then + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad-module + else + sudo -E PATH="$GOPATH/bin:/usr/local/go/bin:$PATH" make test-nomad + fi diff --git a/.circleci/config/jobs/build-darwin-binaries.yml b/.circleci/config/jobs/build-darwin-binaries.yml index 8b5b45403f5b..e4a744baa195 100644 --- a/.circleci/config/jobs/build-darwin-binaries.yml +++ b/.circleci/config/jobs/build-darwin-binaries.yml @@ -10,7 +10,7 @@ steps: target_directory: ~/goinstall - run: source ${BASH_ENV} && make deps - run: brew install protobuf - - run: sudo -E PATH="$GOPATH/bin:${HOME}/goinstall/go/bin:$PATH" make generate-structs + - run: PATH="$GOPATH/bin:${HOME}/goinstall/go/bin:$PATH" make generate-structs - run: source ${BASH_ENV} && make pkg/darwin_amd64.zip - store_artifacts: path: pkg/darwin_amd64.zip diff --git a/.circleci/config/jobs/test-machine.yml b/.circleci/config/jobs/test-machine.yml index 755a99fcc3b5..0cf1e5ae1e65 100644 --- a/.circleci/config/jobs/test-machine.yml +++ b/.circleci/config/jobs/test-machine.yml @@ -3,6 +3,9 @@ parameters: test_packages: type: string default: "" + test_module: + type: string + default: "" exclude_packages: type: string default: "" @@ -15,6 +18,7 @@ parameters: environment: GOTEST_PKGS_EXCLUDE: "<< parameters.exclude_packages >>" GOTEST_PKGS: "<< parameters.test_packages >>" + GOTEST_MOD: "<< parameters.test_module >>" GOTESTARCH: "<< parameters.goarch >>" steps: - checkout diff --git a/.circleci/config/workflows/build-test.yml b/.circleci/config/workflows/build-test.yml index edc16ecb713f..4db9bc604bc0 100644 --- a/.circleci/config/workflows/build-test.yml +++ b/.circleci/config/workflows/build-test.yml @@ -32,7 +32,7 @@ jobs: # API Tests run in a VM rather than container due to the FS tests # requiring `mount` priviliges. name: "test-api" - test_packages: "./api/..." + test_module: "api" filters: *backend_branches_filter - test-container: name: "test-devices" diff --git a/.gitignore b/.gitignore index 37c9d242fbf3..88350849c11a 100644 --- a/.gitignore +++ b/.gitignore @@ -60,6 +60,7 @@ nomad_linux_amd64 nomad_darwin_amd64 TODO.md codecgen-*.generated.go +**/structs.generated.go GNUMakefile.local .terraform @@ -104,3 +105,6 @@ azure-hashistack.pem # generated keys for e2e tests e2e/terraform/keys/ + +# darwin CGO files copied for build +vendor/github.com/shirou/gopsutil/host/include/ diff --git a/GNUmakefile b/GNUmakefile index 2fcff3db605e..08a592333239 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -44,6 +44,9 @@ endif # On MacOS, we only build for MacOS ifeq (Darwin,$(THIS_OS)) ALL_TARGETS += darwin_amd64 +# Copy CGO files for darwin into place +# TODO(shoenig) remove pending github.com/shirou/gopsutil/pull/885 +$(shell cp -R lib/darwin/include vendor/github.com/shirou/gopsutil/host) endif # On FreeBSD, we only build for FreeBSD @@ -166,22 +169,22 @@ bootstrap: deps lint-deps git-hooks # Install all dependencies .PHONY: deps deps: ## Install build and development dependencies +## Keep versions in sync with tools/go.mod for now (see https://github.com/golang/go/issues/30515) @echo "==> Updating build dependencies..." - GO111MODULE=on go get -u github.com/kardianos/govendor - GO111MODULE=on go get -u github.com/hashicorp/go-bindata/go-bindata@master - GO111MODULE=on go get -u github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs@master - GO111MODULE=on go get -u github.com/a8m/tree/cmd/tree - GO111MODULE=on go get -u github.com/magiconair/vendorfmt/cmd/vendorfmt - GO111MODULE=on go get -u gotest.tools/gotestsum - GO111MODULE=on go get -u github.com/hashicorp/hcl/v2/cmd/hclfmt@v2.5.1 - GO111MODULE=on go get -u github.com/golang/protobuf/protoc-gen-go@v1.3.4 - GO111MODULE=on go get -u github.com/hashicorp/go-msgpack/codec/codecgen@v1.1.5 + GO111MODULE=on cd tools && go get github.com/hashicorp/go-bindata/go-bindata@v3.0.7+incompatible + GO111MODULE=on cd tools && go get github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs@v1.0.0 + GO111MODULE=on cd tools && go get github.com/a8m/tree/cmd/tree + GO111MODULE=on cd tools && go get gotest.tools/gotestsum@v0.4.2 + GO111MODULE=on cd tools && go get github.com/hashicorp/hcl/v2/cmd/hclfmt@v2.5.1 + GO111MODULE=on cd tools && go get github.com/golang/protobuf/protoc-gen-go@v1.3.4 + GO111MODULE=on cd tools && go get github.com/hashicorp/go-msgpack/codec/codecgen@v1.1.5 .PHONY: lint-deps lint-deps: ## Install linter dependencies +## Keep versions in sync with tools/go.mod (see https://github.com/golang/go/issues/30515) @echo "==> Updating linter dependencies..." - GO111MODULE=on go get -u github.com/golangci/golangci-lint/cmd/golangci-lint@v1.24.0 - GO111MODULE=on go get -u github.com/client9/misspell/cmd/misspell + GO111MODULE=on cd tools && go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.24.0 + GO111MODULE=on cd tools && go get github.com/client9/misspell/cmd/misspell@v0.3.4 .PHONY: git-hooks git-dir = $(shell git rev-parse --git-dir) @@ -207,10 +210,7 @@ check: ## Lint the source code @if (git status -s | grep -q -e '\.hcl$$' -e '\.nomad$$'); then echo the following HCL files are out of sync; git status -s | grep -e '\.hcl$$' -e '\.nomad$$'; exit 1; fi @echo "==> Check API package is isolated from rest" - @if go list --test -f '{{ join .Deps "\n" }}' ./api | grep github.com/hashicorp/nomad/ | grep -v -e /vendor/ -e /nomad/api/ -e nomad/api.test; then echo " /api package depends the ^^ above internal nomad packages. Remove such dependency"; exit 1; fi - - @echo "==> Check non-vendored packages" - @if go list --test -tags "$(GO_TAGS)" -f '{{join .Deps "\n"}}' . | grep -v github.com/hashicorp/nomad.test | xargs go list -tags "$(GO_TAGS)" -f '{{if not .Standard}}{{.ImportPath}}{{end}}' | grep -v -e github.com/hashicorp/nomad; then echo " found referenced packages ^^ that are not vendored"; exit 1; fi + @cd ./api && if go list --test -f '{{ join .Deps "\n" }}' . | grep github.com/hashicorp/nomad/ | grep -v -e /vendor/ -e /nomad/api/ -e nomad/api.test; then echo " /api package depends the ^^ above internal nomad packages. Remove such dependency"; exit 1; fi .PHONY: checkscripts checkscripts: ## Lint shell scripts @@ -239,11 +239,6 @@ generate-examples: command/job_init.bindata_assetfs.go command/job_init.bindata_assetfs.go: command/assets/* go-bindata-assetfs -pkg command -o command/job_init.bindata_assetfs.go ./command/assets/... -.PHONY: vendorfmt -vendorfmt: - @echo "--> Formatting vendor/vendor.json" - vendorfmt - .PHONY: changelogfmt changelogfmt: @echo "--> Making [GH-xxxx] references clickable..." @@ -257,12 +252,25 @@ hclfmt: @find . -path ./terraform -prune -o -name 'upstart.nomad' -prune -o \( -name '*.nomad' -o -name '*.hcl' \) -exec \ sh -c 'hclfmt -w {} || echo in path {}' ';' +.PHONY: tidy +tidy: + @echo "--> Tidy up submodules" + @cd tools && go mod tidy + @cd api && go mod tidy + @echo "--> Tidy nomad module" + @go mod tidy + +.PHONY: sync +sync: tidy + @echo "--> Sync vendor directory" + @go mod vendor + .PHONY: dev dev: GOOS=$(shell go env GOOS) dev: GOARCH=$(shell go env GOARCH) dev: GOPATH=$(shell go env GOPATH) dev: DEV_TARGET=pkg/$(GOOS)_$(GOARCH)/nomad -dev: vendorfmt changelogfmt hclfmt ## Build for the current development platform +dev: tidy changelogfmt hclfmt ## Build for the current development platform @echo "==> Removing old development build..." @rm -f $(PROJECT_ROOT)/$(DEV_TARGET) @rm -f $(PROJECT_ROOT)/bin/nomad @@ -313,6 +321,19 @@ test-nomad: dev ## Run Nomad test suites bash -C "$(PROJECT_ROOT)/scripts/test_check.sh" ; \ fi +.PHONY: test-nomad-module +test-nomad-module: dev ## Run Nomad test suites on a sub-module + @echo "==> Running Nomad test suites on sub-module:" + @cd $(GOTEST_MOD) && $(if $(ENABLE_RACE),GORACE="strip_path_prefix=$(GOPATH)/src") $(GO_TEST_CMD) \ + $(if $(ENABLE_RACE),-race) $(if $(VERBOSE),-v) \ + -cover \ + -timeout=15m \ + -tags "$(GO_TAGS)" \ + ./... $(if $(VERBOSE), >test.log ; echo $$? > exit-code) + @if [ $(VERBOSE) ] ; then \ + bash -C "$(PROJECT_ROOT)/scripts/test_check.sh" ; \ + fi + .PHONY: e2e-test e2e-test: dev ## Run the Nomad e2e test suite @echo "==> Running Nomad E2E test suites:" @@ -383,7 +404,7 @@ help: ## Display this usage information .PHONY: ui-screenshots ui-screenshots: @echo "==> Collecting UI screenshots..." - # Build the screenshots image if it doesn't exist yet + # Build the screenshots image if it doesn't exist yet @if [[ "$$(docker images -q nomad-ui-screenshots 2> /dev/null)" == "" ]]; then \ docker build --tag="nomad-ui-screenshots" ./scripts/screenshots; \ fi diff --git a/command/job_init.bindata_assetfs.go b/command/job_init.bindata_assetfs.go index 8eb92269158c..6821624255c5 100644 --- a/command/job_init.bindata_assetfs.go +++ b/command/job_init.bindata_assetfs.go @@ -1,27 +1,14 @@ -// Code generated by go-bindata. -// sources: -// command/assets/connect-short.nomad -// command/assets/connect.nomad -// command/assets/example-short.nomad -// command/assets/example.nomad -// DO NOT EDIT! - package command import ( - "github.com/elazarl/go-bindata-assetfs" "bytes" "compress/gzip" "fmt" "io" - "io/ioutil" - "os" - "path/filepath" "strings" - "time" ) -func bindataRead(data []byte, name string) ([]byte, error) { +func bindata_read(data []byte, name string) ([]byte, error) { gz, err := gzip.NewReader(bytes.NewBuffer(data)) if err != nil { return nil, fmt.Errorf("Read %q: %v", name, err) @@ -29,170 +16,62 @@ func bindataRead(data []byte, name string) ([]byte, error) { var buf bytes.Buffer _, err = io.Copy(&buf, gz) - clErr := gz.Close() + gz.Close() if err != nil { return nil, fmt.Errorf("Read %q: %v", name, err) } - if clErr != nil { - return nil, err - } return buf.Bytes(), nil } -type asset struct { - bytes []byte - info os.FileInfo -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} +var _command_assets_connect_short_nomad = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x52\xc1\x6e\xdb\x30\x0c\xbd\xfb\x2b\x08\x61\xd7\x21\x4e\x4f\x6d\x01\x1f\x82\x26\x18\x0a\xac\xe9\xe0\x36\xbb\x0c\x83\x40\x4b\x9c\xad\xa5\x96\x04\x89\x71\x37\x14\xfe\xf7\xc1\x9a\xe7\x3a\xed\x5a\x74\xcb\x45\xf1\x23\xa5\xf7\xf8\xf8\xbe\xbb\x0a\x84\x72\x07\xcb\x1a\x63\x23\xe0\x21\x03\xd0\xc8\xa8\xc8\x32\x85\x08\x05\x7c\x11\x5a\x2d\xc5\xd7\x2c\x03\xa8\x83\x3b\x78\x10\xe8\xcd\xef\x46\x00\x4b\x7c\xef\xc2\x7e\xfc\x02\x68\x9d\x26\x28\x40\x54\xc1\xe8\x9a\x44\x42\xfb\x2c\x1d\x91\x42\x67\x14\x4d\xad\x16\xdb\xd4\x9a\xc8\xdf\x0f\x6f\x8e\x05\xef\x02\x0f\x85\xb3\x3c\x5f\x8a\x6c\x04\x95\xb3\x96\x14\x4f\xb7\x01\xa2\xd1\xa4\x30\xc8\xe9\xdd\x7e\x2c\xf5\x73\x56\xc6\xb8\x07\x71\x4f\x95\x98\xae\xea\x60\x3a\x0a\x03\x83\x76\x6a\x4f\x61\xce\xf1\xcd\xd4\x33\x0a\xd3\x62\x9d\x34\x36\x18\x1b\xa3\x5c\xf0\xd6\xb5\xa8\x17\x49\x32\x85\x41\xf4\x79\xb7\x14\x4f\x78\x47\xee\xd1\xac\xc1\xd6\xca\x61\xd0\x6f\xb5\x6c\xee\x82\x68\x98\xbd\x98\x0f\xcd\xc8\x46\x41\x01\x67\x79\x7e\x32\xa1\xec\xd2\x71\x84\xf6\x6f\xf7\xfe\x51\xe2\xf3\x0d\x9c\xfc\xcb\x06\xa6\x0a\x80\x0f\xee\xc7\xcf\x23\x04\xe0\xe0\x23\x07\xc2\x36\x3e\xc1\x01\x34\x45\x36\x16\xd9\x38\x2b\x5f\xcc\xc5\x9f\xdf\x9d\x53\x78\x27\x2b\x63\xb5\x4c\x42\xa1\x80\xd3\xfc\x34\x3f\xea\xea\xb3\xbf\xfd\x7f\x25\x21\xcf\xd6\xf4\x4a\x4e\xc8\x76\xb3\x09\x2e\xae\x77\xdb\xdb\xcb\xed\x07\x79\xb3\x29\x3f\x5f\x5e\x6c\xe4\xae\xfc\x98\x32\xc3\xec\xcf\x17\x8b\x77\x0f\xdb\xeb\xab\xd5\x5a\xee\x3e\xdd\xdc\x96\x9b\xd5\x95\x5c\xad\xd7\xa5\x4c\xc3\x49\xf4\xa6\x7f\x4c\xcf\xff\xa6\x70\x92\xfe\x42\x16\xfb\xec\x57\x00\x00\x00\xff\xff\x58\x05\x65\x03\xe5\x03\x00\x00") -func (fi bindataFileInfo) Name() string { - return fi.name -} -func (fi bindataFileInfo) Size() int64 { - return fi.size -} -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} -func (fi bindataFileInfo) IsDir() bool { - return false -} -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -var _commandAssetsConnectShortNomad = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x52\xc1\x6e\xdb\x30\x0c\xbd\xfb\x2b\x08\x61\xd7\x21\x4e\x4f\x6d\x01\x1f\x82\x26\x18\x0a\xac\xe9\xe0\x36\xbb\x0c\x83\x40\x4b\x9c\xad\xa5\x96\x04\x89\x71\x37\x14\xfe\xf7\xc1\x9a\xe7\x3a\xed\x5a\x74\xcb\x45\xf1\x23\xa5\xf7\xf8\xf8\xbe\xbb\x0a\x84\x72\x07\xcb\x1a\x63\x23\xe0\x21\x03\xd0\xc8\xa8\xc8\x32\x85\x08\x05\x7c\x11\x5a\x2d\xc5\xd7\x2c\x03\xa8\x83\x3b\x78\x10\xe8\xcd\xef\x46\x00\x4b\x7c\xef\xc2\x7e\xfc\x02\x68\x9d\x26\x28\x40\x54\xc1\xe8\x9a\x44\x42\xfb\x2c\x1d\x91\x42\x67\x14\x4d\xad\x16\xdb\xd4\x9a\xc8\xdf\x0f\x6f\x8e\x05\xef\x02\x0f\x85\xb3\x3c\x5f\x8a\x6c\x04\x95\xb3\x96\x14\x4f\xb7\x01\xa2\xd1\xa4\x30\xc8\xe9\xdd\x7e\x2c\xf5\x73\x56\xc6\xb8\x07\x71\x4f\x95\x98\xae\xea\x60\x3a\x0a\x03\x83\x76\x6a\x4f\x61\xce\xf1\xcd\xd4\x33\x0a\xd3\x62\x9d\x34\x36\x18\x1b\xa3\x5c\xf0\xd6\xb5\xa8\x17\x49\x32\x85\x41\xf4\x79\xb7\x14\x4f\x78\x47\xee\xd1\xac\xc1\xd6\xca\x61\xd0\x6f\xb5\x6c\xee\x82\x68\x98\xbd\x98\x0f\xcd\xc8\x46\x41\x01\x67\x79\x7e\x32\xa1\xec\xd2\x71\x84\xf6\x6f\xf7\xfe\x51\xe2\xf3\x0d\x9c\xfc\xcb\x06\xa6\x0a\x80\x0f\xee\xc7\xcf\x23\x04\xe0\xe0\x23\x07\xc2\x36\x3e\xc1\x01\x34\x45\x36\x16\xd9\x38\x2b\x5f\xcc\xc5\x9f\xdf\x9d\x53\x78\x27\x2b\x63\xb5\x4c\x42\xa1\x80\xd3\xfc\x34\x3f\xea\xea\xb3\xbf\xfd\x7f\x25\x21\xcf\xd6\xf4\x4a\x4e\xc8\x76\xb3\x09\x2e\xae\x77\xdb\xdb\xcb\xed\x07\x79\xb3\x29\x3f\x5f\x5e\x6c\xe4\xae\xfc\x98\x32\xc3\xec\xcf\x17\x8b\x77\x0f\xdb\xeb\xab\xd5\x5a\xee\x3e\xdd\xdc\x96\x9b\xd5\x95\x5c\xad\xd7\xa5\x4c\xc3\x49\xf4\xa6\x7f\x4c\xcf\xff\xa6\x70\x92\xfe\x42\x16\xfb\xec\x57\x00\x00\x00\xff\xff\x58\x05\x65\x03\xe5\x03\x00\x00") - -func commandAssetsConnectShortNomadBytes() ([]byte, error) { - return bindataRead( - _commandAssetsConnectShortNomad, +func command_assets_connect_short_nomad() ([]byte, error) { + return bindata_read( + _command_assets_connect_short_nomad, "command/assets/connect-short.nomad", ) } -func commandAssetsConnectShortNomad() (*asset, error) { - bytes, err := commandAssetsConnectShortNomadBytes() - if err != nil { - return nil, err - } +var _command_assets_connect_nomad = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x7b\x6d\x8f\x1c\xb7\x91\xff\xfb\xfd\x14\x85\xde\x00\x49\xfe\xd8\x9d\x7d\xb0\x15\xdb\xc2\x7f\x0f\x90\x2d\xe7\x4e\x77\xb1\x7c\x90\xe4\xcb\x8b\x20\x58\x71\xba\x6b\x66\xa8\xed\x26\xdb\x24\x7b\x46\x6b\x63\xbf\xfb\xa1\x8a\x45\x36\xbb\x67\x66\x2d\xc9\x87\xc8\x2f\x24\x79\x48\x16\x8b\xf5\xf8\xab\x22\xfb\x14\xde\x6c\xd0\x21\xd4\xca\x80\x35\xed\x3d\x2c\x11\x14\x78\x6d\xd6\x2d\xc2\x3b\xbb\x84\x06\x57\xda\xe8\xa0\xad\x81\x1e\x1d\xac\x74\x8b\x0b\x78\xb3\xd1\x9e\x47\xb5\x07\xa3\x3a\x6c\x4e\x4e\xa1\xaa\xed\x60\x42\xa3\xfc\xa6\x02\x6f\x41\x07\xd8\xe9\xb6\x85\xda\xa1\x0a\x44\x93\xa6\xef\x74\xd8\x40\xd8\x20\xbc\x78\x0e\xca\x34\xf0\x52\x75\x58\x2e\x5c\x9c\x9c\x30\x43\x50\xbd\xb3\xcb\x0a\x7c\x50\xe6\x17\x45\x9b\xd0\x9a\x60\xfb\xf3\xce\xfa\x00\xb5\x35\x2b\xbd\x1e\x9c\x62\xae\x6c\xcf\x7f\x69\xc3\x93\xde\xd9\xe5\xc9\x29\xf8\x1e\x6b\xbd\xd2\x35\xcf\x58\xc0\xb3\xc4\xab\x82\x06\xeb\x56\xd1\xca\x2d\x4e\x67\x81\x5d\x41\x50\xfe\x8e\xf6\x52\x01\x5e\xda\x4e\xd1\xa9\xfc\xc6\x0e\x6d\x03\x6e\x30\x0b\xf8\x4f\xbb\xf4\xb0\x51\x5b\x3a\xcd\xba\xb5\x4b\xd5\xb6\xf7\x30\x18\xfd\xf3\x80\x2c\x85\x33\xb0\x06\xc1\x3a\xe8\x94\xb9\x67\x62\xb0\x76\x76\xe8\xfd\x19\xec\x36\xba\xde\x9c\x9c\x82\x72\x48\x6c\x76\x1e\xdb\x2d\x7a\xa8\x6d\xdb\x62\x4d\xdb\x7b\xda\x7f\xbe\xdc\x2f\x4e\x4e\x4f\x4e\xe1\xaf\xf4\x9b\x75\x08\xda\xac\xac\xeb\x22\xbb\x24\x3e\x7c\xaf\xba\xbe\x45\x0f\x36\x1e\xbe\x94\xda\x19\xf4\x2d\x2a\x8f\xe0\x11\x4f\x4e\x79\xd8\x9a\x56\x1b\x84\xc6\xd6\x43\x87\x26\x08\x9d\xf0\x94\x37\xa1\xff\x36\x21\xf4\xfe\xe9\xc5\xc5\x6e\xb7\x5b\x18\x12\x40\xef\xec\x3b\xac\xc3\x42\xdb\x8b\xc6\xd6\xfe\xe2\x9d\x5d\x9e\x4f\xa4\x46\xbf\x2c\x36\xa1\x6b\x4f\x4e\x4f\x48\xc6\xa5\x11\xfc\x7a\x02\x20\xda\x74\xb8\xd6\xd6\x54\xd0\x2b\xa7\x3a\x0c\xe8\x92\xec\x31\xaa\x36\x8e\x93\x0e\x59\x50\x10\x2c\xe0\x7b\xac\x87\x80\x49\xa9\x0b\x78\xb1\x62\x7a\xb6\xd3\x21\x60\x73\x06\x81\x6c\x50\x9b\x0d\x3a\x1d\x22\x95\x06\x57\x6a\x68\x43\xa2\x46\x2a\x21\xa9\x56\x51\x57\xd5\x82\xd7\xcb\xe0\x4d\xfe\x99\x7e\x1d\x39\x6d\x54\x50\x35\x9a\x80\xce\x1f\x67\xb7\xd5\x3e\x10\xe5\x62\xb2\x30\x1e\xcd\x85\xc9\x2d\x91\x0c\xd5\xeb\x06\x1d\x36\xb0\xdb\xa0\x81\xbe\x55\xb5\x36\xeb\xc8\x3a\x29\x58\x3c\xa9\x1b\x7c\xa0\xf9\xbd\xb3\x5b\xdd\x60\x43\x9c\x96\xb4\x6f\xe0\x1f\x55\x53\x5f\x55\xff\x3c\x19\x19\x0d\xf7\x3d\x96\x1c\xd6\xd6\x04\x67\x5b\x71\x95\xfb\x9e\x8f\xfe\xce\x2e\xc5\xf6\x40\x77\xbd\xaa\x45\x50\xbe\xde\x60\x33\xb4\xe8\xfe\xe8\x99\x60\x83\xb5\xf6\xec\x03\x91\x47\x24\xf3\x10\xde\xa6\xce\xa6\xbd\xf8\x9b\x6a\xd9\x02\x45\xe4\x1e\x82\x65\x4a\x95\x47\xb7\xd5\x35\x56\x0b\xb6\x5a\x05\xab\xa1\x6d\xb3\xbc\xc8\x42\x88\x35\xcf\x6b\xc3\x06\xb5\x83\x46\xaf\x56\xe8\xd0\xd4\xe8\x27\x26\x4b\xd4\x8e\x19\xed\x22\xeb\xec\x90\x6b\x94\x64\x1e\xb7\xfb\x44\xe5\x43\x6d\x9f\xac\xe0\x22\x0b\xcf\x47\xc3\x8f\x44\x58\xe2\x37\xe3\xf9\x0b\x4d\x91\x15\x04\xa7\xb4\x09\x39\xa2\x71\x50\x25\x31\x34\x8d\x16\x69\x8e\xb3\x3c\xac\xac\x9b\xda\x0a\xe9\x91\x09\x6a\x93\xd7\x90\x93\x50\xa0\x70\xe8\xed\xe0\x6a\x8e\x1c\x8d\xd3\xdb\x68\x0b\x89\x96\x68\x51\xf6\xed\x14\x07\x78\xd6\x71\xb4\x52\x15\xc6\xc8\x71\x06\x15\xc7\xab\xea\x8c\x68\x55\x64\xa0\x15\xb4\xb8\xc5\xf6\x8c\x15\xe6\x87\xbe\xb7\x2e\x78\xd8\x2a\xa7\xd5\xb2\x25\xa9\x07\x74\xbd\x6d\x3f\x40\x2b\x87\x03\xd6\xbe\x6c\x3e\xd8\x08\x3e\x49\x83\xb3\xe8\x35\x6e\x5f\xea\xf2\xb4\x10\xa0\x44\x31\x00\x15\x82\xd3\x4b\x8a\x48\x37\x50\xfd\xe1\x57\xfa\xdf\xc5\x1d\x3a\x83\xed\x82\x02\xcd\x43\x25\xf3\xb6\xaa\x1d\x90\xf9\xb9\x81\xaa\xd5\x66\x78\x1f\x47\x1e\x0a\x8b\x18\xfa\x46\x05\xcc\xd6\x30\x0d\x2e\x71\x10\x68\xff\x80\xeb\xfb\x94\x97\x24\x95\x2c\x98\x42\x9c\xc3\x04\xf3\x3c\xed\x61\xf0\xd8\x90\x59\x48\x2c\x20\xdb\x31\x6b\x0f\xad\xbe\x43\x70\xb6\x6d\xc9\x9e\x86\x7e\xed\x54\x43\xce\x56\x2b\xa3\x9c\xa6\x7f\x29\x23\x21\xab\x1d\xf0\x62\xed\x10\x0d\x34\xd8\xb7\xf6\x9e\x84\xed\x29\xf4\x8e\x61\xd7\xd8\x3d\x0e\xb5\x07\x24\x45\xd7\xd8\x30\x7b\x31\x12\xcc\x0e\x39\x31\xbd\x64\x76\x14\x10\xac\x2b\xce\xb7\x80\xbf\xa7\x40\x99\x67\x31\x39\x8e\x64\x3a\x80\xea\xfb\x96\x25\x65\x41\xb5\xad\x08\x85\x71\xc5\x08\x00\xf6\x88\x2c\xad\xc0\x0e\xda\x2f\x1d\x96\x97\x26\xf3\xe6\xa8\xc8\x8c\x7a\xce\xd1\x1d\xba\x35\x45\xed\x84\x57\x78\xf2\x1f\x29\x68\xdf\x91\x10\x7b\x87\x35\x36\x14\xb4\x3e\xc5\xe8\xa7\x92\xf9\x97\x1a\x7c\xdc\xba\x34\x76\x51\x26\x99\x79\xb6\xcf\x4e\xbd\xbf\xa5\xcc\xd2\xb6\xd8\x1e\xcf\x82\x9d\x7a\xaf\xbb\xa1\x03\x33\x74\x4b\x74\x64\xa7\x91\x96\x24\x03\xa2\xd6\xa3\x23\x59\x50\xd8\x4a\xf4\x16\xf0\xc2\xc4\xa0\x56\x2b\x8f\x92\xc6\x0b\xc2\xd9\xbc\x32\x0a\x25\xeb\x10\x7a\x2a\x80\x82\xa0\x3b\x16\x3b\x40\xc9\x27\xdc\xc0\xd5\xc9\xe4\x10\xda\xdc\x6e\x50\xb5\x61\x73\x7f\x4b\x4b\x1e\x39\x88\x36\x7c\x10\x9a\xc5\x3f\xa8\xb6\xb5\x51\x60\x42\x30\x25\x68\xb1\x31\x21\x4b\x0a\x0c\x08\x4b\x5c\xb1\xda\x03\x39\x42\xa7\xdc\x1d\x19\x9d\xcf\x93\xc8\x04\x06\xb3\x6c\x6d\x7d\xe7\x85\xdc\x6a\x70\x61\x83\xae\xd8\xc7\xc3\xca\xd9\x0e\x96\x18\x5d\x94\x04\xd0\xc8\x19\x67\xc7\xa0\xb0\x72\x75\xe9\xab\xc9\x59\xd3\x84\x06\x55\x43\x86\x73\xfc\xac\x69\x46\x81\xb5\xd8\xc3\x58\xba\x99\x9d\x7c\xe0\x03\xc7\x59\x11\xd1\xbc\xb4\x5c\xa4\xd3\xf9\xd4\x10\x2c\x39\x40\xcd\x08\x39\x38\x65\x3c\xa7\xac\x18\x9d\x06\x23\xb4\x16\xf0\x26\x0f\x71\xaa\x2b\xc6\xb8\x78\x48\xe2\x52\xba\x15\xe6\x53\x50\x62\xa9\xf6\x36\xa0\x09\x9a\x37\xa1\xf0\x06\x4b\x55\xdf\x65\x3f\xd7\x2b\xa8\x88\x91\x5b\x87\x5b\x74\xa1\x1a\xd9\xf3\x18\x68\xaf\xe0\x06\xb1\xa3\xb9\xf8\x48\xc6\x5f\x74\x53\x11\xf7\xce\xae\x1d\x7a\xff\x49\x32\x56\xe6\x23\x44\x1c\x43\x7c\x26\xb2\xc4\xb5\x36\x3e\x02\x48\xa2\xbe\xd2\xce\x87\x7d\x72\x84\x19\x66\x32\x22\x1f\xe3\xea\xab\x61\x71\x69\x4f\x58\x01\x03\x93\x22\x99\x80\x32\xfb\xa6\xae\x3c\x9d\x8b\xe1\xda\x8c\xdc\xa8\xc7\x18\x7e\xa7\x6e\xc0\x59\xc2\xd8\x7d\x82\xb3\x65\x47\xfd\x87\x06\x92\x90\xf3\xe9\xcf\x0a\xf3\x9c\x9e\x6c\x14\x1b\x99\x47\xf2\x96\x3d\x2d\x45\x77\x99\xe9\x72\x62\x16\x87\xb4\xa8\x57\xd9\x8c\xa4\x00\xa4\x25\xe7\x71\x89\x9c\x42\x08\xb6\xca\x07\x3a\xc8\x52\xea\x65\x5b\xe6\x4e\xe6\x6d\x70\x58\x94\xa0\x23\xdf\xb2\x48\xaf\x38\x93\x1d\x72\x43\x5f\x6a\x83\xaa\x9c\x82\xf2\x8e\xaa\x76\x21\x96\x0c\x87\x09\x14\x87\x83\x1b\x58\xa9\xd6\xe3\xe4\xf0\x9c\xf6\xef\x8f\x59\xaf\x0a\x50\x6f\x94\x59\x63\x56\x16\x83\x76\xfa\x7d\x17\x2b\x61\xf4\x43\x9b\xec\x4f\xd3\x61\x7d\x70\x43\xcd\x05\x75\x8a\xff\x22\x33\x29\xfd\x39\xb7\xca\x16\x4d\x91\x2d\x12\xfe\x10\x5a\x94\x6b\xed\x40\xb2\xb4\x7d\x4f\xe1\x80\xc0\x6d\xef\x70\xab\xed\xe0\x4b\xa1\x2c\xe0\x47\x53\x0b\xb2\xef\xd1\xa9\x40\xc0\x97\x0e\xd2\x31\xa6\x1e\x05\x99\x36\xe0\x8c\x2e\x32\x62\x83\xba\xe7\x76\x47\x2c\xb8\x3a\x1b\xb8\x3c\x23\x37\x4d\x61\x1a\x54\x01\x97\x04\x69\x71\xed\xb9\x92\x6a\xb5\x53\x9a\x23\xd6\x44\x55\x94\x9b\x08\x11\x71\xcd\x39\x49\xa1\x51\x31\xa7\x42\xe5\xaf\x31\xfa\x9f\x51\x1c\x0a\x44\x25\xab\x04\x7f\x1e\x54\x9b\xe4\xce\x95\x74\xda\x72\x44\x48\xbc\xe7\x2e\x09\xed\x18\x62\xfb\x7b\x8a\x16\x62\x75\x92\x52\xce\x52\x45\x46\x61\x40\x48\x1b\xdc\x09\xb1\x2d\x3a\x2f\x45\x5e\x24\x26\x81\x63\xe8\xa9\x2e\x64\x51\x69\xc1\x30\xb6\x6d\xca\xe9\xac\xb3\xe4\x83\xf1\x34\x70\x03\x97\x27\x00\x0f\x19\xf5\x76\x7a\xed\x22\x6c\x3c\x00\x7a\x13\xbe\xca\x98\x92\xc2\x59\x5c\x41\x12\xb2\xab\x15\xd8\x58\xff\x37\x4e\x64\x6f\x6c\x83\x33\x6c\xaa\x72\x0b\x40\x96\x5a\x33\x41\xa9\x11\x3c\x36\xbf\x81\xd9\x12\x4c\x13\x86\x3f\x0b\x4e\x93\xbd\x4b\xa0\x96\xe4\x97\x90\xda\xeb\x89\x00\x47\xb7\x2a\x8a\x05\xf1\xe7\x68\xeb\xb2\x3e\x63\x6f\xaf\xba\x64\xd7\x8c\xa8\x62\xa1\x28\x74\x52\x72\x6a\x29\x18\x87\x8d\x32\xd2\x81\x0b\x5c\xa9\x92\x61\xa6\x7c\x23\x46\x99\x0c\xf2\x4f\x71\xf4\x7c\x82\xcd\xfe\x1c\x5b\x81\x4c\x6f\x15\xc0\x0d\x86\x35\xd8\x0c\x8e\xfe\xca\xba\xf2\x8f\xa3\xba\xe9\x81\x3b\xa4\x38\xa5\x7d\x57\x64\xd9\xc2\x1b\xa3\xbb\x47\x53\x96\xd0\x90\x8b\x13\x46\xa6\x09\x3b\xc4\x82\x2d\xc6\x88\xaa\xde\x60\x7d\xe7\xab\x5c\xfe\xde\x72\x86\xf2\x55\x09\x13\x6e\x79\x12\xe5\x15\x99\x7d\x84\xbf\xe3\xa0\xf2\x51\x38\x99\x1c\xfb\xc3\x41\xe5\x6f\xc0\xc9\x04\x61\x45\xfd\xa2\xe7\x02\x74\x37\x30\x78\x0e\x66\xd0\xaa\x25\xb6\xe0\x87\xd5\x4a\xbf\x8f\x55\x63\xf5\xc5\xa5\x88\xe3\xea\x49\x57\x7d\x18\x22\x7d\xfd\xdb\x80\xf3\x83\x70\x50\x4a\x87\x8f\x01\xce\x8f\x80\x9a\x9b\x8c\xff\x3e\xf4\xec\xd7\x9d\x1c\x7d\x53\x1d\xc7\x89\x4f\xba\x6a\x12\xe6\xa4\x85\xb2\xd7\xe9\x01\x8f\x9c\x8b\xa6\x6d\x66\xc9\x94\xdc\x2b\x3c\xe7\x73\x61\x03\x0c\x9d\x4e\xb3\x93\xc6\x5e\x34\xd4\xad\xe6\xae\xdc\xb3\xd4\x5b\x96\xa2\x57\x89\x0b\x26\x17\x93\xb2\x57\xa2\x98\x78\xf9\x69\x5a\xfe\x09\xe5\xea\xe4\x40\xff\xd2\x28\x18\x5b\x02\x45\x0c\x8c\x27\xad\x54\xaf\xab\x69\xc5\xca\x51\xe7\x38\x22\x2f\xa2\xe3\x24\x99\x4e\xb4\x90\x3d\x2f\x07\xa8\xc1\x34\xe8\x62\x85\x2a\xdd\x09\xf6\x9d\xd8\xe2\x49\x76\x6b\xac\x39\x37\xb8\x8e\x57\x0a\x65\x4f\x34\x05\x57\x0b\x57\x92\x18\x39\x34\xce\xeb\x54\x87\x3e\x28\x37\xf6\x06\x53\xc3\x95\x8d\x26\xe5\xc5\x25\x6e\xd4\x56\x5b\xc7\x4a\x21\xf6\x33\xb0\xe4\xb6\x38\x03\x51\x0a\xad\x83\xc9\x96\x5d\xa6\x43\xd9\x03\x7a\xdb\xea\x7a\x6c\x15\x2d\x95\x1f\x2d\x25\x35\x67\x67\x60\xe5\x83\xcd\x64\x76\x8e\x99\xa1\x7c\x80\xa9\x8c\x9b\x7e\xa2\xb9\x08\x07\xc9\x60\x12\xbd\x74\xf8\x68\x30\x49\xee\xa3\x49\xa8\x10\xb0\xeb\xb9\x87\x4d\x9a\xcf\xc2\x28\x9a\x4a\x63\xb8\xe0\x8e\xe7\x56\xb5\x0b\x21\x96\x17\xdf\xc0\xb5\xfc\x94\xa6\x70\x15\x99\x4b\x8f\xf1\x86\x01\x5b\x75\x14\x7e\x23\x25\x45\x95\xda\xbb\x3b\xa5\x43\xca\x04\x72\x8a\x14\xd0\x39\x32\x46\x53\x88\x01\x52\x07\xd8\xcc\x8a\x21\x00\xde\x8b\xe3\xf3\x13\x3f\xe7\xa3\xb3\xcd\xe1\x0b\x84\x1d\xb9\xc4\x46\xf5\x3d\xa6\xb2\x53\x36\x22\xfa\xc2\x06\x36\x99\x58\x95\x44\x50\x71\xae\x9b\x34\xe3\xb2\xb4\xf2\xb1\x69\xd7\xc8\x96\x78\x26\xbe\x0f\x99\x54\xd2\xd4\x60\x82\x54\xfc\x34\x5c\x52\xa1\xe3\x25\x22\x16\x3d\x18\x3b\x1a\x77\x72\xed\x4c\x8e\x3b\x00\x99\x39\xe2\x7e\x49\x40\x79\xc3\x57\x93\xfb\x3c\xca\x3a\x26\x7e\x23\x5b\xf1\x6f\x0f\x13\x7f\xc5\x7e\x83\x1d\x3a\xd5\xde\x36\xda\xdf\x8d\x97\x94\x26\xd6\x41\x5e\xc2\x35\x65\x9f\xa0\x5b\xfd\x0b\x05\x05\xc8\x8b\x80\x16\xe5\xea\xc9\x07\x54\x0d\xdb\x20\x6c\x94\x6b\x78\x10\x1c\xfe\x3c\x68\x27\x77\x30\xdf\x71\xd8\xf6\x92\xa6\x42\xd1\xcb\x9f\x04\x2d\x92\x43\xb4\xa3\xfb\x3d\x22\x3e\xe1\x8c\x74\x53\x90\x49\x14\xf1\x70\x01\xcf\x72\xbf\x25\xe6\x27\x6d\x8a\xc8\x17\xb3\x8b\xdf\xc8\xfd\x65\xcc\x4b\xd3\x43\x7d\x6a\xdc\x38\x2c\xcf\x14\x3e\x72\xcb\xe6\x37\xaf\x72\x7e\x77\xf8\x98\x32\x32\x8f\x22\xd3\xd1\x22\x98\x70\xa9\xe5\x83\xae\xef\x38\xb0\x06\x37\x60\xba\xde\x2a\xcb\xb6\xb2\x08\x9b\xdc\xc1\x65\x42\x2c\xe2\xde\xe1\x8a\x72\x8e\x8d\x79\xbc\xb8\x11\x68\x4a\xe4\x53\x64\x77\x2e\x84\xa4\xab\x5d\x10\x4a\xe5\x02\xc7\x14\x15\xd4\x88\xfb\x06\x8f\xab\xa1\x8d\x00\xbe\x40\x22\x81\xb4\x45\x33\x33\x9d\x12\xa1\xf4\x54\xec\xf9\x00\xaa\x76\xd6\x97\xe5\x78\x2a\xfa\x17\x79\x99\xc8\xe2\x86\x45\x91\x7e\xcd\xa3\xaf\xa5\xe8\xcd\xfc\xc5\x46\x9c\xf4\x15\xb2\xad\x16\x1b\x34\xda\x61\x1d\xac\xe3\xab\x10\x35\xdf\xe6\xe0\xc4\x60\xcb\x8a\x67\x64\x2d\x6d\x7a\x84\x37\xf6\x6f\xaf\x7f\x79\xa4\xb7\x47\xa3\xc4\xe3\x0f\xdf\x12\x37\xec\x10\xcd\x21\xef\x8e\x48\x22\xec\x28\xe0\x14\xfe\x24\xf5\x52\xe2\x88\xa9\xdd\xc0\x17\x97\x97\x07\x02\x8d\x5a\xf1\xcb\x8b\xfb\x1c\x62\xd0\xa8\x25\x7b\x8e\x74\x3d\x7c\xbc\x27\xef\xb9\x63\x96\xef\x6d\xc5\x84\xf8\x46\x35\x41\x9a\x94\xe7\xa3\xa9\xa4\x9b\x2c\xcf\x8f\x0d\x30\x28\xb6\x8f\x4f\x74\xdf\x39\x97\x9f\xc1\x71\x13\x0b\x73\x97\xa5\xda\x21\x8e\x64\xb0\x38\xde\xe2\xcd\x00\xa2\xbc\x15\x50\x33\x11\x95\x12\xda\x23\xc1\x17\x81\x34\x7f\x31\x5e\xd6\x3f\x54\x27\x49\x89\x11\x26\xce\x5b\xc3\x5e\x3b\xae\xc1\x13\x11\x9e\x35\x5e\x8a\x88\x7c\xe5\xfd\xc9\x7e\x60\x18\xd5\xac\xd3\x6d\x92\x3f\xdf\xa1\x0f\x57\x55\xf1\x64\x60\x31\x61\x81\x18\xcd\xb3\x32\x7b\x3b\xd4\xeb\x4d\xee\x0e\xa4\xab\x43\x6d\x1a\x12\x2b\xf9\x63\x1b\x21\xed\x68\x4e\x69\x61\xd9\x5b\xa2\xac\xda\xc5\xf6\x2d\xbf\x20\xc2\x2c\xf3\x05\xbc\x08\xe5\xfb\x00\x78\x72\x49\x19\x99\x33\x15\x86\xc5\x94\x8b\x1b\xb8\x12\x1f\x38\x65\x37\x28\xfd\xc0\xf7\x0e\x55\x93\xbd\x20\xf6\xbf\xa6\x4e\xa0\x4d\xed\x18\x6c\x72\x83\x3c\x42\x63\x08\xb6\x45\xa7\x4c\x8d\xb1\x75\x24\x08\x54\xbb\xd8\x06\x4a\x85\xf2\xf2\x3e\x25\xce\x58\x07\xce\xf4\xcf\x31\xb0\x28\xac\x93\x59\xe7\xba\x2d\x72\x07\x76\x9b\xa5\xfe\xd1\x2e\x34\x3d\xe0\x67\x70\xa0\xc8\xc0\xbe\xfb\xc8\xd9\x3e\x87\xf3\x04\xe5\xd6\x18\xfc\xdc\x3c\x63\x39\x9d\xdd\xa8\x47\x47\x2b\xd5\x3a\x16\xd6\xfb\x7a\xa2\x24\x87\xaa\xde\x08\xbd\x03\x9e\x37\x93\x5f\x9c\xc7\xfe\x82\x8a\xbd\xea\xd7\x42\xb6\xb2\x1f\xdc\xc0\x5f\xb2\xb5\x72\xed\xbf\xb7\x58\x5c\xf2\xf0\xe2\x2f\x0f\x2c\x9e\xc6\x7e\x83\x61\x67\xdd\x88\x2e\x57\xfc\x98\x26\x22\x89\xd8\x56\xa7\xea\x50\x66\xb1\x02\x7c\x4f\x70\x21\x26\xa4\x14\xf6\xef\xe3\xcd\x02\xa7\x9f\x02\xf1\x16\x29\x28\x51\x18\xe1\x8c\xd4\x05\xf2\xe6\xee\xbb\x97\x2f\xa0\x6f\x87\xb5\x36\xe5\xe3\x82\x58\x9f\x0a\x40\x9f\xb1\x50\xe0\x00\xb1\xdc\xa9\xc9\xd2\x49\x46\xaa\x3e\x9b\x70\x99\x87\x4b\x33\x5e\xeb\xb0\x19\x96\x8b\xda\x76\x17\x54\xa1\x28\x6d\xd0\xc9\xa6\xda\xac\x2f\x84\xcc\x8c\x44\xc2\xf0\x4b\xa7\x9b\x35\xce\x2a\x1f\x79\xa2\x03\x3b\x4c\xe6\x14\x7b\x99\x19\xeb\x6a\x0f\xaa\xae\xd1\x7b\xbd\x6c\x31\xbe\x8a\xdc\xea\x11\x78\x7c\x67\x8d\x1f\x5a\xfa\xcb\x60\x1d\xce\xc0\x5b\x26\x65\x39\xb4\x09\xc5\xf8\x4e\x46\x1b\xbe\xb5\x11\x76\x47\xc9\xd0\x28\x54\x74\xc2\xaa\x90\x3c\x90\x74\x6f\xa0\xfa\xfa\xf2\xeb\xcb\x2a\xff\xfa\x20\xc8\xa0\x0c\x88\xf2\xc6\x68\x8e\x0b\xa6\x8c\xc5\xed\xd2\x61\xd3\x36\xec\xab\x37\xd2\x30\x39\x57\xbd\x9e\x09\x87\x59\x4b\x55\xaf\xac\x9d\x3e\xc3\xe4\x19\xe5\x70\xab\x7d\xa0\x52\x31\xbe\x00\x1a\x49\x7d\x6f\xb6\xf6\x1e\x7a\x67\xdf\xc7\xdb\xdc\x59\xaf\xce\x59\x8e\xaf\x8e\xf2\x45\x1d\x2f\x3d\x54\x60\xea\x63\x01\xc7\xcf\xe7\x8e\xd8\x19\xbc\x88\xd5\x4b\x11\xcd\x61\xa9\x4d\xc3\x09\x81\xe2\x40\xbb\xb1\x7e\xa4\x65\x25\xc1\xd2\x06\x67\x23\x38\x37\x88\x8d\xe7\x7b\xcb\xf1\x29\x56\xda\x6b\xf2\xf4\x2d\x9d\x8d\x8f\x7f\x03\xd5\x37\x97\x97\x57\xf3\x92\x9a\x1b\xc2\x07\x9e\xf5\xa4\xab\x52\x88\xad\x63\xe5\xbd\xad\x35\x43\xfa\xfc\xc0\x44\x84\x59\x4a\x50\xe7\xe8\x37\xb6\x1f\xba\xa1\x0d\x9a\xf0\x41\x2c\xb5\xc7\x88\x98\x07\x62\x53\x3a\xb5\xe7\x0b\x67\x8c\xf4\xe1\xa5\x4d\x59\x4d\x66\xba\xc1\x94\x82\x66\xa9\x24\x14\xd0\x50\x0c\xe1\x1c\xc5\x8f\xc1\x32\xb5\x95\xc6\x76\x84\xd5\xf9\xe7\x78\xbc\xd2\xa2\xd9\xdc\x20\x3e\x86\x52\xad\xde\x62\x55\x9a\xfb\x7d\x9f\x07\x43\xdd\x4f\x86\x88\x8b\xb4\x8e\x8c\x74\x1c\x2a\xdb\x2b\xdc\x76\x2e\x56\xe9\x0e\xed\x10\x78\xd5\xb5\x2f\x7d\x48\xfe\x59\x47\xd7\xc8\x2c\x16\xa0\xbf\xc1\x5a\xb9\xdb\xb9\x6b\x15\xcd\xb8\x90\x4d\x5a\x26\x83\x6a\x3a\xed\x7d\xba\xe9\x16\x11\xc4\x2e\x4a\x8b\x2e\xbe\x80\x94\xe4\x93\xcb\x40\x56\xb8\x82\xd9\x7e\x67\xd2\x34\x18\x5f\x3d\x24\x07\xa0\xcc\x0d\xca\xc8\xce\xa2\x1c\xb9\x21\x2c\x9f\x4d\x3d\x13\xfa\xc9\x76\xa5\x1b\x5c\xd0\x92\x8e\x40\xbc\xd2\x53\xd0\xdc\x1b\xd5\xe9\x3a\xda\x73\xea\x1d\x3b\x5c\x93\x33\xd3\x2c\x32\x20\x87\x1d\x59\x8b\x30\xe9\x0b\x62\x31\x0f\xb0\x2c\x83\x15\xe6\xb2\x2d\xb3\xd2\xdf\xca\xf8\x39\x07\x80\xf3\xff\x2f\x44\xfe\xed\xed\x62\x24\x53\x10\xfc\xf6\x3e\x61\xc5\xb3\x4c\x4e\x78\x1a\x0c\x85\x5f\x8e\xa4\x96\x62\x85\x56\x2d\x0c\xbd\x0f\x0e\x55\x07\xcf\x6d\x7d\x87\x0e\x74\xa7\xd6\x38\x52\x9e\x89\x17\x7e\x7d\x90\xa1\x03\xd1\x34\x3e\x73\x4c\xfa\x4e\xb9\xd5\xb0\x0f\x6c\x75\x33\xd0\x6e\x46\xf3\x75\x29\x49\xf6\x0c\xfc\x50\x6f\x40\x91\x57\xc7\xcd\x4f\x46\xcd\x73\x76\x3a\x83\x1d\x2e\xcb\xb0\xc4\xcf\x29\x97\x2a\xd4\x1b\x8a\x86\x9c\x58\xcc\xfa\x53\xc1\x62\xc9\xee\x67\xe8\xb1\x72\xaf\x68\x06\x14\xd9\x0e\xab\x1d\x2e\xab\x59\x8f\xb5\x8a\xef\x51\x8f\x57\xd3\xbc\x52\x1e\xad\xce\xee\x43\x04\x6e\x8c\xbd\x41\xe9\xcc\x32\x03\xf2\xab\xac\xbc\x81\xaa\x61\x4d\xec\xc5\x63\xf6\xde\x23\xef\x2c\xc7\xb7\xb2\x63\x90\xcf\x8f\xa5\x3d\xf4\xca\xfb\xa2\xcb\x19\x7b\x0b\xed\x7d\xba\x9d\x4f\x4c\x5b\x98\x36\x1f\xd3\xe3\x9d\xa0\x74\xcb\x98\x74\x42\x3f\xe3\x14\xbe\x6e\x4c\x92\xe5\x32\x9e\xe2\x44\x24\xca\x88\xa2\x78\xc2\x9c\xa7\xc5\xe1\x91\xa5\x3d\x5c\x35\xb7\xa0\xc5\x18\xf6\x56\x7a\x5d\x44\x3d\x76\x17\x92\xdb\x46\xf9\x8d\xae\xad\xeb\x59\xfd\x17\x8c\x0a\xd0\x11\x2e\x78\xba\xbd\xaa\xb2\xd3\x4c\xc5\xaa\x5c\xd0\x2b\x55\x87\xc7\x7a\x9f\x8d\xdd\x99\xd6\xaa\x86\xdf\x18\xc9\xfc\x78\x29\x39\x02\xa9\x14\x5e\xe2\xf3\xe5\xde\x69\x3b\x0a\x34\x76\x3b\xb1\x7c\x25\x2f\xaf\xe3\xc9\xf1\x6a\x6b\xb6\x68\x34\x9a\x31\xbf\x8f\xf7\xc1\x24\x89\xb4\x3d\x91\x99\xbe\x60\x5f\xe9\x36\x36\x3e\xa8\xec\xe0\xf4\x1f\x61\xad\xd8\xd7\xd8\xfc\xe2\x8d\x5f\xf0\xfd\x6b\x6f\x05\x0b\x12\x77\xd2\x65\x0d\x07\x25\xb1\x97\x9f\x0b\x6d\x89\x40\xf2\x94\xb4\xd8\xef\x27\xd2\x8f\x68\xbf\xcc\x38\xd8\x0b\x09\x1f\x14\x14\x8e\x81\xef\x8f\x69\xc2\x08\x23\x63\x70\x28\x89\x66\x13\x28\xc1\x81\x28\xfe\x26\x42\xe1\xa7\x17\x17\x2b\x6b\x19\xe8\x67\x5a\x41\xb9\xc5\xfa\x97\x32\xc5\xc7\xaf\x0f\xfc\x84\x0e\x08\x94\x19\x3a\xa2\xd5\x35\x4f\x9e\xd6\x5f\x2a\xf5\xf5\x93\x2f\x54\x73\x7d\x7d\xf5\xe4\xcb\xeb\xbf\xe0\xf2\xab\xe6\xab\x4b\x75\x7d\xf5\xcd\xf5\x35\x7e\xf5\xcd\x97\x25\xc5\x87\x12\x26\x4c\x0d\xbd\xb5\x6b\x7f\xc0\xc8\x49\x9c\xe5\x9d\x2c\x29\x63\x63\x77\xf1\xbb\x9d\xd6\xae\xc5\xc6\xca\x96\x6c\xf9\x5e\x96\x9b\x7e\xdc\x7a\xb7\x1e\x69\xbe\x97\x05\x64\x85\x14\x38\xcc\x02\xfe\x66\xd7\x6b\xb2\x5d\x7e\x5a\x4d\xe8\x9e\x90\xd8\x68\x4b\x29\x53\x2e\x07\x79\xbe\x3f\xe1\x54\x3a\x24\xe4\x07\x84\x0d\xdd\xf9\xda\x51\x62\x6a\xf2\xbb\x70\x5b\x86\x11\xfe\xa0\xc5\xae\xc1\xd9\x30\xda\x99\x0f\xd6\x51\x88\x38\x08\x81\x3f\xc5\x4e\x4b\x06\x3f\x9b\x8d\x12\x13\x87\xed\x93\xb5\x50\xda\x54\xa7\xde\xdf\x46\xad\x00\xa3\xd0\xab\xcb\x03\x83\xb7\xd2\xbf\xbd\x7a\xb2\x0f\x35\xc7\xdb\xdd\x78\xe7\x52\xbc\x08\xf0\xb5\xd3\xcb\xfc\xe5\x53\x71\x4f\xa3\xca\x9a\xa4\x88\x1d\xf2\x2d\xd4\x02\x5e\xa5\x6f\x3d\x66\xd7\x3b\x75\x3b\x34\x08\x1d\x76\xd6\xdd\x9f\x25\x0c\x78\x06\x75\x3f\xc4\x2f\x37\x48\x47\xb3\xd2\x02\x8d\xcf\xb0\x56\x9e\x13\xb4\x6d\xfe\xea\x8a\xe4\x0e\x9d\xaa\x37\xa4\x8f\x58\x2d\x44\x78\x43\x0b\xed\xb0\xde\x14\x41\x5c\x58\xaa\x55\xaf\x6a\x1d\xee\x7f\x8f\x95\xec\x49\xeb\xb3\x99\x4a\xe6\xe4\x90\xbd\x8c\x17\x69\x63\x4a\xad\xfb\x21\x5a\xca\x93\xcb\x4b\x38\xe5\x3f\x7f\xf8\x8f\x5f\xf2\x70\xd4\x0d\xdc\xc0\xf5\x93\xbf\xc0\x29\xfd\xf9\xc3\xb7\x33\x4c\x5a\x80\xd2\x23\x75\x46\x51\x5d\x44\x75\x1d\xad\x0f\x52\xbb\x6d\xf2\x1d\xe2\xd8\x0d\xcb\x2d\x90\x83\xd5\x48\x8e\x78\xa3\xd6\x53\xbb\xf6\x48\x99\xf1\x09\xc5\xc5\x09\x4c\x30\x80\x94\x18\xbf\xbf\xb0\xf8\xbf\x2c\x25\x4e\x47\x95\x38\x8c\xdf\x6e\xee\x2c\xec\xf8\xee\xda\x42\x67\x9b\x04\x04\xd2\x3b\x8b\xf4\x4c\xe3\x69\x06\xd9\xff\x0f\xde\x70\xfb\x8d\x2a\x79\x29\xd5\x15\xbc\x4d\x02\x27\xdd\xbc\x1d\x13\x0c\xd3\x4a\xe7\x4b\xbf\x17\x78\x9d\x1d\x91\x3f\x4d\xf1\x63\x15\x98\xf6\x4e\xd6\x72\x20\x64\x47\x46\x9e\x35\xf1\x52\xf2\xed\x9d\x36\x4d\xec\x01\x15\x82\x7c\x9a\x05\x59\xbd\x8d\xf5\x7d\xfc\xc0\xcc\xf2\xd3\xb2\x11\x75\x47\x4e\xde\x10\x27\x63\xd8\x60\xed\x8e\x17\x96\x89\xa5\xb2\x03\xc4\x93\xd1\x04\xed\xb0\xbd\x9f\x8a\x37\xd6\x0f\x89\x9b\x91\x8f\xa2\x7b\xca\x2c\xc3\x63\x4c\xe7\xa9\x47\x8a\x82\xd3\x39\x0e\x8e\x07\xc9\x48\xf8\x0f\xbf\x76\x18\xd4\x42\xc8\x2f\x92\x86\x78\xfc\xa1\x2a\x56\x28\xb7\xf6\xc4\xc9\x3f\x8a\xdf\xa0\x3a\xaf\xab\x33\x22\xf2\xf2\xc7\x1f\x9e\x3d\xbf\x7d\xf3\xec\xf5\x7f\xdd\x3e\x7f\xf1\xea\xe1\x62\x69\x6d\xf0\xc1\xa9\x7e\xf1\xce\x5b\x53\x9d\x4d\x17\xb5\x71\xd1\x64\xe7\xd6\xae\x6f\xf9\xab\xa4\xc9\xae\xff\xcc\xff\x7e\x18\xcf\x33\x8f\x43\xa7\xd3\x48\x54\x5c\xa9\x94\x11\xe8\x8b\xcb\xcb\x43\xc4\x8a\x14\x28\x0b\x66\x29\xf0\xfa\xc0\x58\xca\x80\xd7\x05\x45\xc8\x7d\xcb\xf4\x2a\x4e\x3e\x16\xdf\xa8\xf8\x0e\xae\xb6\xa6\x99\xbf\x93\x1b\x3b\x59\xc5\x9d\x74\xc7\x77\x43\xd3\x0f\x16\x39\x33\x79\xa4\x8a\x32\xcc\x60\x18\x97\x17\xc5\x9b\xd4\xa5\xdd\xe6\xef\xb3\xe4\xe5\x58\xa3\xfc\x66\x69\x95\x6b\x92\x71\xcd\x1b\xe0\x8f\x76\x8e\xdf\x7a\x4a\x34\x35\xdc\xc0\x37\x97\x97\xd7\x6f\x8b\xb2\x96\xe2\x1f\xfa\x09\x36\xcc\x17\xfc\xfc\xd5\x85\xdb\x8e\xf9\x8b\xa3\x22\x51\x88\x87\xd9\x58\x1f\x32\x1f\xdc\xdd\x5a\x71\x7f\x93\x77\xe4\x96\xf0\x6c\xb7\xb1\x0d\x67\xdd\x4e\xb9\x46\xa4\xc5\x74\x62\x77\xd6\x16\x7b\x3c\xda\x44\x2d\x9b\x9a\xb3\x86\x34\xc0\xe4\xb4\xf9\xd7\x60\xc5\x1e\x8a\x5f\x27\x29\xec\xf1\x96\xf3\xa8\x81\x72\xef\xd8\x50\xbd\xae\x8e\x37\xea\xf6\x5a\x3a\x79\x04\x24\xc2\x94\xbf\x24\x8d\xa5\xe0\xee\xe7\xef\x31\xe5\x1d\x7f\x91\x7b\x38\xdc\x71\xdb\x7f\x46\xe7\x4f\xb9\x57\xfe\x67\x4e\x6f\xbb\xd4\xa7\x96\xeb\x77\xeb\x05\x22\x25\x42\x36\x35\x54\x67\x84\x8e\xf4\xb1\xd9\x3f\x04\xb3\xe7\x2f\xc3\x63\x31\xa0\x8a\xef\xb3\x46\x3a\x39\x63\xa9\x30\x36\xba\x9f\x7e\x7d\xf9\xf5\xe5\x62\x32\x73\x3c\xfc\x54\x34\xc0\x1f\x6d\x68\xc3\x19\xe2\xf6\xc0\x8d\xc0\x74\x32\x6f\x71\xbb\xd4\xa6\xb9\xe5\x53\xc3\x0d\xd0\x5e\x93\x59\x0f\x27\x87\xfe\x9d\xc1\xf0\xe8\x40\x87\x12\x1f\x27\xd2\xf1\x86\x3c\xe6\x8e\x49\x1a\x2b\xc8\xc8\x9b\xa5\x79\x6a\x29\xba\x8a\x50\x6e\x32\x69\xf5\x1e\x46\x6e\xfb\x51\xf3\x72\x36\x96\x43\xe7\x93\xab\xeb\xc9\xd0\x43\xf1\x7f\xf3\x16\x63\xd1\x1a\xdb\x8b\x3a\xbf\xd9\xba\x2a\x2f\x35\x08\x3a\x04\x75\x87\xa0\x9a\xad\xe2\xcb\x4e\xbe\xeb\x9c\x5c\xa6\xc8\x77\x5e\x63\xc5\x60\xb6\xda\x59\xc3\x0f\x05\xd2\xd7\xda\x0c\x5a\x56\x5a\x9e\x26\xa9\xa6\xe1\x77\x23\xf2\x65\x51\xb2\x95\x4c\x61\x76\x21\x81\x66\x5b\x88\xec\xbb\x1f\x7f\x7a\xf9\xe6\xc5\xcb\x7f\xbf\x7d\xfd\xfd\xab\xff\x79\xf1\xdd\xf7\xb7\x3f\xbd\xfa\x5b\x51\xc7\xa7\x34\xf8\xd3\x7f\xbf\x7e\xf3\xea\xfb\x67\x3f\xdc\x3e\x7b\xfe\xfc\xd5\x2d\x1b\xd8\xad\xea\xf5\xc3\x5e\x63\xe9\xa3\x1b\x54\x59\xa2\x93\x36\x55\xfa\xf3\xe1\xe4\xe1\xe4\x7f\x03\x00\x00\xff\xff\x62\xe9\xee\xaa\xd9\x44\x00\x00") - info := bindataFileInfo{name: "command/assets/connect-short.nomad", size: 997, mode: os.FileMode(420), modTime: time.Unix(1566490218, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _commandAssetsConnectNomad = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x7b\x6d\x8f\x1c\xb7\x91\xff\xfb\xfd\x14\x85\xde\x00\x49\xfe\xd8\x9d\x7d\xb0\x15\xdb\xc2\x7f\x0f\x90\x2d\xe7\x4e\x77\xb1\x7c\x90\xe4\xcb\x8b\x20\x58\x71\xba\x6b\x66\xa8\xed\x26\xdb\x24\x7b\x46\x6b\x63\xbf\xfb\xa1\x8a\x45\x36\xbb\x67\x66\x2d\xc9\x87\xc8\x2f\x24\x79\x48\x16\x8b\xf5\xf8\xab\x22\xfb\x14\xde\x6c\xd0\x21\xd4\xca\x80\x35\xed\x3d\x2c\x11\x14\x78\x6d\xd6\x2d\xc2\x3b\xbb\x84\x06\x57\xda\xe8\xa0\xad\x81\x1e\x1d\xac\x74\x8b\x0b\x78\xb3\xd1\x9e\x47\xb5\x07\xa3\x3a\x6c\x4e\x4e\xa1\xaa\xed\x60\x42\xa3\xfc\xa6\x02\x6f\x41\x07\xd8\xe9\xb6\x85\xda\xa1\x0a\x44\x93\xa6\xef\x74\xd8\x40\xd8\x20\xbc\x78\x0e\xca\x34\xf0\x52\x75\x58\x2e\x5c\x9c\x9c\x30\x43\x50\xbd\xb3\xcb\x0a\x7c\x50\xe6\x17\x45\x9b\xd0\x9a\x60\xfb\xf3\xce\xfa\x00\xb5\x35\x2b\xbd\x1e\x9c\x62\xae\x6c\xcf\x7f\x69\xc3\x93\xde\xd9\xe5\xc9\x29\xf8\x1e\x6b\xbd\xd2\x35\xcf\x58\xc0\xb3\xc4\xab\x82\x06\xeb\x56\xd1\xca\x2d\x4e\x67\x81\x5d\x41\x50\xfe\x8e\xf6\x52\x01\x5e\xda\x4e\xd1\xa9\xfc\xc6\x0e\x6d\x03\x6e\x30\x0b\xf8\x4f\xbb\xf4\xb0\x51\x5b\x3a\xcd\xba\xb5\x4b\xd5\xb6\xf7\x30\x18\xfd\xf3\x80\x2c\x85\x33\xb0\x06\xc1\x3a\xe8\x94\xb9\x67\x62\xb0\x76\x76\xe8\xfd\x19\xec\x36\xba\xde\x9c\x9c\x82\x72\x48\x6c\x76\x1e\xdb\x2d\x7a\xa8\x6d\xdb\x62\x4d\xdb\x7b\xda\x7f\xbe\xdc\x2f\x4e\x4e\x4f\x4e\xe1\xaf\xf4\x9b\x75\x08\xda\xac\xac\xeb\x22\xbb\x24\x3e\x7c\xaf\xba\xbe\x45\x0f\x36\x1e\xbe\x94\xda\x19\xf4\x2d\x2a\x8f\xe0\x11\x4f\x4e\x79\xd8\x9a\x56\x1b\x84\xc6\xd6\x43\x87\x26\x08\x9d\xf0\x94\x37\xa1\xff\x36\x21\xf4\xfe\xe9\xc5\xc5\x6e\xb7\x5b\x18\x12\x40\xef\xec\x3b\xac\xc3\x42\xdb\x8b\xc6\xd6\xfe\xe2\x9d\x5d\x9e\x4f\xa4\x46\xbf\x2c\x36\xa1\x6b\x4f\x4e\x4f\x48\xc6\xa5\x11\xfc\x7a\x02\x20\xda\x74\xb8\xd6\xd6\x54\xd0\x2b\xa7\x3a\x0c\xe8\x92\xec\x31\xaa\x36\x8e\x93\x0e\x59\x50\x10\x2c\xe0\x7b\xac\x87\x80\x49\xa9\x0b\x78\xb1\x62\x7a\xb6\xd3\x21\x60\x73\x06\x81\x6c\x50\x9b\x0d\x3a\x1d\x22\x95\x06\x57\x6a\x68\x43\xa2\x46\x2a\x21\xa9\x56\x51\x57\xd5\x82\xd7\xcb\xe0\x4d\xfe\x99\x7e\x1d\x39\x6d\x54\x50\x35\x9a\x80\xce\x1f\x67\xb7\xd5\x3e\x10\xe5\x62\xb2\x30\x1e\xcd\x85\xc9\x2d\x91\x0c\xd5\xeb\x06\x1d\x36\xb0\xdb\xa0\x81\xbe\x55\xb5\x36\xeb\xc8\x3a\x29\x58\x3c\xa9\x1b\x7c\xa0\xf9\xbd\xb3\x5b\xdd\x60\x43\x9c\x96\xb4\x6f\xe0\x1f\x55\x53\x5f\x55\xff\x3c\x19\x19\x0d\xf7\x3d\x96\x1c\xd6\xd6\x04\x67\x5b\x71\x95\xfb\x9e\x8f\xfe\xce\x2e\xc5\xf6\x40\x77\xbd\xaa\x45\x50\xbe\xde\x60\x33\xb4\xe8\xfe\xe8\x99\x60\x83\xb5\xf6\xec\x03\x91\x47\x24\xf3\x10\xde\xa6\xce\xa6\xbd\xf8\x9b\x6a\xd9\x02\x45\xe4\x1e\x82\x65\x4a\x95\x47\xb7\xd5\x35\x56\x0b\xb6\x5a\x05\xab\xa1\x6d\xb3\xbc\xc8\x42\x88\x35\xcf\x6b\xc3\x06\xb5\x83\x46\xaf\x56\xe8\xd0\xd4\xe8\x27\x26\x4b\xd4\x8e\x19\xed\x22\xeb\xec\x90\x6b\x94\x64\x1e\xb7\xfb\x44\xe5\x43\x6d\x9f\xac\xe0\x22\x0b\xcf\x47\xc3\x8f\x44\x58\xe2\x37\xe3\xf9\x0b\x4d\x91\x15\x04\xa7\xb4\x09\x39\xa2\x71\x50\x25\x31\x34\x8d\x16\x69\x8e\xb3\x3c\xac\xac\x9b\xda\x0a\xe9\x91\x09\x6a\x93\xd7\x90\x93\x50\xa0\x70\xe8\xed\xe0\x6a\x8e\x1c\x8d\xd3\xdb\x68\x0b\x89\x96\x68\x51\xf6\xed\x14\x07\x78\xd6\x71\xb4\x52\x15\xc6\xc8\x71\x06\x15\xc7\xab\xea\x8c\x68\x55\x64\xa0\x15\xb4\xb8\xc5\xf6\x8c\x15\xe6\x87\xbe\xb7\x2e\x78\xd8\x2a\xa7\xd5\xb2\x25\xa9\x07\x74\xbd\x6d\x3f\x40\x2b\x87\x03\xd6\xbe\x6c\x3e\xd8\x08\x3e\x49\x83\xb3\xe8\x35\x6e\x5f\xea\xf2\xb4\x10\xa0\x44\x31\x00\x15\x82\xd3\x4b\x8a\x48\x37\x50\xfd\xe1\x57\xfa\xdf\xc5\x1d\x3a\x83\xed\x82\x02\xcd\x43\x25\xf3\xb6\xaa\x1d\x90\xf9\xb9\x81\xaa\xd5\x66\x78\x1f\x47\x1e\x0a\x8b\x18\xfa\x46\x05\xcc\xd6\x30\x0d\x2e\x71\x10\x68\xff\x80\xeb\xfb\x94\x97\x24\x95\x2c\x98\x42\x9c\xc3\x04\xf3\x3c\xed\x61\xf0\xd8\x90\x59\x48\x2c\x20\xdb\x31\x6b\x0f\xad\xbe\x43\x70\xb6\x6d\xc9\x9e\x86\x7e\xed\x54\x43\xce\x56\x2b\xa3\x9c\xa6\x7f\x29\x23\x21\xab\x1d\xf0\x62\xed\x10\x0d\x34\xd8\xb7\xf6\x9e\x84\xed\x29\xf4\x8e\x61\xd7\xd8\x3d\x0e\xb5\x07\x24\x45\xd7\xd8\x30\x7b\x31\x12\xcc\x0e\x39\x31\xbd\x64\x76\x14\x10\xac\x2b\xce\xb7\x80\xbf\xa7\x40\x99\x67\x31\x39\x8e\x64\x3a\x80\xea\xfb\x96\x25\x65\x41\xb5\xad\x08\x85\x71\xc5\x08\x00\xf6\x88\x2c\xad\xc0\x0e\xda\x2f\x1d\x96\x97\x26\xf3\xe6\xa8\xc8\x8c\x7a\xce\xd1\x1d\xba\x35\x45\xed\x84\x57\x78\xf2\x1f\x29\x68\xdf\x91\x10\x7b\x87\x35\x36\x14\xb4\x3e\xc5\xe8\xa7\x92\xf9\x97\x1a\x7c\xdc\xba\x34\x76\x51\x26\x99\x79\xb6\xcf\x4e\xbd\xbf\xa5\xcc\xd2\xb6\xd8\x1e\xcf\x82\x9d\x7a\xaf\xbb\xa1\x03\x33\x74\x4b\x74\x64\xa7\x91\x96\x24\x03\xa2\xd6\xa3\x23\x59\x50\xd8\x4a\xf4\x16\xf0\xc2\xc4\xa0\x56\x2b\x8f\x92\xc6\x0b\xc2\xd9\xbc\x32\x0a\x25\xeb\x10\x7a\x2a\x80\x82\xa0\x3b\x16\x3b\x40\xc9\x27\xdc\xc0\xd5\xc9\xe4\x10\xda\xdc\x6e\x50\xb5\x61\x73\x7f\x4b\x4b\x1e\x39\x88\x36\x7c\x10\x9a\xc5\x3f\xa8\xb6\xb5\x51\x60\x42\x30\x25\x68\xb1\x31\x21\x4b\x0a\x0c\x08\x4b\x5c\xb1\xda\x03\x39\x42\xa7\xdc\x1d\x19\x9d\xcf\x93\xc8\x04\x06\xb3\x6c\x6d\x7d\xe7\x85\xdc\x6a\x70\x61\x83\xae\xd8\xc7\xc3\xca\xd9\x0e\x96\x18\x5d\x94\x04\xd0\xc8\x19\x67\xc7\xa0\xb0\x72\x75\xe9\xab\xc9\x59\xd3\x84\x06\x55\x43\x86\x73\xfc\xac\x69\x46\x81\xb5\xd8\xc3\x58\xba\x99\x9d\x7c\xe0\x03\xc7\x59\x11\xd1\xbc\xb4\x5c\xa4\xd3\xf9\xd4\x10\x2c\x39\x40\xcd\x08\x39\x38\x65\x3c\xa7\xac\x18\x9d\x06\x23\xb4\x16\xf0\x26\x0f\x71\xaa\x2b\xc6\xb8\x78\x48\xe2\x52\xba\x15\xe6\x53\x50\x62\xa9\xf6\x36\xa0\x09\x9a\x37\xa1\xf0\x06\x4b\x55\xdf\x65\x3f\xd7\x2b\xa8\x88\x91\x5b\x87\x5b\x74\xa1\x1a\xd9\xf3\x18\x68\xaf\xe0\x06\xb1\xa3\xb9\xf8\x48\xc6\x5f\x74\x53\x11\xf7\xce\xae\x1d\x7a\xff\x49\x32\x56\xe6\x23\x44\x1c\x43\x7c\x26\xb2\xc4\xb5\x36\x3e\x02\x48\xa2\xbe\xd2\xce\x87\x7d\x72\x84\x19\x66\x32\x22\x1f\xe3\xea\xab\x61\x71\x69\x4f\x58\x01\x03\x93\x22\x99\x80\x32\xfb\xa6\xae\x3c\x9d\x8b\xe1\xda\x8c\xdc\xa8\xc7\x18\x7e\xa7\x6e\xc0\x59\xc2\xd8\x7d\x82\xb3\x65\x47\xfd\x87\x06\x92\x90\xf3\xe9\xcf\x0a\xf3\x9c\x9e\x6c\x14\x1b\x99\x47\xf2\x96\x3d\x2d\x45\x77\x99\xe9\x72\x62\x16\x87\xb4\xa8\x57\xd9\x8c\xa4\x00\xa4\x25\xe7\x71\x89\x9c\x42\x08\xb6\xca\x07\x3a\xc8\x52\xea\x65\x5b\xe6\x4e\xe6\x6d\x70\x58\x94\xa0\x23\xdf\xb2\x48\xaf\x38\x93\x1d\x72\x43\x5f\x6a\x83\xaa\x9c\x82\xf2\x8e\xaa\x76\x21\x96\x0c\x87\x09\x14\x87\x83\x1b\x58\xa9\xd6\xe3\xe4\xf0\x9c\xf6\xef\x8f\x59\xaf\x0a\x50\x6f\x94\x59\x63\x56\x16\x83\x76\xfa\x7d\x17\x2b\x61\xf4\x43\x9b\xec\x4f\xd3\x61\x7d\x70\x43\xcd\x05\x75\x8a\xff\x22\x33\x29\xfd\x39\xb7\xca\x16\x4d\x91\x2d\x12\xfe\x10\x5a\x94\x6b\xed\x40\xb2\xb4\x7d\x4f\xe1\x80\xc0\x6d\xef\x70\xab\xed\xe0\x4b\xa1\x2c\xe0\x47\x53\x0b\xb2\xef\xd1\xa9\x40\xc0\x97\x0e\xd2\x31\xa6\x1e\x05\x99\x36\xe0\x8c\x2e\x32\x62\x83\xba\xe7\x76\x47\x2c\xb8\x3a\x1b\xb8\x3c\x23\x37\x4d\x61\x1a\x54\x01\x97\x04\x69\x71\xed\xb9\x92\x6a\xb5\x53\x9a\x23\xd6\x44\x55\x94\x9b\x08\x11\x71\xcd\x39\x49\xa1\x51\x31\xa7\x42\xe5\xaf\x31\xfa\x9f\x51\x1c\x0a\x44\x25\xab\x04\x7f\x1e\x54\x9b\xe4\xce\x95\x74\xda\x72\x44\x48\xbc\xe7\x2e\x09\xed\x18\x62\xfb\x7b\x8a\x16\x62\x75\x92\x52\xce\x52\x45\x46\x61\x40\x48\x1b\xdc\x09\xb1\x2d\x3a\x2f\x45\x5e\x24\x26\x81\x63\xe8\xa9\x2e\x64\x51\x69\xc1\x30\xb6\x6d\xca\xe9\xac\xb3\xe4\x83\xf1\x34\x70\x03\x97\x27\x00\x0f\x19\xf5\x76\x7a\xed\x22\x6c\x3c\x00\x7a\x13\xbe\xca\x98\x92\xc2\x59\x5c\x41\x12\xb2\xab\x15\xd8\x58\xff\x37\x4e\x64\x6f\x6c\x83\x33\x6c\xaa\x72\x0b\x40\x96\x5a\x33\x41\xa9\x11\x3c\x36\xbf\x81\xd9\x12\x4c\x13\x86\x3f\x0b\x4e\x93\xbd\x4b\xa0\x96\xe4\x97\x90\xda\xeb\x89\x00\x47\xb7\x2a\x8a\x05\xf1\xe7\x68\xeb\xb2\x3e\x63\x6f\xaf\xba\x64\xd7\x8c\xa8\x62\xa1\x28\x74\x52\x72\x6a\x29\x18\x87\x8d\x32\xd2\x81\x0b\x5c\xa9\x92\x61\xa6\x7c\x23\x46\x99\x0c\xf2\x4f\x71\xf4\x7c\x82\xcd\xfe\x1c\x5b\x81\x4c\x6f\x15\xc0\x0d\x86\x35\xd8\x0c\x8e\xfe\xca\xba\xf2\x8f\xa3\xba\xe9\x81\x3b\xa4\x38\xa5\x7d\x57\x64\xd9\xc2\x1b\xa3\xbb\x47\x53\x96\xd0\x90\x8b\x13\x46\xa6\x09\x3b\xc4\x82\x2d\xc6\x88\xaa\xde\x60\x7d\xe7\xab\x5c\xfe\xde\x72\x86\xf2\x55\x09\x13\x6e\x79\x12\xe5\x15\x99\x7d\x84\xbf\xe3\xa0\xf2\x51\x38\x99\x1c\xfb\xc3\x41\xe5\x6f\xc0\xc9\x04\x61\x45\xfd\xa2\xe7\x02\x74\x37\x30\x78\x0e\x66\xd0\xaa\x25\xb6\xe0\x87\xd5\x4a\xbf\x8f\x55\x63\xf5\xc5\xa5\x88\xe3\xea\x49\x57\x7d\x18\x22\x7d\xfd\xdb\x80\xf3\x83\x70\x50\x4a\x87\x8f\x01\xce\x8f\x80\x9a\x9b\x8c\xff\x3e\xf4\xec\xd7\x9d\x1c\x7d\x53\x1d\xc7\x89\x4f\xba\x6a\x12\xe6\xa4\x85\xb2\xd7\xe9\x01\x8f\x9c\x8b\xa6\x6d\x66\xc9\x94\xdc\x2b\x3c\xe7\x73\x61\x03\x0c\x9d\x4e\xb3\x93\xc6\x5e\x34\xd4\xad\xe6\xae\xdc\xb3\xd4\x5b\x96\xa2\x57\x89\x0b\x26\x17\x93\xb2\x57\xa2\x98\x78\xf9\x69\x5a\xfe\x09\xe5\xea\xe4\x40\xff\xd2\x28\x18\x5b\x02\x45\x0c\x8c\x27\xad\x54\xaf\xab\x69\xc5\xca\x51\xe7\x38\x22\x2f\xa2\xe3\x24\x99\x4e\xb4\x90\x3d\x2f\x07\xa8\xc1\x34\xe8\x62\x85\x2a\xdd\x09\xf6\x9d\xd8\xe2\x49\x76\x6b\xac\x39\x37\xb8\x8e\x57\x0a\x65\x4f\x34\x05\x57\x0b\x57\x92\x18\x39\x34\xce\xeb\x54\x87\x3e\x28\x37\xf6\x06\x53\xc3\x95\x8d\x26\xe5\xc5\x25\x6e\xd4\x56\x5b\xc7\x4a\x21\xf6\x33\xb0\xe4\xb6\x38\x03\x51\x0a\xad\x83\xc9\x96\x5d\xa6\x43\xd9\x03\x7a\xdb\xea\x7a\x6c\x15\x2d\x95\x1f\x2d\x25\x35\x67\x67\x60\xe5\x83\xcd\x64\x76\x8e\x99\xa1\x7c\x80\xa9\x8c\x9b\x7e\xa2\xb9\x08\x07\xc9\x60\x12\xbd\x74\xf8\x68\x30\x49\xee\xa3\x49\xa8\x10\xb0\xeb\xb9\x87\x4d\x9a\xcf\xc2\x28\x9a\x4a\x63\xb8\xe0\x8e\xe7\x56\xb5\x0b\x21\x96\x17\xdf\xc0\xb5\xfc\x94\xa6\x70\x15\x99\x4b\x8f\xf1\x86\x01\x5b\x75\x14\x7e\x23\x25\x45\x95\xda\xbb\x3b\xa5\x43\xca\x04\x72\x8a\x14\xd0\x39\x32\x46\x53\x88\x01\x52\x07\xd8\xcc\x8a\x21\x00\xde\x8b\xe3\xf3\x13\x3f\xe7\xa3\xb3\xcd\xe1\x0b\x84\x1d\xb9\xc4\x46\xf5\x3d\xa6\xb2\x53\x36\x22\xfa\xc2\x06\x36\x99\x58\x95\x44\x50\x71\xae\x9b\x34\xe3\xb2\xb4\xf2\xb1\x69\xd7\xc8\x96\x78\x26\xbe\x0f\x99\x54\xd2\xd4\x60\x82\x54\xfc\x34\x5c\x52\xa1\xe3\x25\x22\x16\x3d\x18\x3b\x1a\x77\x72\xed\x4c\x8e\x3b\x00\x99\x39\xe2\x7e\x49\x40\x79\xc3\x57\x93\xfb\x3c\xca\x3a\x26\x7e\x23\x5b\xf1\x6f\x0f\x13\x7f\xc5\x7e\x83\x1d\x3a\xd5\xde\x36\xda\xdf\x8d\x97\x94\x26\xd6\x41\x5e\xc2\x35\x65\x9f\xa0\x5b\xfd\x0b\x05\x05\xc8\x8b\x80\x16\xe5\xea\xc9\x07\x54\x0d\xdb\x20\x6c\x94\x6b\x78\x10\x1c\xfe\x3c\x68\x27\x77\x30\xdf\x71\xd8\xf6\x92\xa6\x42\xd1\xcb\x9f\x04\x2d\x92\x43\xb4\xa3\xfb\x3d\x22\x3e\xe1\x8c\x74\x53\x90\x49\x14\xf1\x70\x01\xcf\x72\xbf\x25\xe6\x27\x6d\x8a\xc8\x17\xb3\x8b\xdf\xc8\xfd\x65\xcc\x4b\xd3\x43\x7d\x6a\xdc\x38\x2c\xcf\x14\x3e\x72\xcb\xe6\x37\xaf\x72\x7e\x77\xf8\x98\x32\x32\x8f\x22\xd3\xd1\x22\x98\x70\xa9\xe5\x83\xae\xef\x38\xb0\x06\x37\x60\xba\xde\x2a\xcb\xb6\xb2\x08\x9b\xdc\xc1\x65\x42\x2c\xe2\xde\xe1\x8a\x72\x8e\x8d\x79\xbc\xb8\x11\x68\x4a\xe4\x53\x64\x77\x2e\x84\xa4\xab\x5d\x10\x4a\xe5\x02\xc7\x14\x15\xd4\x88\xfb\x06\x8f\xab\xa1\x8d\x00\xbe\x40\x22\x81\xb4\x45\x33\x33\x9d\x12\xa1\xf4\x54\xec\xf9\x00\xaa\x76\xd6\x97\xe5\x78\x2a\xfa\x17\x79\x99\xc8\xe2\x86\x45\x91\x7e\xcd\xa3\xaf\xa5\xe8\xcd\xfc\xc5\x46\x9c\xf4\x15\xb2\xad\x16\x1b\x34\xda\x61\x1d\xac\xe3\xab\x10\x35\xdf\xe6\xe0\xc4\x60\xcb\x8a\x67\x64\x2d\x6d\x7a\x84\x37\xf6\x6f\xaf\x7f\x79\xa4\xb7\x47\xa3\xc4\xe3\x0f\xdf\x12\x37\xec\x10\xcd\x21\xef\x8e\x48\x22\xec\x28\xe0\x14\xfe\x24\xf5\x52\xe2\x88\xa9\xdd\xc0\x17\x97\x97\x07\x02\x8d\x5a\xf1\xcb\x8b\xfb\x1c\x62\xd0\xa8\x25\x7b\x8e\x74\x3d\x7c\xbc\x27\xef\xb9\x63\x96\xef\x6d\xc5\x84\xf8\x46\x35\x41\x9a\x94\xe7\xa3\xa9\xa4\x9b\x2c\xcf\x8f\x0d\x30\x28\xb6\x8f\x4f\x74\xdf\x39\x97\x9f\xc1\x71\x13\x0b\x73\x97\xa5\xda\x21\x8e\x64\xb0\x38\xde\xe2\xcd\x00\xa2\xbc\x15\x50\x33\x11\x95\x12\xda\x23\xc1\x17\x81\x34\x7f\x31\x5e\xd6\x3f\x54\x27\x49\x89\x11\x26\xce\x5b\xc3\x5e\x3b\xae\xc1\x13\x11\x9e\x35\x5e\x8a\x88\x7c\xe5\xfd\xc9\x7e\x60\x18\xd5\xac\xd3\x6d\x92\x3f\xdf\xa1\x0f\x57\x55\xf1\x64\x60\x31\x61\x81\x18\xcd\xb3\x32\x7b\x3b\xd4\xeb\x4d\xee\x0e\xa4\xab\x43\x6d\x1a\x12\x2b\xf9\x63\x1b\x21\xed\x68\x4e\x69\x61\xd9\x5b\xa2\xac\xda\xc5\xf6\x2d\xbf\x20\xc2\x2c\xf3\x05\xbc\x08\xe5\xfb\x00\x78\x72\x49\x19\x99\x33\x15\x86\xc5\x94\x8b\x1b\xb8\x12\x1f\x38\x65\x37\x28\xfd\xc0\xf7\x0e\x55\x93\xbd\x20\xf6\xbf\xa6\x4e\xa0\x4d\xed\x18\x6c\x72\x83\x3c\x42\x63\x08\xb6\x45\xa7\x4c\x8d\xb1\x75\x24\x08\x54\xbb\xd8\x06\x4a\x85\xf2\xf2\x3e\x25\xce\x58\x07\xce\xf4\xcf\x31\xb0\x28\xac\x93\x59\xe7\xba\x2d\x72\x07\x76\x9b\xa5\xfe\xd1\x2e\x34\x3d\xe0\x67\x70\xa0\xc8\xc0\xbe\xfb\xc8\xd9\x3e\x87\xf3\x04\xe5\xd6\x18\xfc\xdc\x3c\x63\x39\x9d\xdd\xa8\x47\x47\x2b\xd5\x3a\x16\xd6\xfb\x7a\xa2\x24\x87\xaa\xde\x08\xbd\x03\x9e\x37\x93\x5f\x9c\xc7\xfe\x82\x8a\xbd\xea\xd7\x42\xb6\xb2\x1f\xdc\xc0\x5f\xb2\xb5\x72\xed\xbf\xb7\x58\x5c\xf2\xf0\xe2\x2f\x0f\x2c\x9e\xc6\x7e\x83\x61\x67\xdd\x88\x2e\x57\xfc\x98\x26\x22\x89\xd8\x56\xa7\xea\x50\x66\xb1\x02\x7c\x4f\x70\x21\x26\xa4\x14\xf6\xef\xe3\xcd\x02\xa7\x9f\x02\xf1\x16\x29\x28\x51\x18\xe1\x8c\xd4\x05\xf2\xe6\xee\xbb\x97\x2f\xa0\x6f\x87\xb5\x36\xe5\xe3\x82\x58\x9f\x0a\x40\x9f\xb1\x50\xe0\x00\xb1\xdc\xa9\xc9\xd2\x49\x46\xaa\x3e\x9b\x70\x99\x87\x4b\x33\x5e\xeb\xb0\x19\x96\x8b\xda\x76\x17\x54\xa1\x28\x6d\xd0\xc9\xa6\xda\xac\x2f\x84\xcc\x8c\x44\xc2\xf0\x4b\xa7\x9b\x35\xce\x2a\x1f\x79\xa2\x03\x3b\x4c\xe6\x14\x7b\x99\x19\xeb\x6a\x0f\xaa\xae\xd1\x7b\xbd\x6c\x31\xbe\x8a\xdc\xea\x11\x78\x7c\x67\x8d\x1f\x5a\xfa\xcb\x60\x1d\xce\xc0\x5b\x26\x65\x39\xb4\x09\xc5\xf8\x4e\x46\x1b\xbe\xb5\x11\x76\x47\xc9\xd0\x28\x54\x74\xc2\xaa\x90\x3c\x90\x74\x6f\xa0\xfa\xfa\xf2\xeb\xcb\x2a\xff\xfa\x20\xc8\xa0\x0c\x88\xf2\xc6\x68\x8e\x0b\xa6\x8c\xc5\xed\xd2\x61\xd3\x36\xec\xab\x37\xd2\x30\x39\x57\xbd\x9e\x09\x87\x59\x4b\x55\xaf\xac\x9d\x3e\xc3\xe4\x19\xe5\x70\xab\x7d\xa0\x52\x31\xbe\x00\x1a\x49\x7d\x6f\xb6\xf6\x1e\x7a\x67\xdf\xc7\xdb\xdc\x59\xaf\xce\x59\x8e\xaf\x8e\xf2\x45\x1d\x2f\x3d\x54\x60\xea\x63\x01\xc7\xcf\xe7\x8e\xd8\x19\xbc\x88\xd5\x4b\x11\xcd\x61\xa9\x4d\xc3\x09\x81\xe2\x40\xbb\xb1\x7e\xa4\x65\x25\xc1\xd2\x06\x67\x23\x38\x37\x88\x8d\xe7\x7b\xcb\xf1\x29\x56\xda\x6b\xf2\xf4\x2d\x9d\x8d\x8f\x7f\x03\xd5\x37\x97\x97\x57\xf3\x92\x9a\x1b\xc2\x07\x9e\xf5\xa4\xab\x52\x88\xad\x63\xe5\xbd\xad\x35\x43\xfa\xfc\xc0\x44\x84\x59\x4a\x50\xe7\xe8\x37\xb6\x1f\xba\xa1\x0d\x9a\xf0\x41\x2c\xb5\xc7\x88\x98\x07\x62\x53\x3a\xb5\xe7\x0b\x67\x8c\xf4\xe1\xa5\x4d\x59\x4d\x66\xba\xc1\x94\x82\x66\xa9\x24\x14\xd0\x50\x0c\xe1\x1c\xc5\x8f\xc1\x32\xb5\x95\xc6\x76\x84\xd5\xf9\xe7\x78\xbc\xd2\xa2\xd9\xdc\x20\x3e\x86\x52\xad\xde\x62\x55\x9a\xfb\x7d\x9f\x07\x43\xdd\x4f\x86\x88\x8b\xb4\x8e\x8c\x74\x1c\x2a\xdb\x2b\xdc\x76\x2e\x56\xe9\x0e\xed\x10\x78\xd5\xb5\x2f\x7d\x48\xfe\x59\x47\xd7\xc8\x2c\x16\xa0\xbf\xc1\x5a\xb9\xdb\xb9\x6b\x15\xcd\xb8\x90\x4d\x5a\x26\x83\x6a\x3a\xed\x7d\xba\xe9\x16\x11\xc4\x2e\x4a\x8b\x2e\xbe\x80\x94\xe4\x93\xcb\x40\x56\xb8\x82\xd9\x7e\x67\xd2\x34\x18\x5f\x3d\x24\x07\xa0\xcc\x0d\xca\xc8\xce\xa2\x1c\xb9\x21\x2c\x9f\x4d\x3d\x13\xfa\xc9\x76\xa5\x1b\x5c\xd0\x92\x8e\x40\xbc\xd2\x53\xd0\xdc\x1b\xd5\xe9\x3a\xda\x73\xea\x1d\x3b\x5c\x93\x33\xd3\x2c\x32\x20\x87\x1d\x59\x8b\x30\xe9\x0b\x62\x31\x0f\xb0\x2c\x83\x15\xe6\xb2\x2d\xb3\xd2\xdf\xca\xf8\x39\x07\x80\xf3\xff\x2f\x44\xfe\xed\xed\x62\x24\x53\x10\xfc\xf6\x3e\x61\xc5\xb3\x4c\x4e\x78\x1a\x0c\x85\x5f\x8e\xa4\x96\x62\x85\x56\x2d\x0c\xbd\x0f\x0e\x55\x07\xcf\x6d\x7d\x87\x0e\x74\xa7\xd6\x38\x52\x9e\x89\x17\x7e\x7d\x90\xa1\x03\xd1\x34\x3e\x73\x4c\xfa\x4e\xb9\xd5\xb0\x0f\x6c\x75\x33\xd0\x6e\x46\xf3\x75\x29\x49\xf6\x0c\xfc\x50\x6f\x40\x91\x57\xc7\xcd\x4f\x46\xcd\x73\x76\x3a\x83\x1d\x2e\xcb\xb0\xc4\xcf\x29\x97\x2a\xd4\x1b\x8a\x86\x9c\x58\xcc\xfa\x53\xc1\x62\xc9\xee\x67\xe8\xb1\x72\xaf\x68\x06\x14\xd9\x0e\xab\x1d\x2e\xab\x59\x8f\xb5\x8a\xef\x51\x8f\x57\xd3\xbc\x52\x1e\xad\xce\xee\x43\x04\x6e\x8c\xbd\x41\xe9\xcc\x32\x03\xf2\xab\xac\xbc\x81\xaa\x61\x4d\xec\xc5\x63\xf6\xde\x23\xef\x2c\xc7\xb7\xb2\x63\x90\xcf\x8f\xa5\x3d\xf4\xca\xfb\xa2\xcb\x19\x7b\x0b\xed\x7d\xba\x9d\x4f\x4c\x5b\x98\x36\x1f\xd3\xe3\x9d\xa0\x74\xcb\x98\x74\x42\x3f\xe3\x14\xbe\x6e\x4c\x92\xe5\x32\x9e\xe2\x44\x24\xca\x88\xa2\x78\xc2\x9c\xa7\xc5\xe1\x91\xa5\x3d\x5c\x35\xb7\xa0\xc5\x18\xf6\x56\x7a\x5d\x44\x3d\x76\x17\x92\xdb\x46\xf9\x8d\xae\xad\xeb\x59\xfd\x17\x8c\x0a\xd0\x11\x2e\x78\xba\xbd\xaa\xb2\xd3\x4c\xc5\xaa\x5c\xd0\x2b\x55\x87\xc7\x7a\x9f\x8d\xdd\x99\xd6\xaa\x86\xdf\x18\xc9\xfc\x78\x29\x39\x02\xa9\x14\x5e\xe2\xf3\xe5\xde\x69\x3b\x0a\x34\x76\x3b\xb1\x7c\x25\x2f\xaf\xe3\xc9\xf1\x6a\x6b\xb6\x68\x34\x9a\x31\xbf\x8f\xf7\xc1\x24\x89\xb4\x3d\x91\x99\xbe\x60\x5f\xe9\x36\x36\x3e\xa8\xec\xe0\xf4\x1f\x61\xad\xd8\xd7\xd8\xfc\xe2\x8d\x5f\xf0\xfd\x6b\x6f\x05\x0b\x12\x77\xd2\x65\x0d\x07\x25\xb1\x97\x9f\x0b\x6d\x89\x40\xf2\x94\xb4\xd8\xef\x27\xd2\x8f\x68\xbf\xcc\x38\xd8\x0b\x09\x1f\x14\x14\x8e\x81\xef\x8f\x69\xc2\x08\x23\x63\x70\x28\x89\x66\x13\x28\xc1\x81\x28\xfe\x26\x42\xe1\xa7\x17\x17\x2b\x6b\x19\xe8\x67\x5a\x41\xb9\xc5\xfa\x97\x32\xc5\xc7\xaf\x0f\xfc\x84\x0e\x08\x94\x19\x3a\xa2\xd5\x35\x4f\x9e\xd6\x5f\x2a\xf5\xf5\x93\x2f\x54\x73\x7d\x7d\xf5\xe4\xcb\xeb\xbf\xe0\xf2\xab\xe6\xab\x4b\x75\x7d\xf5\xcd\xf5\x35\x7e\xf5\xcd\x97\x25\xc5\x87\x12\x26\x4c\x0d\xbd\xb5\x6b\x7f\xc0\xc8\x49\x9c\xe5\x9d\x2c\x29\x63\x63\x77\xf1\xbb\x9d\xd6\xae\xc5\xc6\xca\x96\x6c\xf9\x5e\x96\x9b\x7e\xdc\x7a\xb7\x1e\x69\xbe\x97\x05\x64\x85\x14\x38\xcc\x02\xfe\x66\xd7\x6b\xb2\x5d\x7e\x5a\x4d\xe8\x9e\x90\xd8\x68\x4b\x29\x53\x2e\x07\x79\xbe\x3f\xe1\x54\x3a\x24\xe4\x07\x84\x0d\xdd\xf9\xda\x51\x62\x6a\xf2\xbb\x70\x5b\x86\x11\xfe\xa0\xc5\xae\xc1\xd9\x30\xda\x99\x0f\xd6\x51\x88\x38\x08\x81\x3f\xc5\x4e\x4b\x06\x3f\x9b\x8d\x12\x13\x87\xed\x93\xb5\x50\xda\x54\xa7\xde\xdf\x46\xad\x00\xa3\xd0\xab\xcb\x03\x83\xb7\xd2\xbf\xbd\x7a\xb2\x0f\x35\xc7\xdb\xdd\x78\xe7\x52\xbc\x08\xf0\xb5\xd3\xcb\xfc\xe5\x53\x71\x4f\xa3\xca\x9a\xa4\x88\x1d\xf2\x2d\xd4\x02\x5e\xa5\x6f\x3d\x66\xd7\x3b\x75\x3b\x34\x08\x1d\x76\xd6\xdd\x9f\x25\x0c\x78\x06\x75\x3f\xc4\x2f\x37\x48\x47\xb3\xd2\x02\x8d\xcf\xb0\x56\x9e\x13\xb4\x6d\xfe\xea\x8a\xe4\x0e\x9d\xaa\x37\xa4\x8f\x58\x2d\x44\x78\x43\x0b\xed\xb0\xde\x14\x41\x5c\x58\xaa\x55\xaf\x6a\x1d\xee\x7f\x8f\x95\xec\x49\xeb\xb3\x99\x4a\xe6\xe4\x90\xbd\x8c\x17\x69\x63\x4a\xad\xfb\x21\x5a\xca\x93\xcb\x4b\x38\xe5\x3f\x7f\xf8\x8f\x5f\xf2\x70\xd4\x0d\xdc\xc0\xf5\x93\xbf\xc0\x29\xfd\xf9\xc3\xb7\x33\x4c\x5a\x80\xd2\x23\x75\x46\x51\x5d\x44\x75\x1d\xad\x0f\x52\xbb\x6d\xf2\x1d\xe2\xd8\x0d\xcb\x2d\x90\x83\xd5\x48\x8e\x78\xa3\xd6\x53\xbb\xf6\x48\x99\xf1\x09\xc5\xc5\x09\x4c\x30\x80\x94\x18\xbf\xbf\xb0\xf8\xbf\x2c\x25\x4e\x47\x95\x38\x8c\xdf\x6e\xee\x2c\xec\xf8\xee\xda\x42\x67\x9b\x04\x04\xd2\x3b\x8b\xf4\x4c\xe3\x69\x06\xd9\xff\x0f\xde\x70\xfb\x8d\x2a\x79\x29\xd5\x15\xbc\x4d\x02\x27\xdd\xbc\x1d\x13\x0c\xd3\x4a\xe7\x4b\xbf\x17\x78\x9d\x1d\x91\x3f\x4d\xf1\x63\x15\x98\xf6\x4e\xd6\x72\x20\x64\x47\x46\x9e\x35\xf1\x52\xf2\xed\x9d\x36\x4d\xec\x01\x15\x82\x7c\x9a\x05\x59\xbd\x8d\xf5\x7d\xfc\xc0\xcc\xf2\xd3\xb2\x11\x75\x47\x4e\xde\x10\x27\x63\xd8\x60\xed\x8e\x17\x96\x89\xa5\xb2\x03\xc4\x93\xd1\x04\xed\xb0\xbd\x9f\x8a\x37\xd6\x0f\x89\x9b\x91\x8f\xa2\x7b\xca\x2c\xc3\x63\x4c\xe7\xa9\x47\x8a\x82\xd3\x39\x0e\x8e\x07\xc9\x48\xf8\x0f\xbf\x76\x18\xd4\x42\xc8\x2f\x92\x86\x78\xfc\xa1\x2a\x56\x28\xb7\xf6\xc4\xc9\x3f\x8a\xdf\xa0\x3a\xaf\xab\x33\x22\xf2\xf2\xc7\x1f\x9e\x3d\xbf\x7d\xf3\xec\xf5\x7f\xdd\x3e\x7f\xf1\xea\xe1\x62\x69\x6d\xf0\xc1\xa9\x7e\xf1\xce\x5b\x53\x9d\x4d\x17\xb5\x71\xd1\x64\xe7\xd6\xae\x6f\xf9\xab\xa4\xc9\xae\xff\xcc\xff\x7e\x18\xcf\x33\x8f\x43\xa7\xd3\x48\x54\x5c\xa9\x94\x11\xe8\x8b\xcb\xcb\x43\xc4\x8a\x14\x28\x0b\x66\x29\xf0\xfa\xc0\x58\xca\x80\xd7\x05\x45\xc8\x7d\xcb\xf4\x2a\x4e\x3e\x16\xdf\xa8\xf8\x0e\xae\xb6\xa6\x99\xbf\x93\x1b\x3b\x59\xc5\x9d\x74\xc7\x77\x43\xd3\x0f\x16\x39\x33\x79\xa4\x8a\x32\xcc\x60\x18\x97\x17\xc5\x9b\xd4\xa5\xdd\xe6\xef\xb3\xe4\xe5\x58\xa3\xfc\x66\x69\x95\x6b\x92\x71\xcd\x1b\xe0\x8f\x76\x8e\xdf\x7a\x4a\x34\x35\xdc\xc0\x37\x97\x97\xd7\x6f\x8b\xb2\x96\xe2\x1f\xfa\x09\x36\xcc\x17\xfc\xfc\xd5\x85\xdb\x8e\xf9\x8b\xa3\x22\x51\x88\x87\xd9\x58\x1f\x32\x1f\xdc\xdd\x5a\x71\x7f\x93\x77\xe4\x96\xf0\x6c\xb7\xb1\x0d\x67\xdd\x4e\xb9\x46\xa4\xc5\x74\x62\x77\xd6\x16\x7b\x3c\xda\x44\x2d\x9b\x9a\xb3\x86\x34\xc0\xe4\xb4\xf9\xd7\x60\xc5\x1e\x8a\x5f\x27\x29\xec\xf1\x96\xf3\xa8\x81\x72\xef\xd8\x50\xbd\xae\x8e\x37\xea\xf6\x5a\x3a\x79\x04\x24\xc2\x94\xbf\x24\x8d\xa5\xe0\xee\xe7\xef\x31\xe5\x1d\x7f\x91\x7b\x38\xdc\x71\xdb\x7f\x46\xe7\x4f\xb9\x57\xfe\x67\x4e\x6f\xbb\xd4\xa7\x96\xeb\x77\xeb\x05\x22\x25\x42\x36\x35\x54\x67\x84\x8e\xf4\xb1\xd9\x3f\x04\xb3\xe7\x2f\xc3\x63\x31\xa0\x8a\xef\xb3\x46\x3a\x39\x63\xa9\x30\x36\xba\x9f\x7e\x7d\xf9\xf5\xe5\x62\x32\x73\x3c\xfc\x54\x34\xc0\x1f\x6d\x68\xc3\x19\xe2\xf6\xc0\x8d\xc0\x74\x32\x6f\x71\xbb\xd4\xa6\xb9\xe5\x53\xc3\x0d\xd0\x5e\x93\x59\x0f\x27\x87\xfe\x9d\xc1\xf0\xe8\x40\x87\x12\x1f\x27\xd2\xf1\x86\x3c\xe6\x8e\x49\x1a\x2b\xc8\xc8\x9b\xa5\x79\x6a\x29\xba\x8a\x50\x6e\x32\x69\xf5\x1e\x46\x6e\xfb\x51\xf3\x72\x36\x96\x43\xe7\x93\xab\xeb\xc9\xd0\x43\xf1\x7f\xf3\x16\x63\xd1\x1a\xdb\x8b\x3a\xbf\xd9\xba\x2a\x2f\x35\x08\x3a\x04\x75\x87\xa0\x9a\xad\xe2\xcb\x4e\xbe\xeb\x9c\x5c\xa6\xc8\x77\x5e\x63\xc5\x60\xb6\xda\x59\xc3\x0f\x05\xd2\xd7\xda\x0c\x5a\x56\x5a\x9e\x26\xa9\xa6\xe1\x77\x23\xf2\x65\x51\xb2\x95\x4c\x61\x76\x21\x81\x66\x5b\x88\xec\xbb\x1f\x7f\x7a\xf9\xe6\xc5\xcb\x7f\xbf\x7d\xfd\xfd\xab\xff\x79\xf1\xdd\xf7\xb7\x3f\xbd\xfa\x5b\x51\xc7\xa7\x34\xf8\xd3\x7f\xbf\x7e\xf3\xea\xfb\x67\x3f\xdc\x3e\x7b\xfe\xfc\xd5\x2d\x1b\xd8\xad\xea\xf5\xc3\x5e\x63\xe9\xa3\x1b\x54\x59\xa2\x93\x36\x55\xfa\xf3\xe1\xe4\xe1\xe4\x7f\x03\x00\x00\xff\xff\x62\xe9\xee\xaa\xd9\x44\x00\x00") - -func commandAssetsConnectNomadBytes() ([]byte, error) { - return bindataRead( - _commandAssetsConnectNomad, +func command_assets_connect_nomad() ([]byte, error) { + return bindata_read( + _command_assets_connect_nomad, "command/assets/connect.nomad", ) } -func commandAssetsConnectNomad() (*asset, error) { - bytes, err := commandAssetsConnectNomadBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "command/assets/connect.nomad", size: 17625, mode: os.FileMode(420), modTime: time.Unix(1566490218, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _commandAssetsExampleShortNomad = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\xdd\x4a\xc4\x30\x10\x85\xef\xf3\x14\x87\x79\x00\xe9\xee\xb2\x2b\x0a\x79\x12\x11\x49\x93\xb1\xc6\x9a\x4e\x98\xa4\xfe\xb0\xf4\xdd\xa5\xd2\xd6\x0a\xde\x64\xc2\x97\x2f\x39\x87\xbc\x4a\x0b\xe2\x4f\x97\xf2\x1b\x13\xae\x06\x08\xae\x3a\xcf\x43\x65\x2d\xb0\x78\xa0\xe0\x0f\xf4\x68\x0c\xd0\xa9\x8c\x19\xe4\x9d\x7f\x59\x54\xa0\xba\xd2\x83\x94\x43\x2c\x2b\x02\x82\xc6\x77\x56\x58\x50\x10\xdf\xb3\x92\x59\x0e\xbc\x0c\xcf\xb1\xdb\x3c\x20\x26\xd7\xf1\x2c\xfe\xbc\x70\x7f\xba\x39\x6e\x2e\x90\x45\xeb\x53\x72\x79\xe7\x03\xa1\x85\xc5\xe5\x74\x7b\xb7\xb1\xc9\xac\x73\xd9\x28\x17\x19\xd5\x73\xd9\x5d\xf4\x79\x9c\x87\xc5\xb9\x69\x36\x98\x38\x89\x7e\xc1\xe2\x78\xbe\xfc\xc6\x0e\x5c\x3f\x44\xfb\x3f\xa9\xa9\x8d\x75\xfe\x8d\x43\xb3\x83\x73\x3f\x80\x42\x4b\xc0\x75\xfa\xa7\xcf\xba\x4e\x66\x32\xdf\x01\x00\x00\xff\xff\xd2\x2e\x19\x9c\x68\x01\x00\x00") +var _command_assets_example_short_nomad = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x6c\x90\xdd\x4a\xc4\x30\x10\x85\xef\xf3\x14\x87\x79\x00\xe9\xee\xb2\x2b\x0a\x79\x12\x11\x49\x93\xb1\xc6\x9a\x4e\x98\xa4\xfe\xb0\xf4\xdd\xa5\xd2\xd6\x0a\xde\x64\xc2\x97\x2f\x39\x87\xbc\x4a\x0b\xe2\x4f\x97\xf2\x1b\x13\xae\x06\x08\xae\x3a\xcf\x43\x65\x2d\xb0\x78\xa0\xe0\x0f\xf4\x68\x0c\xd0\xa9\x8c\x19\xe4\x9d\x7f\x59\x54\xa0\xba\xd2\x83\x94\x43\x2c\x2b\x02\x82\xc6\x77\x56\x58\x50\x10\xdf\xb3\x92\x59\x0e\xbc\x0c\xcf\xb1\xdb\x3c\x20\x26\xd7\xf1\x2c\xfe\xbc\x70\x7f\xba\x39\x6e\x2e\x90\x45\xeb\x53\x72\x79\xe7\x03\xa1\x85\xc5\xe5\x74\x7b\xb7\xb1\xc9\xac\x73\xd9\x28\x17\x19\xd5\x73\xd9\x5d\xf4\x79\x9c\x87\xc5\xb9\x69\x36\x98\x38\x89\x7e\xc1\xe2\x78\xbe\xfc\xc6\x0e\x5c\x3f\x44\xfb\x3f\xa9\xa9\x8d\x75\xfe\x8d\x43\xb3\x83\x73\x3f\x50\x68\x09\xd7\xe9\x9f\x36\xeb\x3a\x99\xc9\x7c\x07\x00\x00\xff\xff\x46\x4a\xe3\x99\x66\x01\x00\x00") -func commandAssetsExampleShortNomadBytes() ([]byte, error) { - return bindataRead( - _commandAssetsExampleShortNomad, +func command_assets_example_short_nomad() ([]byte, error) { + return bindata_read( + _command_assets_example_short_nomad, "command/assets/example-short.nomad", ) } -func commandAssetsExampleShortNomad() (*asset, error) { - bytes, err := commandAssetsExampleShortNomadBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "command/assets/example-short.nomad", size: 360, mode: os.FileMode(420), modTime: time.Unix(1566869876, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _commandAssetsExampleNomad = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x5b\xdd\x6f\x24\x37\x72\x7f\xd7\x5f\x51\x68\x05\xb8\x04\x90\x46\x1f\x6b\xd9\xf1\x02\xf3\x60\xfb\x72\xf1\x26\xf1\x25\x88\x9d\x1c\x82\xf8\x20\xb0\xbb\x6b\xa6\xb9\xc3\x26\xdb\x24\x7b\x66\x67\x17\xfa\xdf\x83\x2a\x7e\x34\x7b\x66\xa4\x95\xb5\xc8\xc9\x0f\xbb\xeb\x21\x59\x2c\x56\xfd\xea\x93\xec\x73\xf8\xa5\x43\x8b\xd0\x08\x0d\x46\xab\x3d\xd4\x08\x02\x9c\xd4\x6b\x85\xf0\xde\xd4\xd0\xe2\x4a\x6a\xe9\xa5\xd1\x30\xa0\x85\x95\x54\xb8\x80\x5f\x3a\xe9\x78\x54\x3a\xd0\xa2\xc7\xf6\xec\x1c\x2a\xfc\x20\xfa\x41\x61\x05\xce\x80\xf4\xb0\x93\x4a\x41\x63\x51\x78\xa2\x48\x93\x77\xd2\x77\xe0\x3b\x84\x77\x7f\x04\xa1\x5b\xf8\xb3\xe8\x71\x5a\xb6\x38\x3b\x63\x66\xa0\x7a\x6f\xea\x0a\x9c\x17\xfa\xa3\xa0\x0d\x68\x85\x37\xc3\x65\x6f\x9c\x87\xc6\xe8\x95\x5c\x8f\x56\x30\x47\x66\xe0\xbf\xa4\xe6\x49\xef\x4d\x7d\x76\x0e\x6e\xc0\x46\xae\x64\xc3\x33\x16\xf0\x5d\xe2\x53\x40\x8b\x8d\x12\xb4\x72\x8b\xf3\x59\x60\x56\xe0\x85\xdb\xd0\x5e\xc2\xc3\x9f\x4d\x2f\xe8\x44\xae\x33\xa3\x6a\xc1\x8e\x7a\x01\xff\x62\x6a\x07\x9d\xd8\xd2\x59\xd6\xca\xd4\x42\xa9\x3d\x8c\x5a\xfe\x36\x22\x4b\xe0\x02\x8c\x46\x30\x16\x7a\xa1\xf7\x4c\x0c\xd6\xd6\x8c\x83\xbb\x80\x5d\x27\x9b\xee\xec\x1c\x84\x45\x62\xb3\x77\xa8\xb6\xe8\xa0\x31\x4a\x61\x43\xdb\x3b\xda\xff\x70\xb9\x5b\x9c\x9d\x9f\x9d\xc3\x9f\xe8\x37\x63\x11\xa4\x5e\x19\xdb\x07\x76\x49\x78\x51\x6c\x0e\x4c\x38\x7c\x29\xb5\x0b\x18\x14\x0a\x87\xe0\x10\xcf\xce\x79\xd8\x68\x25\x35\x42\x6b\x9a\xb1\x47\xed\x23\x1d\xff\x96\x37\xa1\xff\x3a\xef\x07\xf7\xf6\xea\x6a\xb7\xdb\x2d\x34\x09\x60\xb0\xe6\x3d\x36\x7e\x21\xcd\x55\x6b\x1a\x77\xf5\xde\xd4\x97\x33\xa9\xd1\x2f\x8b\xce\xf7\xea\xec\xfc\x8c\x64\x3c\x01\xe0\xd3\x19\x40\xd4\xa5\xc5\xb5\x34\xba\x82\x41\x58\xd1\xa3\x47\x9b\x24\x8f\x41\xb1\x61\x9c\x34\xc8\x62\x02\x6f\x00\x3f\x60\x33\x7a\x4c\x2a\x5d\x30\xb1\x77\x2b\x30\xbd\xf4\x1e\xdb\x0b\xf0\x84\x3e\xa9\x3b\xb4\xd2\x07\x2a\x2d\xae\xc4\xa8\x7c\xa2\x46\x0a\x21\x99\x56\x41\x53\x55\x20\x11\x07\x97\xf9\x67\xfa\x75\xe2\xb4\x15\x5e\x34\xa8\x3d\x5a\xf7\x38\xbb\x4a\x3a\x4f\x94\x8b\xc9\x91\xf1\x00\x16\x26\x57\x23\xc1\xd4\xc9\x16\x2d\xb6\xb0\xeb\x50\xc3\xa0\x44\x23\xf5\x3a\xb0\x4e\xea\x8d\x36\xd4\x8f\xce\xd3\xfc\xc1\x9a\xad\x6c\xb1\x25\x4e\x4b\xda\x4b\xf8\xdf\xaa\x6d\x6e\xaa\xbf\x9e\x4d\x8c\xfa\xfd\x80\x25\x87\x8d\xd1\xde\x1a\x15\x0d\x65\x3f\xf0\xd1\xdf\x9b\x3a\x22\x0f\x64\x3f\x88\x26\x0a\xca\x35\x1d\xb6\xa3\x42\xfb\x07\xc7\x04\x5b\x6c\xa4\x63\x0b\x08\x3c\x22\x81\x23\xf2\x36\x37\x35\xe9\xa2\xb5\x09\xc5\xf8\x8b\x22\x77\xe0\x0d\x53\xaa\x1c\xda\xad\x6c\xb0\x5a\x30\x66\x05\xac\x46\xa5\xb2\xbc\x08\x1f\xc4\x9a\xe3\xb5\xbe\x43\x69\xa1\x95\xab\x15\x5a\xd4\x0d\xba\x19\x60\x89\xda\x63\x90\x5d\x64\x9d\x9d\x32\x8c\x92\xcc\xd3\xa8\x4f\x54\x9e\x8b\x7c\x42\xc1\x55\x16\x9e\x0b\xb0\x0f\x44\x58\xe2\xcb\xe9\xfc\x85\xa6\x08\x05\xde\x0a\xa9\x7d\xf6\x67\xec\x4e\x49\x0c\x6d\x2b\xa3\x34\xa7\x59\x0e\x56\xc6\xce\xb1\x42\x7a\x64\x82\x52\xe7\x35\x64\x24\xe4\x26\x2c\x3a\x33\xda\x86\xfd\x46\x6b\xe5\x36\x60\x21\xd1\x8a\x5a\x8c\xfb\xf6\x82\x5d\x3b\xeb\x38\xa0\x54\xf8\xc9\x6f\x5c\x40\xc5\xde\xaa\xba\x20\x5a\x15\x01\xb4\x02\x85\x5b\x54\x17\xac\x30\x37\x0e\x83\xb1\xde\xc1\x56\x58\x29\x6a\x45\x52\xf7\x68\x07\xa3\x9e\xa1\x95\xd3\xee\xea\x58\x36\xcf\x06\xc1\x8b\x34\x78\xe0\xbb\xa6\xed\x4b\x5d\x9e\x17\x02\x8c\x5e\x0c\x40\x78\x6f\x65\x4d\x1e\x69\x09\xd5\xdf\x7d\xa2\xff\x5d\x6c\xd0\x6a\x54\x0b\x72\x34\x0f\x55\x9c\xb7\x15\x6a\x44\xe6\x67\x09\x95\x92\x7a\xfc\x10\x46\x1e\x0a\x44\x8c\x43\x2b\x3c\x66\x34\xcc\x9d\x4b\x18\x04\xda\xdf\xe3\x7a\x9f\xa2\x52\x0c\x24\x0b\xa6\x10\xe6\x30\xc1\x3c\x4f\x3a\x18\x1d\xb6\x04\x8b\xe8\x0b\x08\x3b\x7a\xed\x40\xc9\x0d\x82\x35\x4a\x11\x9e\xc6\x61\x6d\x45\x4b\xc6\xd6\x08\x2d\xac\xa4\x7f\x09\x1d\x5d\x96\x1a\xf1\x6a\x6d\x11\x35\xb4\x38\x28\xb3\x27\x61\xbb\xc5\xcc\xed\x6a\x73\xc4\xa1\x74\x80\xa4\xe8\x06\x5b\x66\x2f\x78\x82\x83\x43\xce\xa0\x97\x60\x47\x0e\xc1\xd8\xe2\x7c\x0b\xf8\x4b\x72\x94\x79\x16\x93\x63\x4f\x26\x3d\x88\x61\x50\x2c\x29\x03\x42\xa9\x28\x14\xce\x29\xa6\xf0\x7f\x44\xa4\x36\x31\xe5\xa0\xfd\xd2\x61\x79\x69\x82\x37\x7b\x45\x66\xd4\x71\x84\xee\xd1\xae\xc9\x6b\xa7\x5c\x85\x27\xff\x81\x9c\xf6\x86\x84\x38\x58\x6c\xb0\x25\xa7\xf5\x12\xd0\xcf\x25\xf3\x37\x05\x7c\xd8\xba\x04\x7b\x54\x26\xc1\x3c\xe3\xb3\x17\x1f\xee\x29\xb2\x28\x85\xea\xf1\x28\xd8\x8b\x0f\xb2\x1f\x7b\xd0\x63\x5f\xa3\x25\x9c\x06\x5a\x31\x18\x10\xb5\x01\x2d\xc9\x82\xdc\x56\xa2\xb7\x80\x77\x3a\x38\xb5\x46\x38\x8c\x61\xbc\x20\x9c\xe1\x95\xf3\x4f\x42\x47\xa4\x27\x3c\x08\xf0\xb2\x67\xb1\x03\x94\x7c\xc2\x12\x6e\xce\x66\x87\x90\xfa\xbe\x43\xa1\x7c\xb7\xbf\xa7\x25\x4f\x1c\x44\x6a\x3e\x08\xcd\xe2\x1f\x84\x52\x26\x08\x2c\x12\x4c\x01\x3a\x62\x2c\x92\x25\x05\x7a\x84\x1a\x57\xac\x76\x4f\x86\xd0\x0b\xbb\x21\xd0\xb9\x3c\x89\x20\x30\xea\x5a\x99\x66\xe3\x22\xb9\xd5\x68\x7d\x87\xb6\xd8\xc7\xc1\xca\x9a\x1e\x6a\x0c\x26\x4a\x02\x68\xe3\x19\x0f\x8e\x41\x6e\xe5\xe6\xda\x55\xb3\xb3\xa6\x09\x2d\x8a\x96\x80\xf3\xf8\x59\xd3\x8c\x22\xd7\x62\x0b\x63\xe9\x66\x76\xf2\x81\x4f\x1c\x67\x45\x44\xf3\xd2\x72\x91\x4c\xe7\x13\xa3\x37\x64\x00\x0d\xe7\xc7\xde\x0a\xed\x38\x64\x05\xef\x34\xea\x48\x6b\x01\xbf\xe4\x21\x0e\x75\xc5\x18\x17\x0e\x49\x5c\x42\xaa\xc8\x7c\x72\x4a\x2c\xd5\xc1\x78\xd4\x5e\xf2\x26\xe4\xde\xa0\x16\xcd\x26\xdb\xb9\x5c\x41\x45\x8c\xdc\x5b\xdc\xa2\xf5\xd5\xc4\x9e\x43\x4f\x7b\x79\x3b\x46\x1c\x1d\x8a\x8f\x64\xfc\xa6\x9f\x8b\x78\xb0\x66\x6d\xd1\xb9\x17\xc9\x58\xe8\xdf\x21\xe2\xe0\xe2\x33\x91\x1a\xd7\x52\xbb\x90\x40\x12\xf5\x95\xb4\xce\x1f\x93\xa3\x9c\xe1\x40\x46\x64\x63\x5c\x79\xb5\x2c\x2e\xe9\x28\x57\x40\xcf\xa4\x48\x26\x20\xf4\x31\xd4\x85\xa3\x73\x71\xba\x76\x40\x6e\xd2\x63\x70\xbf\x73\x33\xe0\x28\xa1\xcd\x31\xc1\x83\x65\x8f\xda\x0f\x0d\x24\x21\xe7\xd3\x5f\x14\xf0\x9c\x9f\x6c\x12\x1b\xc1\x23\x59\xcb\x91\x96\x82\xb9\x1c\xe8\x72\x06\x8b\x53\x5a\x94\xab\x0c\xa3\x58\xfe\xd1\x92\xcb\xb0\x24\x9e\x22\x12\x54\xc2\x79\x3a\x48\x1d\x2b\x65\x53\xc6\x4e\xe6\x6d\xb4\x58\x14\xa0\x13\xdf\x71\x91\x5c\x71\x24\x3b\x65\x86\xae\xd4\x06\x55\x39\x05\xe5\x1d\xd5\xeb\x91\x58\x02\x0e\x13\x28\x0e\x07\x4b\x58\x09\xe5\x70\x76\x78\x0e\xfb\xfb\xc7\xd0\x2b\x3c\x34\x9d\xd0\x6b\xcc\xca\xe2\xa4\x9d\x7e\xdf\x85\x3a\x18\xdd\xa8\x12\xfe\x24\x1d\xd6\x79\x3b\x36\x5c\x4e\x27\xff\x1f\x65\x16\xcb\x7e\x8e\xad\x71\x8b\xb6\x88\x16\x29\xff\x88\xb4\x28\xd6\x9a\x91\x64\x69\x86\x81\xdc\x01\x25\xb7\x83\xc5\xad\x34\xa3\x2b\x85\xb2\x80\x7f\xd7\x4d\xcc\xec\x07\xb4\xc2\x53\xe2\x4b\x07\xe9\x39\xa7\x9e\x04\x99\x36\xe0\x88\x1e\x65\xc4\x80\xda\x73\xa3\x23\x14\x5c\xbd\xf1\x5c\x9e\x91\x99\x26\x37\x0d\xa2\x48\x97\x62\xa6\x45\x04\xa3\x4d\x58\xec\x85\x64\x8f\x35\x53\x15\xc5\x26\xca\x88\xb8\xe6\x9c\x85\xd0\xa0\x98\xf3\x48\xe5\x4f\xc1\xfb\x5f\x90\x1f\xf2\x44\x25\xab\x04\x7f\x1b\x85\x4a\x72\x6f\xcc\xa8\xb3\x19\x4e\x19\x12\xef\xb9\x4b\x42\x7b\x2c\x63\xfb\x4b\xf2\x16\x11\x75\x31\xa4\x5c\xa4\x8a\x8c\xdc\x40\x24\xad\x71\x17\x89\x6d\xd1\xba\x58\xe4\x05\x62\xd1\x71\x8c\x03\xd5\x85\x2c\x2a\x19\x73\x18\xa3\xda\x72\x3a\xeb\x2c\xd9\x60\x38\x0d\x2c\xe1\xfa\x0c\xe0\x21\x67\xbd\xbd\x5c\xdb\x90\x36\x9e\x48\x7a\x53\x7e\x95\x73\x4a\x72\x67\x61\x05\x49\xc8\xac\x56\x60\x56\xa1\x56\xb5\x51\xf6\xda\xb4\x78\x90\x9b\x8a\xdc\x02\x88\x4b\x8d\x9e\x65\xa9\x21\x79\x6c\x3f\x93\xb3\xa5\x34\x2d\x32\xfc\x2a\x79\x5a\xdc\xbb\x4c\xd4\x92\xfc\x52\xa6\xf6\xf3\x4c\x80\x93\x59\x15\xc5\x42\xb4\xe7\x80\xf5\xb8\x3e\xe7\xde\x4e\xf4\x09\xd7\x9c\x51\x85\x42\x31\xd2\x49\xc1\x49\x91\x33\xf6\x9d\xd0\xb1\xff\xe6\xb9\x52\x25\x60\xa6\x78\x13\x41\x99\x00\xf9\xf7\x61\xf4\x72\x96\x9b\xfd\x43\x68\x03\x32\xbd\x95\x07\x3b\x6a\xd6\x60\x3b\x5a\xfa\x2b\xeb\xca\x3d\x9d\xd5\xcd\x0f\xdc\x23\xf9\x29\xe9\xfa\x22\xca\x16\xd6\x18\xcc\x3d\x40\x39\xba\x86\x5c\x9c\x70\x66\x9a\x72\x87\x50\xb0\x05\x1f\x51\x35\x1d\x36\x1b\x57\xe5\xf2\xf7\x9e\x23\x94\xab\xca\x34\xe1\x9e\x27\x51\x5c\x89\xb3\x1f\xe1\xef\xf1\xa4\xf2\xc9\x74\x32\x19\xf6\xf3\x93\xca\xcf\xa4\x93\x29\x85\x8d\xea\x8f\x7a\x2e\x92\xee\x16\x46\xc7\xce\x0c\x94\xa8\x51\x81\x1b\x57\x2b\xf9\x21\x54\x8d\xd5\x9b\xeb\x28\x8e\x9b\xbb\xbe\x7a\x5e\x46\xfa\xf3\xe7\x13\xce\x67\xe5\x41\x29\x1c\x3e\x95\x70\xfe\x8e\x54\xb3\xcb\xf9\xdf\x73\xcf\x7e\xdb\xc7\xa3\x77\xd5\xe3\x79\xe2\x5d\x5f\xcd\xdc\x5c\x6c\xa1\x1c\x75\x7a\xc0\x21\xc7\xa2\x79\x93\x39\x46\x4a\xee\x15\x5e\xf2\xb9\xb0\x05\x4e\x9d\xce\xb3\x91\x86\x4e\x34\x34\x4a\x72\x57\xee\xbb\xd4\x59\x8e\x45\xaf\x88\x26\x98\x4c\x2c\x96\xbd\xd1\x8b\x45\x2b\x3f\x4f\xcb\x5f\x50\xae\xce\x0e\xf4\x37\xf5\x82\xa1\x25\x50\xf8\xc0\x70\xd2\xaa\x11\x4d\x17\x1b\xcc\x45\x97\x6d\xd4\x8f\x64\x73\x07\xfe\x71\x16\x4e\x67\x7a\xc8\xb6\x97\x5d\xd4\xa8\x5b\xb4\xa1\x46\x8d\xfd\x09\xb6\x9e\xd0\xe4\x49\xc8\xd5\x46\x5f\x6a\x5c\x87\x2b\x85\xb2\x2b\x9a\xdc\xab\x81\x9b\x18\x1a\xd9\x39\x1e\x56\xaa\x16\x9d\x17\x76\xea\x0e\xa6\x96\x2b\xc3\x26\x45\xc6\x1a\x3b\xb1\x95\xc6\xb2\x5a\x88\xfd\x9c\x5a\xbe\x5b\xa5\x54\x94\x9c\xeb\xa8\x33\xb6\xcb\x80\x18\xf7\x80\xc1\x28\xd9\x4c\xcd\xa2\x5a\xb8\x09\x2b\xa9\x3d\x7b\x90\xae\x3c\x1b\x28\x07\xe7\x38\x80\xca\x33\xc0\x32\x6d\xfa\x42\xc0\x44\x0e\x12\x64\x12\xbd\x74\xf8\x00\x98\x24\xf7\x09\x12\xc2\x7b\xec\x07\xee\x62\x93\xe6\xb3\x30\x8a\xb6\xd2\xe4\x30\xb8\xe7\xb9\x15\x6a\x11\x89\xe5\xc5\x4b\xb8\x8d\x3f\xa5\x29\x5c\x47\xe6\xe2\x63\xba\x63\x40\x25\x1e\x4d\xc0\x91\xc2\xa2\x48\x0d\xde\x9d\x90\x3e\xc5\x82\x78\x8a\xe4\xd2\xd9\x37\x06\x28\x04\x17\x29\x3d\x74\x07\xe5\x10\x00\xef\xc5\x1e\xfa\xce\x1d\xf2\xd1\x9b\xf6\xf4\x15\xc2\x8e\x4c\xa2\x13\xc3\x80\xa9\xf0\x8c\x1b\x11\xfd\xc8\x06\xb6\x99\x58\x95\x44\x50\x71\xb4\x9b\xb5\xe3\xb2\xb4\xf2\xb1\x69\xd7\xc0\x56\xb4\x4c\xfc\xe0\x33\xa9\xa4\xa9\x51\xfb\x58\xf3\xd3\x70\x49\x85\x8e\x97\x88\x18\x74\xa0\xcd\x04\xee\x64\xda\x99\x1c\xf7\x00\x32\x73\xc4\x7d\x4d\xa9\x72\xc7\x17\x93\xc7\x3c\xc6\x75\x4c\x7c\x19\xb7\xe2\xdf\x1e\x66\xf6\x8a\x43\x87\x3d\x5a\xa1\xee\x5b\xe9\x36\xd3\x25\xa5\x0e\x95\x90\x8b\x0e\x9b\xe2\x8f\x97\x4a\x7e\x24\xa7\x00\x79\x11\xd0\xa2\x5c\x3f\x39\x8f\xa2\x65\x0c\x42\x27\x6c\xcb\x83\x60\xf1\xb7\x51\xda\x78\x0b\xf3\x03\x3b\x6e\x17\x03\x95\x2f\xba\xf9\x33\xa7\x45\x72\x08\x38\xda\x1f\x11\x71\x29\xd3\x48\x77\x05\x99\x44\xe1\x0f\x17\xf0\x5d\xee\xb8\x84\x08\x25\x75\xe1\xf9\x42\x7c\x71\x5d\xbc\xbf\x0c\x91\x69\x7e\xa8\x97\xfa\x8d\xd3\xf2\x4c\xee\x23\x37\x6d\x3e\x7b\x99\xf3\xc5\xee\x63\xce\xc8\xa1\x17\x99\x8f\x16\xce\x84\x8b\x2d\xe7\x65\xb3\x61\xc7\xea\xed\x88\xe9\x82\xab\x2c\xdc\xca\x32\x6c\x76\x0b\x97\x09\xb1\x88\x07\x8b\x2b\x8a\x39\x26\x44\xf2\xe2\x4e\xa0\x2d\x73\x9f\x22\xbe\x73\x29\x14\xfb\xda\x05\xa1\x54\x30\xb0\x4f\x11\x5e\x4c\x99\xdf\xe8\x70\x35\xaa\x90\xc2\x17\xb9\x88\x27\x6d\xd1\xcc\x4c\xa7\xcc\x51\x06\x2a\xf7\x9c\x07\xd1\x58\xe3\xca\x82\x3c\x95\xfd\x8b\xbc\x2c\xca\x62\xc9\xa2\x48\xbf\xe6\xd1\x9f\x63\xd9\x9b\xf9\x0b\xad\xb8\xd8\x59\xc8\x58\x2d\x36\x68\xa5\xc5\xc6\x1b\xcb\x97\x21\xe2\x70\x9b\x93\x13\xbd\x29\x6b\x9e\x89\xb5\xb4\xe9\x23\xbc\xb1\x7d\x3b\xf9\xf1\x89\xee\x1e\x8d\x12\x8f\x3f\x7d\x4f\xdc\xb0\x41\xb4\xa7\xac\x3b\x64\x12\x7e\x47\x0e\xa7\xb0\xa7\x58\x31\x25\x8e\x98\xda\x12\xde\x5c\x5f\x9f\x70\x34\x62\xc5\xaf\x2e\xf6\xd9\xc5\xa0\x16\x35\x5b\x4e\xec\x7b\xb8\x70\x53\x3e\x70\xcf\x2c\xdf\xdc\x46\x08\xf1\x9d\x6a\x4a\x69\x52\x9c\x0f\x50\x49\x77\x59\x8e\x1f\x1b\xa0\x17\x8c\x8f\x17\x9a\xef\x21\x97\xaf\x60\xb8\x89\x85\x43\x93\xa5\xea\x21\x8c\xe4\x64\x71\xba\xc7\x3b\x48\x10\xe3\x6b\x01\x71\x20\xa2\x52\x42\x47\x24\xf8\x2a\x90\xe6\x2f\xa6\xeb\xfa\x87\xea\x2c\x29\x31\xa4\x89\x87\xcd\x61\x27\x2d\x57\xe1\x89\x08\xcf\x9a\xae\x45\xa2\x7c\xe3\xfb\x93\x63\xc7\x30\xa9\x59\xa6\xfb\x24\x77\xb9\x43\xe7\x6f\xaa\xe2\xd1\xc0\x62\xc6\x02\x31\x9a\x67\x65\xf6\x76\x28\xd7\x5d\xee\x0f\xa4\xcb\x43\xa9\x5b\x12\x2b\xd9\xa3\x0a\x29\xed\x04\xa7\xb4\xb0\xec\x2e\x51\x54\xed\x43\x03\x97\x5f\x0f\x61\x96\xf9\x02\xde\xf9\xf2\x85\x00\xdc\x5d\x53\x44\xe6\x48\x85\x7e\x31\xe7\x62\x09\x37\xd1\x06\xce\xd9\x0c\x4a\x3b\x70\x83\x45\xd1\x66\x2b\x08\x1d\xb0\xb9\x11\x48\xdd\x58\x4e\x36\xb9\x45\x1e\x52\x63\xf0\x46\xa1\x15\xba\xc1\xd0\x3c\x8a\x19\xa8\xb4\xa1\x11\x94\x4a\xe5\x7a\x9f\x02\x67\xa8\x04\x0f\xf4\xcf\x3e\xb0\x28\xad\x13\xac\x73\xe5\x16\xb8\x03\xb3\xcd\x52\xff\xdd\x26\x34\x3f\xe0\x2b\x18\x50\x60\xe0\xd8\x7c\xe2\xd9\x5e\xc3\x78\xbc\xb0\x6b\xf4\xee\x10\x9e\xa1\xa0\xce\x66\x34\xa0\xa5\x95\x62\x1d\x4a\xeb\x63\x3d\x51\x90\x43\xd1\x74\x91\xde\x09\xcb\x3b\x90\x5f\x98\xc7\xf6\x82\x82\xad\xea\x53\x21\xdb\xb8\x1f\x2c\xe1\xeb\x8c\x56\xae\xfe\x8f\x16\x47\x93\x3c\xbd\xf8\xab\x13\x8b\xe7\xbe\x3f\xbc\xbe\x48\x15\x21\x77\xd2\x1d\xe5\x91\x64\x9e\x5b\xd9\x8e\x42\xc1\xa8\x25\x77\x71\x77\xc6\x6e\x2e\xc0\x8d\x4d\x07\x82\x4a\xc6\x3f\x9a\x66\x13\xb3\x0a\x7e\xca\xe0\x85\xd4\x68\x2f\x60\x87\x75\x89\x7c\x7e\xe5\x51\x0b\xdf\x74\x30\x58\xd3\xa0\xa3\x04\xf3\xa5\x08\x2e\xd9\x7d\x85\xc2\x8f\x13\xd8\x03\xf4\x72\xea\x55\x59\x6c\xa5\xab\x0e\x4a\xbf\x2a\x3c\x94\x79\x3c\xc8\xf3\xda\xf8\x9a\xe6\xa0\x51\x13\x81\x38\x95\x2c\xb1\x60\x64\x16\x52\xd5\x15\x56\x2e\xa1\x6a\x59\x17\x87\x95\x57\xa8\xf0\x1f\x79\x00\x32\x3d\xe2\x99\x1e\x5e\xe5\x57\x5c\x0e\x06\xe1\x5c\x51\x7c\x85\x94\x47\xed\xd3\xb5\x41\x62\xda\xc0\xbc\x26\x4a\xb7\x8a\x5e\x48\xc5\xa6\x32\xa3\xef\xa6\x92\xd2\x4e\xcf\x22\x39\xbb\x20\xdb\x09\x44\x2f\xc0\x99\xf2\x6d\x55\x9e\x16\x86\x27\x96\x66\x1a\x5e\x9d\xc0\x50\x92\x53\xe0\x21\x2b\x07\x40\xf6\x62\xcd\x9e\x81\xd5\xf6\xf6\xcd\xe2\x36\x8b\x0e\x60\x30\xd6\xdf\xf7\x62\x28\xe6\x03\xb4\x35\xd9\xe2\x9b\x6f\xbe\xcd\xbf\x3d\x9c\xa5\xbf\xe7\x42\xa7\xda\x79\x25\x1a\xff\x54\xc1\xd6\x9a\x9d\x56\x46\xb4\x7c\x35\x1a\xe7\x87\x5e\xaa\x28\x6a\xd4\xde\x90\x07\x0c\xaf\xae\x06\x2b\xcd\x24\xee\x50\xa2\x61\xf9\xb8\x2f\x3e\xea\x23\xc3\x6c\x8c\xde\xa2\xa6\x72\x6e\xca\x47\x73\x1b\x9b\xe4\x94\xb6\x27\x32\xf3\x87\x77\x2b\xa9\x42\xb6\x46\xbe\x12\x34\x62\x1b\xdc\x61\x44\xdf\x94\xb1\xf3\xc6\xef\xb8\x6d\x3c\x18\xe7\x64\xad\x38\xc3\x4e\xa5\xa1\x3f\x29\x89\x7e\x54\x5e\x52\xd2\x11\xea\xf7\x02\xdd\x59\x20\x79\x4a\x5a\x3c\xe5\xfb\x79\xf2\xef\xc8\x19\x0f\x38\x38\x72\x19\xcf\x72\x1a\xe5\xde\x2f\x74\x1c\x89\x91\xc9\x79\x94\x44\x33\x04\x3e\x15\xfb\x44\xc5\x2f\xa1\xa2\xfd\xde\x5e\x5d\xad\x8c\x59\x34\xa6\x9f\x68\x79\x61\x17\xeb\x8f\x55\xb1\x26\x3c\x9a\x74\x33\x3a\x00\xe1\x02\x61\xec\x89\x56\xdf\xde\xbd\x6d\xbe\x12\xe2\x1f\xef\xde\x88\xf6\xf6\xf6\xe6\xee\xab\xdb\xaf\xb1\xfe\xa6\xfd\xe6\x5a\xdc\xde\x7c\x7b\x7b\x8b\xdf\x7c\xfb\x55\x49\xf1\x21\xff\x3b\x25\x4b\x19\xe8\xca\xac\xdd\x09\x90\x93\x38\xcb\x56\x32\x29\xa3\x33\xbb\xf0\xd8\x58\x99\x75\xc4\x58\x59\x47\x96\xcf\x7c\xb8\x52\xe1\x7e\x81\x71\x48\xf3\x5d\x5c\x40\x28\x24\xb7\xa2\x17\xf0\x6f\x66\xbd\x26\xec\xf2\x8b\x30\x2a\x55\x5a\xa8\xf7\x13\x96\x42\x2a\x78\x01\xf5\x18\x5f\x1d\xce\x38\x8d\x69\x1d\xd9\x01\x85\x78\x7b\xb9\xb6\x14\xb8\xda\xfc\x9c\xcd\x94\x4e\x86\xdf\xe1\x9a\x35\x58\xe3\x27\x9c\x51\x09\x4b\x0e\x64\x66\x3b\x5f\x82\xd3\x92\xc1\x57\xc3\x28\x31\x71\x1a\x9f\xac\x85\x12\x53\xbd\xf8\x70\x1f\xb4\x02\xfc\x02\xf1\xe6\xfa\xc4\xe0\x7d\x2c\x3a\x6f\xee\x4a\x0c\xcd\x20\x94\x1b\x45\xc5\x45\x86\x6b\xac\xac\xf3\x83\xed\xa2\xb9\x14\x9b\x83\xe4\x94\x66\xbe\x23\x3e\xe1\x5e\xc0\x7f\xa6\x27\xaa\x07\x3d\xa9\x46\x8d\x2d\x42\x8f\xbd\xb1\xfb\x0b\xd0\xe8\x43\x26\xd3\x0c\x63\x78\x70\x4a\x3a\x5a\x14\x8c\x31\xac\x1c\x37\xc6\x73\x90\xe6\xd2\x28\x3d\x16\x27\xb9\x43\x2f\x9a\x8e\xf4\x11\x2e\x3f\x43\xfa\x43\x0b\xcd\xb8\xee\xca\x46\x63\x60\xa9\x11\x83\x68\xa8\x58\xf9\x02\x94\x1c\x49\xeb\xd5\xa0\x92\x39\x39\x85\x97\xa9\xfb\x37\x05\xd0\x66\x18\x03\x52\xee\xae\xaf\xe1\x9c\xff\xfc\xe9\xc7\x8f\x79\x38\xe8\x06\x96\x70\x7b\xf7\x35\x9c\xd3\x9f\x3f\x7d\x3f\x05\xe4\xa8\xb1\x59\x3c\xee\x6b\xc9\xbd\xf0\x8c\x3c\x88\x91\x1b\xa0\x6a\xeb\x0a\xe0\xd3\xc3\x89\x48\x3d\x03\x5f\x7a\x43\xfd\x44\x9c\xb6\xb8\x96\xce\xa7\xab\x99\xd0\x04\x8f\x97\x6c\xb4\x34\xd3\x4b\xdd\xfb\xf0\x33\xb4\xd2\x35\xe4\x45\xf6\x80\x7a\xcd\xcf\x8b\x72\x5a\xd5\x8c\xd6\xa2\xa6\x44\xea\x07\xa3\xdd\xa8\x62\xf4\xce\xcf\xd0\x38\x58\x8b\x0d\xce\xe8\x89\xb6\xb5\xe8\x1c\xbf\xe3\x09\x4d\xf8\xc0\x21\xd5\xc4\xf1\x1e\x4e\xfa\x80\xca\xce\x38\x3f\xf3\xad\x24\x93\x2f\x01\xdd\x81\x94\x5e\x0d\x72\x91\x8f\x53\x80\x4b\x62\x9a\xf0\xc1\x85\x62\x4a\xef\x2e\xc3\x3d\x5e\x1e\xf4\x62\x1d\xbe\x75\x88\x5f\x66\x5c\xa4\x9b\xbe\xbf\xce\x52\x40\x4e\xab\xeb\x22\x2f\x0c\x17\xf2\x25\x08\x79\x9b\x80\xeb\x4a\x28\xb9\x2d\x36\x89\x4f\xf5\xe3\xa0\x6f\x86\x72\xa8\xbc\xb8\xe1\x2b\xed\x62\x95\xec\xd1\x8c\x9e\x57\xdd\x16\x23\x8f\x65\x9b\x1e\xfb\x41\x95\x0f\xa0\x4f\xa0\xb8\x17\x9a\xa2\x95\x80\x34\x39\x57\x71\x53\x06\x72\x22\x0f\xa4\x34\x90\x9c\xf1\x90\xbe\xd1\x48\xcb\xc3\xf7\x5b\xf1\xfb\x0c\xb5\x87\x61\x54\x6a\xde\xd0\xe5\x54\x36\x00\x9c\xa8\xfc\x37\xdf\x0d\x7a\x03\x83\x19\x46\xa6\x60\x47\xcd\x77\xfa\xf3\x5d\xa7\xf6\xe0\xcb\xb0\x7a\x28\x8c\x57\x03\x6b\x62\xe4\x74\x38\xcd\x72\x2c\x43\x2a\x27\xdc\xf9\xbf\x25\x54\x97\x97\x97\xbf\xea\x0d\xee\xdf\xc2\xa7\x4f\xb0\xc1\x3d\xfc\x9a\x6c\xf1\xaa\xdf\x5f\x6e\x70\xff\x6b\x05\x0f\x0f\x65\xae\xd6\xa2\xf3\x52\x87\xc3\x84\xef\x02\x4c\x23\xd4\x15\x7f\x45\xb7\xef\x55\x39\x35\x3c\xbe\xbb\xe7\x2b\x28\x9e\xea\xe4\x5a\x8b\x53\x53\xc2\x00\x4d\xf9\xf9\xdd\x3f\xff\xf8\x5f\xff\x51\x3d\x1a\xcc\x8f\xa0\xd8\xf0\xc3\x4f\x67\xca\xbe\x4a\x7c\xac\x87\x7a\x2b\xad\xd1\xdc\x5f\x4c\x9f\x79\x4c\x68\x3c\xb8\x31\x48\x57\x15\x9c\x11\x86\xef\x0e\xa8\x9c\xe3\x04\x24\xd4\x9b\x53\x88\xae\xf1\xc4\xcd\x21\x37\x12\x59\xc0\x04\x55\x6c\x4f\xe3\x33\x3e\x48\x3c\x06\xe0\x67\xf5\xb5\x84\xea\x5f\xff\xe9\x7f\x96\x2f\xd1\xd3\x5c\x4b\xa8\xb7\xe5\x44\xd4\xdb\x02\x11\xe5\x4d\xc2\x91\xf0\xb7\x74\x84\xe7\x64\xe3\xde\x80\x68\x38\x3d\x22\x87\x60\x36\xa8\x59\x1a\x85\x27\xf8\x51\xb8\x4e\xfe\x60\xec\x10\xe5\x42\xa7\x41\x1b\x04\x1d\x48\x85\x5f\xa6\x0f\xca\xf2\x4b\x82\x76\x16\x7a\xc4\xe8\x3b\x63\xe5\xc7\xf4\xb5\x48\xdf\x8f\x3a\xf4\x7c\xf9\x83\x07\xa6\xbe\x80\xef\xf7\x53\xc6\x1e\xc8\xb3\x22\xa5\x26\x1b\x9b\x1d\x32\x70\x2b\x75\xf1\x62\x74\x2b\x05\xdf\x7a\x9e\x80\x53\x48\xed\x52\x28\xe5\xb5\x13\x67\x5b\x21\x95\x88\x35\xeb\x49\xd7\x51\x1e\x37\x4a\xae\x13\xba\x55\x39\x31\xd5\xb8\x13\x53\xc8\xa6\xbd\x2c\x6e\x4d\xf1\x89\x67\x87\xd9\xef\x6d\xf0\x8b\xaa\x83\x99\x6e\x5f\xcd\xa7\x31\x17\xa7\x1d\x1a\x0f\xcd\xac\x83\xdf\x7f\xc8\x58\x1f\x70\xb0\x6d\x5a\x4d\x91\x76\x65\x8d\xf6\xa8\xdb\x1c\x6c\xff\x1f\xbc\xd1\x0f\xb3\x6f\x14\x63\x40\x4d\x77\x64\x81\x82\x0a\x3d\x78\xf6\x1b\xe9\xf3\xe1\x1a\x61\x23\xc9\x3d\xcc\xb4\x4a\x3f\xcd\xdb\x2d\xef\xf2\xdd\x42\xf1\xf0\x25\xbe\x74\x99\xca\x08\x5a\x77\x9f\x36\xa7\x60\x9e\xe2\xfc\x03\xbf\xe3\x7a\x38\xfb\xbf\x00\x00\x00\xff\xff\xf0\xe5\x33\xa7\x0d\x3d\x00\x00") +var _command_assets_example_nomad = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x5b\xdd\x6f\x24\x37\x72\x7f\xd7\x5f\x51\x68\x05\xb8\x04\x90\x46\x1f\x6b\xd9\xf1\x02\xf3\x60\xfb\x72\xf1\x26\xf1\x25\x88\x9d\x1c\x82\xf8\x20\xb0\xbb\x6b\xa6\xb9\xc3\x26\xdb\x24\x7b\x66\x67\x17\xfa\xdf\x83\x2a\x7e\x34\x7b\x66\xa4\x95\xb5\xc8\xc9\x0f\xbb\xeb\x21\x59\x2c\x56\xfd\xea\x93\xec\x73\xf8\xa5\x43\x8b\xd0\x08\x0d\x46\xab\x3d\xd4\x08\x02\x9c\xd4\x6b\x85\xf0\xde\xd4\xd0\xe2\x4a\x6a\xe9\xa5\xd1\x30\xa0\x85\x95\x54\xb8\x80\x5f\x3a\xe9\x78\x54\x3a\xd0\xa2\xc7\xf6\xec\x1c\x2a\xfc\x20\xfa\x41\x61\x05\xce\x80\xf4\xb0\x93\x4a\x41\x63\x51\x78\xa2\x48\x93\x77\xd2\x77\xe0\x3b\x84\x77\x7f\x04\xa1\x5b\xf8\xb3\xe8\x71\x5a\xb6\x38\x3b\x63\x66\xa0\x7a\x6f\xea\x0a\x9c\x17\xfa\xa3\xa0\x0d\x68\x85\x37\xc3\x65\x6f\x9c\x87\xc6\xe8\x95\x5c\x8f\x56\x30\x47\x66\xe0\xbf\xa4\xe6\x49\xef\x4d\x7d\x76\x0e\x6e\xc0\x46\xae\x64\xc3\x33\x16\xf0\x5d\xe2\x53\x40\x8b\x8d\x12\xb4\x72\x8b\xf3\x59\x60\x56\xe0\x85\xdb\xd0\x5e\xc2\xc3\x9f\x4d\x2f\xe8\x44\xae\x33\xa3\x6a\xc1\x8e\x7a\x01\xff\x62\x6a\x07\x9d\xd8\xd2\x59\xd6\xca\xd4\x42\xa9\x3d\x8c\x5a\xfe\x36\x22\x4b\xe0\x02\x8c\x46\x30\x16\x7a\xa1\xf7\x4c\x0c\xd6\xd6\x8c\x83\xbb\x80\x5d\x27\x9b\xee\xec\x1c\x84\x45\x62\xb3\x77\xa8\xb6\xe8\xa0\x31\x4a\x61\x43\xdb\x3b\xda\xff\x70\xb9\x5b\x9c\x9d\x9f\x9d\xc3\x9f\xe8\x37\x63\x11\xa4\x5e\x19\xdb\x07\x76\x49\x78\x51\x6c\x0e\x4c\x38\x7c\x29\xb5\x0b\x18\x14\x0a\x87\xe0\x10\xcf\xce\x79\xd8\x68\x25\x35\x42\x6b\x9a\xb1\x47\xed\x23\x1d\xff\x96\x37\xa1\xff\x3a\xef\x07\xf7\xf6\xea\x6a\xb7\xdb\x2d\x34\x09\x60\xb0\xe6\x3d\x36\x7e\x21\xcd\x55\x6b\x1a\x77\xf5\xde\xd4\x97\x33\xa9\xd1\x2f\x8b\xce\xf7\xea\xec\xfc\x8c\x64\x3c\x01\xe0\xd3\x19\x40\xd4\xa5\xc5\xb5\x34\xba\x82\x41\x58\xd1\xa3\x47\x9b\x24\x8f\x41\xb1\x61\x9c\x34\xc8\x62\x02\x6f\x00\x3f\x60\x33\x7a\x4c\x2a\x5d\x30\xb1\x77\x2b\x30\xbd\xf4\x1e\xdb\x0b\xf0\x84\x3e\xa9\x3b\xb4\xd2\x07\x2a\x2d\xae\xc4\xa8\x7c\xa2\x46\x0a\x21\x99\x56\x41\x53\x55\x20\x11\x07\x97\xf9\x67\xfa\x75\xe2\xb4\x15\x5e\x34\xa8\x3d\x5a\xf7\x38\xbb\x4a\x3a\x4f\x94\x8b\xc9\x91\xf1\x00\x16\x26\x57\x23\xc1\xd4\xc9\x16\x2d\xb6\xb0\xeb\x50\xc3\xa0\x44\x23\xf5\x3a\xb0\x4e\xea\x8d\x36\xd4\x8f\xce\xd3\xfc\xc1\x9a\xad\x6c\xb1\x25\x4e\x4b\xda\x4b\xf8\xdf\xaa\x6d\x6e\xaa\xbf\x9e\x4d\x8c\xfa\xfd\x80\x25\x87\x8d\xd1\xde\x1a\x15\x0d\x65\x3f\xf0\xd1\xdf\x9b\x3a\x22\x0f\x64\x3f\x88\x26\x0a\xca\x35\x1d\xb6\xa3\x42\xfb\x07\xc7\x04\x5b\x6c\xa4\x63\x0b\x08\x3c\x22\x81\x23\xf2\x36\x37\x35\xe9\xa2\xb5\x09\xc5\xf8\x8b\x22\x77\xe0\x0d\x53\xaa\x1c\xda\xad\x6c\xb0\x5a\x30\x66\x05\xac\x46\xa5\xb2\xbc\x08\x1f\xc4\x9a\xe3\xb5\xbe\x43\x69\xa1\x95\xab\x15\x5a\xd4\x0d\xba\x19\x60\x89\xda\x63\x90\x5d\x64\x9d\x9d\x32\x8c\x92\xcc\xd3\xa8\x4f\x54\x9e\x8b\x7c\x42\xc1\x55\x16\x9e\x0b\xb0\x0f\x44\x58\xe2\xcb\xe9\xfc\x85\xa6\x08\x05\xde\x0a\xa9\x7d\xf6\x67\xec\x4e\x49\x0c\x6d\x2b\xa3\x34\xa7\x59\x0e\x56\xc6\xce\xb1\x42\x7a\x64\x82\x52\xe7\x35\x64\x24\xe4\x26\x2c\x3a\x33\xda\x86\xfd\x46\x6b\xe5\x36\x60\x21\xd1\x8a\x5a\x8c\xfb\xf6\x82\x5d\x3b\xeb\x38\xa0\x54\xf8\xc9\x6f\x5c\x40\xc5\xde\xaa\xba\x20\x5a\x15\x01\xb4\x02\x85\x5b\x54\x17\xac\x30\x37\x0e\x83\xb1\xde\xc1\x56\x58\x29\x6a\x45\x52\xf7\x68\x07\xa3\x9e\xa1\x95\xd3\xee\xea\x58\x36\xcf\x06\xc1\x8b\x34\x78\xe0\xbb\xa6\xed\x4b\x5d\x9e\x17\x02\x8c\x5e\x0c\x40\x78\x6f\x65\x4d\x1e\x69\x09\xd5\xdf\x7d\xa2\xff\x5d\x6c\xd0\x6a\x54\x0b\x72\x34\x0f\x55\x9c\xb7\x15\x6a\x44\xe6\x67\x09\x95\x92\x7a\xfc\x10\x46\x1e\x0a\x44\x8c\x43\x2b\x3c\x66\x34\xcc\x9d\x4b\x18\x04\xda\xdf\xe3\x7a\x9f\xa2\x52\x0c\x24\x0b\xa6\x10\xe6\x30\xc1\x3c\x4f\x3a\x18\x1d\xb6\x04\x8b\xe8\x0b\x08\x3b\x7a\xed\x40\xc9\x0d\x82\x35\x4a\x11\x9e\xc6\x61\x6d\x45\x4b\xc6\xd6\x08\x2d\xac\xa4\x7f\x09\x1d\x5d\x96\x1a\xf1\x6a\x6d\x11\x35\xb4\x38\x28\xb3\x27\x61\xbb\xc5\xcc\xed\x6a\x73\xc4\xa1\x74\x80\xa4\xe8\x06\x5b\x66\x2f\x78\x82\x83\x43\xce\xa0\x97\x60\x47\x0e\xc1\xd8\xe2\x7c\x0b\xf8\x4b\x72\x94\x79\x16\x93\x63\x4f\x26\x3d\x88\x61\x50\x2c\x29\x03\x42\xa9\x28\x14\xce\x29\xa6\xf0\x7f\x44\xa4\x36\x31\xe5\xa0\xfd\xd2\x61\x79\x69\x82\x37\x7b\x45\x66\xd4\x71\x84\xee\xd1\xae\xc9\x6b\xa7\x5c\x85\x27\xff\x81\x9c\xf6\x86\x84\x38\x58\x6c\xb0\x25\xa7\xf5\x12\xd0\xcf\x25\xf3\x37\x05\x7c\xd8\xba\x04\x7b\x54\x26\xc1\x3c\xe3\xb3\x17\x1f\xee\x29\xb2\x28\x85\xea\xf1\x28\xd8\x8b\x0f\xb2\x1f\x7b\xd0\x63\x5f\xa3\x25\x9c\x06\x5a\x31\x18\x10\xb5\x01\x2d\xc9\x82\xdc\x56\xa2\xb7\x80\x77\x3a\x38\xb5\x46\x38\x8c\x61\xbc\x20\x9c\xe1\x95\xf3\x4f\x42\x47\xa4\x27\x3c\x08\xf0\xb2\x67\xb1\x03\x94\x7c\xc2\x12\x6e\xce\x66\x87\x90\xfa\xbe\x43\xa1\x7c\xb7\xbf\xa7\x25\x4f\x1c\x44\x6a\x3e\x08\xcd\xe2\x1f\x84\x52\x26\x08\x2c\x12\x4c\x01\x3a\x62\x2c\x92\x25\x05\x7a\x84\x1a\x57\xac\x76\x4f\x86\xd0\x0b\xbb\x21\xd0\xb9\x3c\x89\x20\x30\xea\x5a\x99\x66\xe3\x22\xb9\xd5\x68\x7d\x87\xb6\xd8\xc7\xc1\xca\x9a\x1e\x6a\x0c\x26\x4a\x02\x68\xe3\x19\x0f\x8e\x41\x6e\xe5\xe6\xda\x55\xb3\xb3\xa6\x09\x2d\x8a\x96\x80\xf3\xf8\x59\xd3\x8c\x22\xd7\x62\x0b\x63\xe9\x66\x76\xf2\x81\x4f\x1c\x67\x45\x44\xf3\xd2\x72\x91\x4c\xe7\x13\xa3\x37\x64\x00\x0d\xe7\xc7\xde\x0a\xed\x38\x64\x05\xef\x34\xea\x48\x6b\x01\xbf\xe4\x21\x0e\x75\xc5\x18\x17\x0e\x49\x5c\x42\xaa\xc8\x7c\x72\x4a\x2c\xd5\xc1\x78\xd4\x5e\xf2\x26\xe4\xde\xa0\x16\xcd\x26\xdb\xb9\x5c\x41\x45\x8c\xdc\x5b\xdc\xa2\xf5\xd5\xc4\x9e\x43\x4f\x7b\x79\x3b\x46\x1c\x1d\x8a\x8f\x64\xfc\xa6\x9f\x8b\x78\xb0\x66\x6d\xd1\xb9\x17\xc9\x58\xe8\xdf\x21\xe2\xe0\xe2\x33\x91\x1a\xd7\x52\xbb\x90\x40\x12\xf5\x95\xb4\xce\x1f\x93\xa3\x9c\xe1\x40\x46\x64\x63\x5c\x79\xb5\x2c\x2e\xe9\x28\x57\x40\xcf\xa4\x48\x26\x20\xf4\x31\xd4\x85\xa3\x73\x71\xba\x76\x40\x6e\xd2\x63\x70\xbf\x73\x33\xe0\x28\xa1\xcd\x31\xc1\x83\x65\x8f\xda\x0f\x0d\x24\x21\xe7\xd3\x5f\x14\xf0\x9c\x9f\x6c\x12\x1b\xc1\x23\x59\xcb\x91\x96\x82\xb9\x1c\xe8\x72\x06\x8b\x53\x5a\x94\xab\x0c\xa3\x58\xfe\xd1\x92\xcb\xb0\x24\x9e\x22\x12\x54\xc2\x79\x3a\x48\x1d\x2b\x65\x53\xc6\x4e\xe6\x6d\xb4\x58\x14\xa0\x13\xdf\x71\x91\x5c\x71\x24\x3b\x65\x86\xae\xd4\x06\x55\x39\x05\xe5\x1d\xd5\xeb\x91\x58\x02\x0e\x13\x28\x0e\x07\x4b\x58\x09\xe5\x70\x76\x78\x0e\xfb\xfb\xc7\xd0\x2b\x3c\x34\x9d\xd0\x6b\xcc\xca\xe2\xa4\x9d\x7e\xdf\x85\x3a\x18\xdd\xa8\x12\xfe\x24\x1d\xd6\x79\x3b\x36\x5c\x4e\x27\xff\x1f\x65\x16\xcb\x7e\x8e\xad\x71\x8b\xb6\x88\x16\x29\xff\x88\xb4\x28\xd6\x9a\x91\x64\x69\x86\x81\xdc\x01\x25\xb7\x83\xc5\xad\x34\xa3\x2b\x85\xb2\x80\x7f\xd7\x4d\xcc\xec\x07\xb4\xc2\x53\xe2\x4b\x07\xe9\x39\xa7\x9e\x04\x99\x36\xe0\x88\x1e\x65\xc4\x80\xda\x73\xa3\x23\x14\x5c\xbd\xf1\x5c\x9e\x91\x99\x26\x37\x0d\xa2\x48\x97\x62\xa6\x45\x04\xa3\x4d\x58\xec\x85\x64\x8f\x35\x53\x15\xc5\x26\xca\x88\xb8\xe6\x9c\x85\xd0\xa0\x98\xf3\x48\xe5\x4f\xc1\xfb\x5f\x90\x1f\xf2\x44\x25\xab\x04\x7f\x1b\x85\x4a\x72\x6f\xcc\xa8\xb3\x19\x4e\x19\x12\xef\xb9\x4b\x42\x7b\x2c\x63\xfb\x4b\xf2\x16\x11\x75\x31\xa4\x5c\xa4\x8a\x8c\xdc\x40\x24\xad\x71\x17\x89\x6d\xd1\xba\x58\xe4\x05\x62\xd1\x71\x8c\x03\xd5\x85\x2c\x2a\x19\x73\x18\xa3\xda\x72\x3a\xeb\x2c\xd9\x60\x38\x0d\x2c\xe1\xfa\x0c\xe0\x21\x67\xbd\xbd\x5c\xdb\x90\x36\x9e\x48\x7a\x53\x7e\x95\x73\x4a\x72\x67\x61\x05\x49\xc8\xac\x56\x60\x56\xa1\x56\xb5\x51\xf6\xda\xb4\x78\x90\x9b\x8a\xdc\x02\x88\x4b\x8d\x9e\x65\xa9\x21\x79\x6c\x3f\x93\xb3\xa5\x34\x2d\x32\xfc\x2a\x79\x5a\xdc\xbb\x4c\xd4\x92\xfc\x52\xa6\xf6\xf3\x4c\x80\x93\x59\x15\xc5\x42\xb4\xe7\x80\xf5\xb8\x3e\xe7\xde\x4e\xf4\x09\xd7\x9c\x51\x85\x42\x31\xd2\x49\xc1\x49\x91\x33\xf6\x9d\xd0\xb1\xff\xe6\xb9\x52\x25\x60\xa6\x78\x13\x41\x99\x00\xf9\xf7\x61\xf4\x72\x96\x9b\xfd\x43\x68\x03\x32\xbd\x95\x07\x3b\x6a\xd6\x60\x3b\x5a\xfa\x2b\xeb\xca\x3d\x9d\xd5\xcd\x0f\xdc\x23\xf9\x29\xe9\xfa\x22\xca\x16\xd6\x18\xcc\x3d\x40\x39\xba\x86\x5c\x9c\x70\x66\x9a\x72\x87\x50\xb0\x05\x1f\x51\x35\x1d\x36\x1b\x57\xe5\xf2\xf7\x9e\x23\x94\xab\xca\x34\xe1\x9e\x27\x51\x5c\x89\xb3\x1f\xe1\xef\xf1\xa4\xf2\xc9\x74\x32\x19\xf6\xf3\x93\xca\xcf\xa4\x93\x29\x85\x8d\xea\x8f\x7a\x2e\x92\xee\x16\x46\xc7\xce\x0c\x94\xa8\x51\x81\x1b\x57\x2b\xf9\x21\x54\x8d\xd5\x9b\xeb\x28\x8e\x9b\xbb\xbe\x7a\x5e\x46\xfa\xf3\xe7\x13\xce\x67\xe5\x41\x29\x1c\x3e\x95\x70\xfe\x8e\x54\xb3\xcb\xf9\xdf\x73\xcf\x7e\xdb\xc7\xa3\x77\xd5\xe3\x79\xe2\x5d\x5f\xcd\xdc\x5c\x6c\xa1\x1c\x75\x7a\xc0\x21\xc7\xa2\x79\x93\x39\x46\x4a\xee\x15\x5e\xf2\xb9\xb0\x05\x4e\x9d\xce\xb3\x91\x86\x4e\x34\x34\x4a\x72\x57\xee\xbb\xd4\x59\x8e\x45\xaf\x88\x26\x98\x4c\x2c\x96\xbd\xd1\x8b\x45\x2b\x3f\x4f\xcb\x5f\x50\xae\xce\x0e\xf4\x37\xf5\x82\xa1\x25\x50\xf8\xc0\x70\xd2\xaa\x11\x4d\x17\x1b\xcc\x45\x97\x6d\xd4\x8f\x64\x73\x07\xfe\x71\x16\x4e\x67\x7a\xc8\xb6\x97\x5d\xd4\xa8\x5b\xb4\xa1\x46\x8d\xfd\x09\xb6\x9e\xd0\xe4\x49\xc8\xd5\x46\x5f\x6a\x5c\x87\x2b\x85\xb2\x2b\x9a\xdc\xab\x81\x9b\x18\x1a\xd9\x39\x1e\x56\xaa\x16\x9d\x17\x76\xea\x0e\xa6\x96\x2b\xc3\x26\x45\xc6\x1a\x3b\xb1\x95\xc6\xb2\x5a\x88\xfd\x9c\x5a\xbe\x5b\xa5\x54\x94\x9c\xeb\xa8\x33\xb6\xcb\x80\x18\xf7\x80\xc1\x28\xd9\x4c\xcd\xa2\x5a\xb8\x09\x2b\xa9\x3d\x7b\x90\xae\x3c\x1b\x28\x07\xe7\x38\x80\xca\x33\xc0\x32\x6d\xfa\x42\xc0\x44\x0e\x12\x64\x12\xbd\x74\xf8\x00\x98\x24\xf7\x09\x12\xc2\x7b\xec\x07\xee\x62\x93\xe6\xb3\x30\x8a\xb6\xd2\xe4\x30\xb8\xe7\xb9\x15\x6a\x11\x89\xe5\xc5\x4b\xb8\x8d\x3f\xa5\x29\x5c\x47\xe6\xe2\x63\xba\x63\x40\x25\x1e\x4d\xc0\x91\xc2\xa2\x48\x0d\xde\x9d\x90\x3e\xc5\x82\x78\x8a\xe4\xd2\xd9\x37\x06\x28\x04\x17\x29\x3d\x74\x07\xe5\x10\x00\xef\xc5\x1e\xfa\xce\x1d\xf2\xd1\x9b\xf6\xf4\x15\xc2\x8e\x4c\xa2\x13\xc3\x80\xa9\xf0\x8c\x1b\x11\xfd\xc8\x06\xb6\x99\x58\x95\x44\x50\x71\xb4\x9b\xb5\xe3\xb2\xb4\xf2\xb1\x69\xd7\xc0\x56\xb4\x4c\xfc\xe0\x33\xa9\xa4\xa9\x51\xfb\x58\xf3\xd3\x70\x49\x85\x8e\x97\x88\x18\x74\xa0\xcd\x04\xee\x64\xda\x99\x1c\xf7\x00\x32\x73\xc4\x7d\x4d\xa9\x72\xc7\x17\x93\xc7\x3c\xc6\x75\x4c\x7c\x19\xb7\xe2\xdf\x1e\x66\xf6\x8a\x43\x87\x3d\x5a\xa1\xee\x5b\xe9\x36\xd3\x25\xa5\x0e\x95\x90\x8b\x0e\x9b\xe2\x8f\x97\x4a\x7e\x24\xa7\x00\x79\x11\xd0\xa2\x5c\x3f\x39\x8f\xa2\x65\x0c\x42\x27\x6c\xcb\x83\x60\xf1\xb7\x51\xda\x78\x0b\xf3\x03\x3b\x6e\x17\x03\x95\x2f\xba\xf9\x33\xa7\x45\x72\x08\x38\xda\x1f\x11\x71\x29\xd3\x48\x77\x05\x99\x44\xe1\x0f\x17\xf0\x5d\xee\xb8\x84\x08\x25\x75\xe1\xf9\x42\x7c\x71\x5d\xbc\xbf\x0c\x91\x69\x7e\xa8\x97\xfa\x8d\xd3\xf2\x4c\xee\x23\x37\x6d\x3e\x7b\x99\xf3\xc5\xee\x63\xce\xc8\xa1\x17\x99\x8f\x16\xce\x84\x8b\x2d\xe7\x65\xb3\x61\xc7\xea\xed\x88\xe9\x82\xab\x2c\xdc\xca\x32\x6c\x76\x0b\x97\x09\xb1\x88\x07\x8b\x2b\x8a\x39\x26\x44\xf2\xe2\x4e\xa0\x2d\x73\x9f\x22\xbe\x73\x29\x14\xfb\xda\x05\xa1\x54\x30\xb0\x4f\x11\x5e\x4c\x99\xdf\xe8\x70\x35\xaa\x90\xc2\x17\xb9\x88\x27\x6d\xd1\xcc\x4c\xa7\xcc\x51\x06\x2a\xf7\x9c\x07\xd1\x58\xe3\xca\x82\x3c\x95\xfd\x8b\xbc\x2c\xca\x62\xc9\xa2\x48\xbf\xe6\xd1\x9f\x63\xd9\x9b\xf9\x0b\xad\xb8\xd8\x59\xc8\x58\x2d\x36\x68\xa5\xc5\xc6\x1b\xcb\x97\x21\xe2\x70\x9b\x93\x13\xbd\x29\x6b\x9e\x89\xb5\xb4\xe9\x23\xbc\xb1\x7d\x3b\xf9\xf1\x89\xee\x1e\x8d\x12\x8f\x3f\x7d\x4f\xdc\xb0\x41\xb4\xa7\xac\x3b\x64\x12\x7e\x47\x0e\xa7\xb0\xa7\x58\x31\x25\x8e\x98\xda\x12\xde\x5c\x5f\x9f\x70\x34\x62\xc5\xaf\x2e\xf6\xd9\xc5\xa0\x16\x35\x5b\x4e\xec\x7b\xb8\x70\x53\x3e\x70\xcf\x2c\xdf\xdc\x46\x08\xf1\x9d\x6a\x4a\x69\x52\x9c\x0f\x50\x49\x77\x59\x8e\x1f\x1b\xa0\x17\x8c\x8f\x17\x9a\xef\x21\x97\xaf\x60\xb8\x89\x85\x43\x93\xa5\xea\x21\x8c\xe4\x64\x71\xba\xc7\x3b\x48\x10\xe3\x6b\x01\x71\x20\xa2\x52\x42\x47\x24\xf8\x2a\x90\xe6\x2f\xa6\xeb\xfa\x87\xea\x2c\x29\x31\xa4\x89\x87\xcd\x61\x27\x2d\x57\xe1\x89\x08\xcf\x9a\xae\x45\xa2\x7c\xe3\xfb\x93\x63\xc7\x30\xa9\x59\xa6\xfb\x24\x77\xb9\x43\xe7\x6f\xaa\xe2\xd1\xc0\x62\xc6\x02\x31\x9a\x67\x65\xf6\x76\x28\xd7\x5d\xee\x0f\xa4\xcb\x43\xa9\x5b\x12\x2b\xd9\xa3\x0a\x29\xed\x04\xa7\xb4\xb0\xec\x2e\x51\x54\xed\x43\x03\x97\x5f\x0f\x61\x96\xf9\x02\xde\xf9\xf2\x85\x00\xdc\x5d\x53\x44\xe6\x48\x85\x7e\x31\xe7\x62\x09\x37\xd1\x06\xce\xd9\x0c\x4a\x3b\x70\x83\x45\xd1\x66\x2b\x08\x1d\xb0\xb9\x11\x48\xdd\x58\x4e\x36\xb9\x45\x1e\x52\x63\xf0\x46\xa1\x15\xba\xc1\xd0\x3c\x8a\x19\xa8\xb4\xa1\x11\x94\x4a\xe5\x7a\x9f\x02\x67\xa8\x04\x0f\xf4\xcf\x3e\xb0\x28\xad\x13\xac\x73\xe5\x16\xb8\x03\xb3\xcd\x52\xff\xdd\x26\x34\x3f\xe0\x2b\x18\x50\x60\xe0\xd8\x7c\xe2\xd9\x5e\xc3\x78\xbc\xb0\x6b\xf4\xee\x10\x9e\xa1\xa0\xce\x66\x34\xa0\xa5\x95\x62\x1d\x4a\xeb\x63\x3d\x51\x90\x43\xd1\x74\x91\xde\x09\xcb\x3b\x90\x5f\x98\xc7\xf6\x82\x82\xad\xea\x53\x21\xdb\xb8\x1f\x2c\xe1\xeb\x8c\x56\xae\xfe\x8f\x16\x47\x93\x3c\xbd\xf8\xab\x13\x8b\xe7\xbe\x3f\xbc\xbe\x48\x15\x21\x77\xd2\x1d\xe5\x91\x64\x9e\x5b\xd9\x8e\x42\xc1\xa8\x25\x77\x71\x77\xc6\x6e\x2e\xc0\x8d\x4d\x07\x82\x4a\xc6\x3f\x9a\x66\x13\xb3\x0a\x7e\xca\xe0\x85\xd4\x68\x2f\x60\x87\x75\x89\x7c\x7e\xe5\x51\x0b\xdf\x74\x30\x58\xd3\xa0\xa3\x04\xf3\xa5\x08\x2e\xd9\x7d\x85\xc2\x8f\x13\xd8\x03\xf4\x72\xea\x55\x59\x6c\xa5\xab\x0e\x4a\xbf\x2a\x3c\x94\x79\x3c\xc8\xf3\xda\xf8\x9a\xe6\xa0\x51\x13\x81\x38\x95\x2c\xb1\x60\x64\x16\x52\xd5\x15\x56\x2e\xa1\x6a\x59\x17\x87\x95\x57\xa8\xf0\x1f\x79\x00\x32\x3d\xe2\x99\x1e\x5e\xe5\x57\x5c\x0e\x06\xe1\x5c\x51\x7c\x85\x94\x47\xed\xd3\xb5\x41\x62\xda\xc0\xbc\x26\x4a\xb7\x8a\x5e\x48\xc5\xa6\x32\xa3\xef\xa6\x92\xd2\x4e\xcf\x22\x39\xbb\x20\xdb\x09\x44\x2f\xc0\x99\xf2\x6d\x55\x9e\x16\x86\x27\x96\x66\x1a\x5e\x9d\xc0\x50\x92\x53\xe0\x21\x2b\x07\x40\xf6\x62\xcd\x9e\x81\xd5\xf6\xf6\xcd\xe2\x36\x8b\x0e\x60\x30\xd6\xdf\xf7\x62\x28\xe6\x03\xb4\x35\xd9\xe2\x9b\x6f\xbe\xcd\xbf\x3d\x9c\xa5\xbf\xe7\x42\xa7\xda\x79\x25\x1a\xff\x54\xc1\xd6\x9a\x9d\x56\x46\xb4\x7c\x35\x1a\xe7\x87\x5e\xaa\x28\x6a\xd4\xde\x90\x07\x0c\xaf\xae\x06\x2b\xcd\x24\xee\x50\xa2\x61\xf9\xb8\x2f\x3e\xea\x23\xc3\x6c\x8c\xde\xa2\xa6\x72\x6e\xca\x47\x73\x1b\x9b\xe4\x94\xb6\x27\x32\xf3\x87\x77\x2b\xa9\x42\xb6\x46\xbe\x12\x34\x62\x1b\xdc\x61\x44\xdf\x94\xb1\xf3\xc6\xef\xb8\x6d\x3c\x18\xe7\x64\xad\x38\xc3\x4e\xa5\xa1\x3f\x29\x89\x7e\x54\x5e\x52\xd2\x11\xea\xf7\x02\xdd\x59\x20\x79\x4a\x5a\x3c\xe5\xfb\x79\xf2\xef\xc8\x19\x0f\x38\x38\x72\x19\xcf\x72\x1a\xe5\xde\x2f\x74\x1c\x89\x91\xc9\x79\x94\x44\x33\x04\x3e\x15\xfb\x44\xc5\x2f\xa1\xa2\xfd\xde\x5e\x5d\xad\x8c\x59\x34\xa6\x9f\x68\x79\x61\x17\xeb\x8f\x55\xb1\x26\x3c\x9a\x74\x33\x3a\x00\xe1\x02\x61\xec\x89\x56\xdf\xde\xbd\x6d\xbe\x12\xe2\x1f\xef\xde\x88\xf6\xf6\xf6\xe6\xee\xab\xdb\xaf\xb1\xfe\xa6\xfd\xe6\x5a\xdc\xde\x7c\x7b\x7b\x8b\xdf\x7c\xfb\x55\x49\xf1\x21\xff\x3b\x25\x4b\x19\xe8\xca\xac\xdd\x09\x90\x93\x38\xcb\x56\x32\x29\xa3\x33\xbb\xf0\xd8\x58\x99\x75\xc4\x58\x59\x47\x96\xcf\x7c\xb8\x52\xe1\x7e\x81\x71\x48\xf3\x5d\x5c\x40\x28\x24\xb7\xa2\x17\xf0\x6f\x66\xbd\x26\xec\xf2\x8b\x30\x2a\x55\x5a\xa8\xf7\x13\x96\x42\x2a\x78\x01\xf5\x18\x5f\x1d\xce\x38\x8d\x69\x1d\xd9\x01\x85\x78\x7b\xb9\xb6\x14\xb8\xda\xfc\x9c\xcd\x94\x4e\x86\xdf\xe1\x9a\x35\x58\xe3\x27\x9c\x51\x09\x4b\x0e\x64\x66\x3b\x5f\x82\xd3\x92\xc1\x57\xc3\x28\x31\x71\x1a\x9f\xac\x85\x12\x53\xbd\xf8\x70\x1f\xb4\x02\xfc\x02\xf1\xe6\xfa\xc4\xe0\x7d\x2c\x3a\x6f\xee\x4a\x0c\xcd\x20\x94\x1b\x45\xc5\x45\x86\x6b\xac\xac\xf3\x83\xed\xa2\xb9\x14\x9b\x83\xe4\x94\x66\xbe\x23\x3e\xe1\x5e\xc0\x7f\xa6\x27\xaa\x07\x3d\xa9\x46\x8d\x2d\x42\x8f\xbd\xb1\xfb\x0b\xd0\xe8\x43\x26\xd3\x0c\x63\x78\x70\x4a\x3a\x5a\x14\x8c\x31\xac\x1c\x37\xc6\x73\x90\xe6\xd2\x28\x3d\x16\x27\xb9\x43\x2f\x9a\x8e\xf4\x11\x2e\x3f\x43\xfa\x43\x0b\xcd\xb8\xee\xca\x46\x63\x60\xa9\x11\x83\x68\xa8\x58\xf9\x02\x94\x1c\x49\xeb\xd5\xa0\x92\x39\x39\x85\x97\xa9\xfb\x37\x05\xd0\x66\x18\x03\x52\xee\xae\xaf\xe1\x9c\xff\xfc\xe9\xc7\x8f\x79\x38\xe8\x06\x96\x70\x7b\xf7\x35\x9c\xd3\x9f\x3f\x7d\x3f\x05\xe4\xa8\xb1\x59\x3c\xee\x6b\xc9\xbd\xf0\x8c\x3c\x88\x91\x1b\xaa\xb6\xae\xe0\xd3\xc3\x89\x38\x3d\x83\x5e\x7a\x41\xfd\x44\x94\xb6\xb8\x96\xce\xa7\x8b\x99\xd0\x02\x8f\x57\x6c\xb4\x34\xd3\x4b\xbd\xfb\xf0\x33\xb4\xd2\x35\xe4\x43\xf6\x80\x7a\xcd\x8f\x8b\x72\x52\xd5\x8c\xd6\xa2\xa6\x34\xea\x07\xa3\xdd\xa8\x62\xec\xce\x8f\xd0\x38\x54\x8b\x0d\xce\xe8\x89\xb6\xb5\xe8\x1c\xbf\xe2\x09\x2d\xf8\xc0\x21\x55\xc4\xf1\x16\x4e\xfa\x80\xc9\xce\x38\x3f\xf3\xac\x24\x91\x2f\x81\xdc\x81\x94\x5e\x0d\x70\x91\x8f\x53\x70\x4b\x62\x9a\xd0\xc1\x65\x62\x4a\xee\x2e\xc3\x2d\x5e\x1e\xf4\x62\x1d\xbe\x74\x88\xdf\x65\x5c\xa4\x7b\xbe\xbf\xce\x12\x40\x4e\xaa\xeb\x22\x2b\x0c\xd7\xf1\x25\x04\x79\x9b\x80\xea\x4a\x28\xb9\x2d\x36\x89\x0f\xf5\xe3\xa0\x6f\x86\x72\xa8\xbc\xb6\xe1\x0b\xed\x62\x95\xec\xd1\x8c\x9e\x57\xdd\x16\x23\x8f\xe5\x9a\x1e\xfb\x41\x95\xcf\x9f\x4f\xa0\xb8\x17\x9a\x62\x95\x80\x34\x39\xd7\x70\x53\xfe\x71\x22\x0b\xa4\x24\x90\x5c\xf1\x90\xbe\xd0\x48\xcb\xc3\xd7\x5b\xf1\xeb\x0c\xb5\x87\x61\x54\x6a\xde\xce\xe5\x44\x36\x00\x9c\xa8\xfc\x37\xdf\x0c\x7a\x03\x83\x19\x46\xa6\x60\x47\xcd\x37\xfa\xf3\x5d\xa7\xe6\xe0\xcb\xb0\x7a\x28\x8c\x57\x03\x6b\x62\xe4\x74\x30\xcd\x72\x2c\x03\x2a\xa7\xdb\xf9\xbf\x25\x54\x97\x97\x97\xbf\xea\x0d\xee\xdf\xc2\xa7\x4f\xb0\xc1\x3d\xfc\x9a\x6c\xf1\xaa\xdf\x5f\x6e\x70\xff\x6b\x05\x0f\x0f\x65\xa6\xd6\xa2\xf3\x52\x87\xc3\x84\xaf\x02\x4c\x23\xd4\x15\x7f\x43\xb7\xef\x55\x39\x35\x3c\xbd\xbb\xe7\x0b\x28\x9e\xea\xe4\x5a\x8b\x53\x53\xc2\x00\x4d\xf9\xf9\xdd\x3f\xff\xf8\x5f\xff\x51\x3d\x1a\xca\x8f\xa0\xd8\xf0\xb3\x4f\x67\xca\xae\x4a\x7c\xaa\x87\x7a\x2b\xad\xd1\xdc\x5d\x4c\x1f\x79\x4c\x68\x3c\xb8\x2f\x48\x17\x15\x9c\x0f\x86\xaf\x0e\xa8\x98\xe3\xf4\x23\x54\x9b\x53\x80\xae\xf1\xc4\xbd\x21\xb7\x11\x59\xc0\x04\x55\x6c\x4f\xe3\x33\x3e\x47\x3c\x06\xe0\x67\xf5\xb5\x84\xea\x5f\xff\xe9\x7f\x96\x2f\xd1\xd3\x5c\x4b\xa8\xb7\xe5\x44\xd4\xdb\x02\x11\xe5\x3d\xc2\x91\xf0\xb7\x74\x84\xe7\xe4\xe2\xde\x80\x68\x38\x39\x22\x87\x60\x36\xa8\x59\x1a\x85\x27\xf8\x51\xb8\x4e\xfe\x60\xec\x10\xe5\x42\xa7\x41\x1b\x04\x1d\x48\x85\x5f\xa6\xcf\xc9\xf2\x3b\x82\x76\x16\x7a\xc4\xe8\x3b\x63\xe5\xc7\xf4\xad\x48\xdf\x8f\x3a\x74\x7c\xf9\x73\x07\xa6\xbe\x80\xef\xf7\x53\xbe\x1e\xc8\xb3\x22\xa5\x26\x1b\x9b\x1d\x32\x70\x2b\x75\xf1\x5e\x74\x2b\x05\xdf\x79\x9e\x80\x53\x48\xec\x52\x28\xe5\xb5\x13\x67\x5b\x21\x95\x88\x15\xeb\x49\xd7\x51\x1e\x37\x4a\xae\x13\xba\x55\x39\x2d\xd5\xb8\x13\x53\xc8\xa6\xbd\x2c\x6e\x4d\xf1\x81\x67\x87\xd9\xef\x6d\xf0\x8b\x6a\x83\x99\x6e\x5f\xcd\xa7\x31\x17\xa7\x1d\x1a\x0f\xcd\xac\x83\x5f\x7f\xc8\x58\x1d\x70\xb0\x6d\x5a\x4d\x91\x76\x65\x8d\xf6\xa8\xdb\x1c\x6c\xff\x1f\xbc\xd1\x0f\xb3\x2f\x14\x63\x40\x4d\x37\x64\x81\x82\x0a\x1d\x78\xf6\x1b\xe9\xe3\xe1\x1a\x61\x23\xc9\x3d\xcc\xb4\x4a\x3f\xcd\x9b\x2d\xef\xf2\xcd\x42\xf1\xec\x25\xbe\x73\x99\x8a\x08\x5a\x77\x9f\x36\xa7\x60\x9e\xe2\xfc\x03\xbf\xe2\x7a\x38\xfb\xbf\x00\x00\x00\xff\xff\x88\x5e\xfc\xc0\x0b\x3d\x00\x00") -func commandAssetsExampleNomadBytes() ([]byte, error) { - return bindataRead( - _commandAssetsExampleNomad, +func command_assets_example_nomad() ([]byte, error) { + return bindata_read( + _command_assets_example_nomad, "command/assets/example.nomad", ) } -func commandAssetsExampleNomad() (*asset, error) { - bytes, err := commandAssetsExampleNomadBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "command/assets/example.nomad", size: 15629, mode: os.FileMode(420), modTime: time.Unix(1566490218, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - // Asset loads and returns the asset for the given name. // It returns an error if the asset could not be found or // could not be loaded. func Asset(name string) ([]byte, error) { cannonicalName := strings.Replace(name, "\\", "/", -1) if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) - } - return a.bytes, nil + return f() } return nil, fmt.Errorf("Asset %s not found", name) } -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %s not found", name) -} - // AssetNames returns the names of the assets. func AssetNames() []string { names := make([]string, 0, len(_bindata)) @@ -203,13 +82,12 @@ func AssetNames() []string { } // _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() (*asset, error){ - "command/assets/connect-short.nomad": commandAssetsConnectShortNomad, - "command/assets/connect.nomad": commandAssetsConnectNomad, - "command/assets/example-short.nomad": commandAssetsExampleShortNomad, - "command/assets/example.nomad": commandAssetsExampleNomad, +var _bindata = map[string]func() ([]byte, error){ + "command/assets/connect-short.nomad": command_assets_connect_short_nomad, + "command/assets/connect.nomad": command_assets_connect_nomad, + "command/assets/example-short.nomad": command_assets_example_short_nomad, + "command/assets/example.nomad": command_assets_example_nomad, } - // AssetDir returns the file names below a certain // directory embedded in the file by go-bindata. // For example if you run go-bindata on data/... and data contains the @@ -239,81 +117,27 @@ func AssetDir(name string) ([]string, error) { return nil, fmt.Errorf("Asset %s not found", name) } rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) + for name := range node.Children { + rv = append(rv, name) } return rv, nil } -type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} -var _bintree = &bintree{nil, map[string]*bintree{ - "command": &bintree{nil, map[string]*bintree{ - "assets": &bintree{nil, map[string]*bintree{ - "connect-short.nomad": &bintree{commandAssetsConnectShortNomad, map[string]*bintree{}}, - "connect.nomad": &bintree{commandAssetsConnectNomad, map[string]*bintree{}}, - "example-short.nomad": &bintree{commandAssetsExampleShortNomad, map[string]*bintree{}}, - "example.nomad": &bintree{commandAssetsExampleNomad, map[string]*bintree{}}, +type _bintree_t struct { + Func func() ([]byte, error) + Children map[string]*_bintree_t +} +var _bintree = &_bintree_t{nil, map[string]*_bintree_t{ + "command": &_bintree_t{nil, map[string]*_bintree_t{ + "assets": &_bintree_t{nil, map[string]*_bintree_t{ + "connect-short.nomad": &_bintree_t{command_assets_connect_short_nomad, map[string]*_bintree_t{ + }}, + "connect.nomad": &_bintree_t{command_assets_connect_nomad, map[string]*_bintree_t{ + }}, + "example-short.nomad": &_bintree_t{command_assets_example_short_nomad, map[string]*_bintree_t{ + }}, + "example.nomad": &_bintree_t{command_assets_example_nomad, map[string]*_bintree_t{ + }}, }}, }}, }} - -// RestoreAsset restores an asset under the given directory -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil -} - -// RestoreAssets restores an asset under the given directory recursively -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) -} - - -func assetFS() *assetfs.AssetFS { - assetInfo := func(path string) (os.FileInfo, error) { - return os.Stat(path) - } - for k := range _bintree.Children { - return &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: assetInfo, Prefix: k} - } - panic("unreachable") -} diff --git a/go.mod b/go.mod new file mode 100644 index 000000000000..714f66cea9e6 --- /dev/null +++ b/go.mod @@ -0,0 +1,148 @@ +module github.com/hashicorp/nomad + +go 1.14 + +replace ( + github.com/Microsoft/go-winio => github.com/endocrimes/go-winio v0.4.13-0.20190628114223-fb47a8b41948 + github.com/NYTimes/gziphandler => github.com/NYTimes/gziphandler v1.0.0 + github.com/apparentlymart/go-textseg/v12 => github.com/apparentlymart/go-textseg/v12 v12.0.0 + github.com/godbus/dbus => github.com/godbus/dbus v5.0.1+incompatible + github.com/hashicorp/nomad/api => ./api + github.com/kr/pty => github.com/kr/pty v1.1.5 +) + +require ( + cloud.google.com/go/storage v1.0.0 // indirect + contrib.go.opencensus.io/exporter/ocagent v0.4.12 // indirect + github.com/Azure/azure-sdk-for-go v29.0.0+incompatible // indirect + github.com/Azure/go-autorest v11.7.1+incompatible // indirect + github.com/LK4D4/joincontext v0.0.0-20171026170139-1724345da6d5 + github.com/Microsoft/go-winio v0.4.15-0.20200113171025-3fe6c5262873 + github.com/Microsoft/hcsshim v0.8.8-0.20200312192636-fd0797d766b1 // indirect + github.com/NVIDIA/gpu-monitoring-tools v0.0.0-20180829222009-86f2a9fac6c5 + github.com/NYTimes/gziphandler v1.0.1 + github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e + github.com/armon/go-metrics v0.3.3 + github.com/aws/aws-sdk-go v1.25.41 + github.com/boltdb/bolt v1.3.1 + github.com/checkpoint-restore/go-criu v0.0.0-20190109184317-bdb7599cd87b // indirect + github.com/container-storage-interface/spec v1.2.0-rc1.0.20191021210849-a33ece0a8a9f + github.com/containerd/console v1.0.0 // indirect + github.com/containerd/go-cni v0.0.0-20190904155053-d20b7eebc7ee + github.com/containernetworking/cni v0.7.2-0.20190612152420-dc953e2fd91f // indirect + github.com/containernetworking/plugins v0.7.3-0.20190501191748-2d6d46d308b2 + github.com/coreos/go-iptables v0.4.3-0.20190724151750-969b135e941d + github.com/coreos/go-semver v0.3.0 + github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect + github.com/cyphar/filepath-securejoin v0.2.3-0.20190205144030-7efe413b52e1 // indirect + github.com/docker/cli v0.0.0-20200303215952-eb310fca4956 + github.com/docker/distribution v2.7.1+incompatible + github.com/docker/docker v17.12.0-ce-rc1.0.20200330121334-7f8b4b621b5d+incompatible + github.com/docker/docker-credential-helpers v0.6.2-0.20180719074751-73e5f5dbfea3 // indirect + github.com/docker/go-units v0.4.0 + github.com/dustin/go-humanize v1.0.0 + github.com/elazarl/go-bindata-assetfs v1.0.1-0.20200509193318-234c15e7648f + github.com/fatih/color v1.9.0 + github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/fsouza/go-dockerclient v1.6.5 + github.com/golang/protobuf v1.3.4 + github.com/golang/snappy v0.0.1 + github.com/google/go-cmp v0.4.0 + github.com/gorilla/websocket v1.4.2 + github.com/grpc-ecosystem/go-grpc-middleware v1.2.1-0.20200228141219-3ce3d519df39 + github.com/grpc-ecosystem/grpc-gateway v1.9.0 // indirect + github.com/hashicorp/consul v1.7.1-0.20200213195527-b137060630b4 + github.com/hashicorp/consul-template v0.24.1 + github.com/hashicorp/consul/api v1.4.0 + github.com/hashicorp/consul/sdk v0.4.0 + github.com/hashicorp/cronexpr v1.1.0 + github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de + github.com/hashicorp/go-cleanhttp v0.5.1 + github.com/hashicorp/go-connlimit v0.2.0 + github.com/hashicorp/go-discover v0.0.0-20200108194735-7698de1390a1 + github.com/hashicorp/go-envparse v0.0.0-20180119215841-310ca1881b22 + github.com/hashicorp/go-getter v1.3.1-0.20190822194507-f5101da01173 + github.com/hashicorp/go-hclog v0.12.0 + github.com/hashicorp/go-immutable-radix v1.2.0 + github.com/hashicorp/go-memdb v1.2.1 + github.com/hashicorp/go-msgpack v1.1.5 + github.com/hashicorp/go-multierror v1.0.1-0.20191120192120-72917a1559e1 + github.com/hashicorp/go-plugin v1.0.2-0.20191004171845-809113480b55 + github.com/hashicorp/go-sockaddr v1.0.2 + github.com/hashicorp/go-syslog v1.0.0 + github.com/hashicorp/go-uuid v1.0.1 + github.com/hashicorp/go-version v1.2.1-0.20191009193637-2046c9d0f0b0 + github.com/hashicorp/golang-lru v0.5.4 + github.com/hashicorp/hcl v1.0.1-0.20191016231534-914dc3f8dd7c + github.com/hashicorp/hcl/v2 v2.5.1 + github.com/hashicorp/logutils v1.0.0 + github.com/hashicorp/memberlist v0.1.6 + github.com/hashicorp/net-rpc-msgpackrpc v0.0.0-20151116020338-a14192a58a69 + github.com/hashicorp/nomad/api v0.0.0-20200529203653-c4416b26d3eb + github.com/hashicorp/raft v1.1.3-0.20200211192230-365023de17e6 + github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea + github.com/hashicorp/serf v0.8.5 + github.com/hashicorp/vault/api v1.0.5-0.20190730042357-746c0b111519 + github.com/hashicorp/vault/sdk v0.1.14-0.20190730042320-0dc007d98cc8 + github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d + github.com/hpcloud/tail v1.0.1-0.20170814160653-37f427138745 + github.com/joyent/triton-go v0.0.0-20190112182421-51ffac552869 // indirect + github.com/kr/pretty v0.2.0 + github.com/kr/pty v1.1.5 + github.com/kr/text v0.2.0 + github.com/mattn/go-colorable v0.1.6 + github.com/mitchellh/cli v1.0.0 + github.com/mitchellh/colorstring v0.0.0-20150917214807-8631ce90f286 + github.com/mitchellh/copystructure v1.0.0 + github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b + github.com/mitchellh/go-testing-interface v1.0.0 + github.com/mitchellh/hashstructure v1.0.0 + github.com/mitchellh/mapstructure v1.3.1 + github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618 // indirect + github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect + github.com/oklog/run v1.0.1-0.20180308005104-6934b124db28 // indirect + github.com/onsi/ginkgo v1.12.0 + github.com/onsi/gomega v1.9.0 + github.com/opencontainers/runc v1.0.0-rc7 + github.com/opencontainers/runtime-spec v1.0.2-0.20200307132014-f49fed0d6290 // indirect + github.com/opencontainers/selinux v1.4.1-0.20200311111634-a2f0d9c2aafc // indirect + github.com/pkg/errors v0.9.1 + github.com/posener/complete v1.2.1 + github.com/prometheus/client_golang v1.4.0 + github.com/prometheus/common v0.9.1 + github.com/rs/cors v0.0.0-20170801073201-eabcc6af4bbe + github.com/ryanuber/columnize v2.1.1-0.20170703205827-abc90934186a+incompatible + github.com/ryanuber/go-glob v1.0.0 + github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 + github.com/seccomp/libseccomp-golang v0.9.2-0.20200314001724-bdab42bd5128 // indirect + github.com/shirou/gopsutil v2.20.2+incompatible + github.com/sirupsen/logrus v1.6.0 // indirect + github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c + github.com/stretchr/objx v0.2.0 // indirect + github.com/stretchr/testify v1.5.1 + github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8 + github.com/vishvananda/netlink v1.1.0 // indirect + github.com/zclconf/go-cty v1.4.1 + go.opencensus.io v0.22.1-0.20190713072201-b4a14686f0a9 // indirect + golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 + golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136 // indirect + golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f // indirect + golang.org/x/mod v0.3.0 // indirect + golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e + golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect + golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a + golang.org/x/sys v0.0.0-20200523222454-059865788121 + golang.org/x/text v0.3.3-0.20200306154105-06d492aade88 // indirect + golang.org/x/time v0.0.0-20191024005414-555d28b269f0 + golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375 // indirect + google.golang.org/api v0.13.0 // indirect + google.golang.org/genproto v0.0.0-20200302123026-7795fca6ccb1 // indirect + google.golang.org/grpc v1.27.1 + gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect + gopkg.in/square/go-jose.v2 v2.4.1 // indirect + gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 + gopkg.in/tomb.v2 v2.0.0-20140626144623-14b3d72120e8 + gopkg.in/yaml.v2 v2.3.0 // indirect + gotest.tools/v3 v3.0.2 // indirect + honnef.co/go/tools v0.0.1-2020.1.4 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 000000000000..bdd9861eaa1a --- /dev/null +++ b/go.sum @@ -0,0 +1,1028 @@ +bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.31.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.36.0/go.mod h1:RUoy9p/M4ge0HzT8L+SDZ8jg+Q6fth0CiBuhFJpSV40= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3 h1:AVXDdKsrtX33oR9fbCMu/+c1o8Ofjq6Ku/MInaLVg5Y= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1 h1:hL+ycaJpVE9M7nLoiXb/Pn10ENE2u+oddxbD8uu0ZVU= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0 h1:Kt+gOPPp2LEPWp8CSfxhsM8ik9CcyE/gYu+0r+RnZvM= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/pubsub v1.0.1 h1:W9tAK3E57P75u0XLLR82LZyw8VpAnhmyTOxW9qzmyj8= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/storage v1.0.0 h1:VV2nUM3wwLLGh9lSABFgZMjInyUbJeaRSE64WuAIQ+4= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +contrib.go.opencensus.io/exporter/ocagent v0.4.12 h1:jGFvw3l57ViIVEPKKEUXPcLYIXJmQxLUh6ey1eJhwyc= +contrib.go.opencensus.io/exporter/ocagent v0.4.12/go.mod h1:450APlNTSR6FrvC3CTRqYosuDstRB9un7SOx2k/9ckA= +dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU= +dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= +dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= +git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= +github.com/Azure/azure-sdk-for-go v16.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go v29.0.0+incompatible h1:CYPU39ULbGjQBo3gXIqiWouK0C4F+Pt2Zx5CqGvqknE= +github.com/Azure/azure-sdk-for-go v29.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8= +github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= +github.com/Azure/go-autorest v10.7.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-autorest v10.15.3+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/Azure/go-autorest v11.7.1+incompatible h1:M2YZIajBBVekV86x0rr1443Lc1F/Ylxb9w+5EtSyX3Q= +github.com/Azure/go-autorest v11.7.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= +github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= +github.com/LK4D4/joincontext v0.0.0-20171026170139-1724345da6d5 h1:U7q69tqXiCf6m097GRlNQB0/6SI1qWIOHYHhCEvDxF4= +github.com/LK4D4/joincontext v0.0.0-20171026170139-1724345da6d5/go.mod h1:nxQPcNPR/34g+HcK2hEsF99O+GJgIkW/OmPl8wtzhmk= +github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= +github.com/Microsoft/hcsshim v0.8.8-0.20200312192636-fd0797d766b1 h1:2T9t72RkTRjAcuFc+4vaGWnRx/anVngE1/VGN/HFEVk= +github.com/Microsoft/hcsshim v0.8.8-0.20200312192636-fd0797d766b1/go.mod h1:LVvUcNYEzt59fFVTuiPEgM6dgF70yMGdy/Qc/UmCbuU= +github.com/NVIDIA/gpu-monitoring-tools v0.0.0-20180829222009-86f2a9fac6c5 h1:WLyvLAM0QfjAarRzRTG9EgT5McqGWNZMvqqSUSoyUUY= +github.com/NVIDIA/gpu-monitoring-tools v0.0.0-20180829222009-86f2a9fac6c5/go.mod h1:nMOvShGpWaf0bXwXmeu4k+O4uziuaEI8pWzIj3BUrOA= +github.com/NYTimes/gziphandler v1.0.0 h1:OswZCvpiFsNRCbeapdJxDuikAqVXTgV7XAht8S9olZo= +github.com/NYTimes/gziphandler v1.0.0/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= +github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af h1:DBNMBMuMiWYu0b+8KMJuWmfCkcxl09JwdlqwDZZ6U14= +github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= +github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8= +github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= +github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3 h1:ZSTrOEhiM5J5RFxEaFvMZVEAM1KvT1YzbEOwB2EAGjA= +github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= +github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= +github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= +github.com/apparentlymart/go-textseg/v12 v12.0.0 h1:bNEQyAGak9tojivJNkoqWErVCQbjdL7GzRt3F8NvfJ0= +github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e h1:QEF07wC0T1rKkctt1RINW/+RMTVmiwxETico2l3gxJA= +github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= +github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQhVx52RsWOnlkpikZr01T/yAVN2gn0861vByNg= +github.com/armon/go-metrics v0.3.3 h1:a9F4rlj7EWWrbj7BYw8J8+x+ZZkJeqzNyRk8hdPF+ro= +github.com/armon/go-metrics v0.3.3/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= +github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= +github.com/aws/aws-sdk-go v1.25.41 h1:/hj7nZ0586wFqpwjNpzWiUTwtaMgxAZNZKHay80MdXw= +github.com/aws/aws-sdk-go v1.25.41/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= +github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= +github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= +github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= +github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4= +github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= +github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= +github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= +github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= +github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= +github.com/bugsnag/panicwrap v0.0.0-20151223152923-e2c28503fcd0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= +github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/census-instrumentation/opencensus-proto v0.2.1 h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/checkpoint-restore/go-criu v0.0.0-20190109184317-bdb7599cd87b h1:T4nWG1TXIxeor8mAu5bFguPJgSIGhZqv/f0z55KCrJM= +github.com/checkpoint-restore/go-criu v0.0.0-20190109184317-bdb7599cd87b/go.mod h1:TrMrLQfeENAPYPRsJuq3jsqdlRh3lvi6trTZJG8+tho= +github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible h1:C29Ae4G5GtYyYMm1aztcyj/J5ckgJm2zwdDajFbx1NY= +github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= +github.com/circonus-labs/circonusllhist v0.1.3 h1:TJH+oke8D16535+jHExHj4nQvzlZrj7ug5D7I/orNUA= +github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/container-storage-interface/spec v1.2.0-rc1.0.20191021210849-a33ece0a8a9f h1:m2LYF3fo9IPapVt5FGRVw5bJPmlWqWIezB0jkQh03Zo= +github.com/container-storage-interface/spec v1.2.0-rc1.0.20191021210849-a33ece0a8a9f/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4= +github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= +github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= +github.com/containerd/console v1.0.0 h1:fU3UuQapBs+zLJu82NhR11Rif1ny2zfMMAyPJzSN5tQ= +github.com/containerd/console v1.0.0/go.mod h1:8Pf4gM6VEbTNRIT26AyyU7hxdQU3MvAvxVI0sc00XBE= +github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.3.2 h1:ForxmXkA6tPIvffbrDAcPUIB32QgXkt2XFj+F0UxetA= +github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= +github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c h1:8ahmSVELW1wghbjerVAyuEYD5+Dio66RYvSS0iGfL1M= +github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c/go.mod h1:Dq467ZllaHgAtVp4p1xUQWBrFXR9s/wyoTpG8zOJGkY= +github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= +github.com/containerd/go-cni v0.0.0-20190904155053-d20b7eebc7ee h1:fV37ZKnYs79fSyI3mu/XZFJVezrVsXBLbfojcTPpdXM= +github.com/containerd/go-cni v0.0.0-20190904155053-d20b7eebc7ee/go.mod h1:2wlRxCQdiBY+OcjNg5x8kI+5mEL1fGt25L4IzQHYJsM= +github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= +github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= +github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= +github.com/containernetworking/cni v0.7.2-0.20190612152420-dc953e2fd91f h1:zLuuwrIjPmE9XxixRYl8KBiGUNaN5DpxLZJ39f3BFio= +github.com/containernetworking/cni v0.7.2-0.20190612152420-dc953e2fd91f/go.mod h1:LGwApLUm2FpoOfxTDEeq8T9ipbpZ61X79hmU3w8FmsY= +github.com/containernetworking/plugins v0.7.3-0.20190501191748-2d6d46d308b2 h1:WT1OeJOkmYxVP5/e3P+/MVJ1ftii14o80u0N9aK2tCg= +github.com/containernetworking/plugins v0.7.3-0.20190501191748-2d6d46d308b2/go.mod h1:dagHaAhNjXjT9QYOklkKJDGaQPTg4pf//FrUcJeb7FU= +github.com/coredns/coredns v1.1.2/go.mod h1:zASH/MVDgR6XZTbxvOnsZfffS+31vg6Ackf/wo1+AM0= +github.com/coreos/go-iptables v0.4.3-0.20190724151750-969b135e941d h1:9n0vuQxZw5yuleXDNqGLSw3o5s6vZJJH36ZSU7626zw= +github.com/coreos/go-iptables v0.4.3-0.20190724151750-969b135e941d/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= +github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= +github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f h1:JOrtw2xFKzlg+cbHpyrpLDmnN1HqhBfnX7WDiW7eG2c= +github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cyphar/filepath-securejoin v0.2.3-0.20190205144030-7efe413b52e1 h1:dCqRswe3ZAwkQWdvFLwRqmJCpGP3DWb7bFogdqY3+QU= +github.com/cyphar/filepath-securejoin v0.2.3-0.20190205144030-7efe413b52e1/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/denverdino/aliyungo v0.0.0-20170926055100-d3308649c661/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= +github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba h1:p6poVbjHDkKa+wtC8frBMwQtT3BmqGYBjzMwJ63tuR4= +github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= +github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/digitalocean/godo v1.1.1/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU= +github.com/digitalocean/godo v1.10.0 h1:uW1/FcvZE/hoixnJcnlmIUvTVNdZCLjRLzmDtRi1xXY= +github.com/digitalocean/godo v1.10.0/go.mod h1:h6faOIcZ8lWIwNQ+DN7b3CgX4Kwby5T+nbpNqkUIozU= +github.com/dimchansky/utfbom v1.1.0 h1:FcM3g+nofKgUteL8dm/UpdRXNC9KmADgTpLKsu0TRo4= +github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8= +github.com/dnaeon/go-vcr v1.0.1 h1:r8L/HqC0Hje5AXMu1ooW8oyQyOFv4GxqpL0nRP7SLLY= +github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= +github.com/docker/cli v0.0.0-20200303215952-eb310fca4956 h1:5/ZRsUbguX7xFNLlbxVQY/yhD3Psy+vylKZrNme5BJs= +github.com/docker/cli v0.0.0-20200303215952-eb310fca4956/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY= +github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= +github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v1.4.2-0.20191101170500-ac7306503d23/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v17.12.0-ce-rc1.0.20200330121334-7f8b4b621b5d+incompatible h1:x+LFTD06kE2vF3WSFCG3D4XdqE2FD61524u/cXQLgws= +github.com/docker/docker v17.12.0-ce-rc1.0.20200330121334-7f8b4b621b5d+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker-credential-helpers v0.6.2-0.20180719074751-73e5f5dbfea3 h1:LDAx5G+S5Ae1EWeSEXG9kQ3S/EUsWBgZhfS7JWASa3o= +github.com/docker/docker-credential-helpers v0.6.2-0.20180719074751-73e5f5dbfea3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y= +github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= +github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916 h1:yWHOI+vFjEsAakUTSrtqc/SAHrhSkmn48pqjidZX3QA= +github.com/docker/go-metrics v0.0.0-20180209012529-399ea8c73916/go.mod h1:/u0gXw0Gay3ceNrsHubL3BtdOL2fHf93USgMTe0W5dI= +github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= +github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1 h1:ZClxb8laGDf5arXfYcAtECDFgAgHklGI8CxgjHnXKJ4= +github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE= +github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= +github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/elazarl/go-bindata-assetfs v0.0.0-20160803192304-e1a2a7ec64b0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= +github.com/elazarl/go-bindata-assetfs v1.0.1-0.20200509193318-234c15e7648f h1:AwZUiMWfYSmIiHdFJIubTSs8BFIFoMmUFbeuwBzHIPs= +github.com/elazarl/go-bindata-assetfs v1.0.1-0.20200509193318-234c15e7648f/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= +github.com/endocrimes/go-winio v0.4.13-0.20190628114223-fb47a8b41948 h1:PgcXIRC45Fcvl4hQeHRzyGsDebslp0j+CXYtMgr3COM= +github.com/endocrimes/go-winio v0.4.13-0.20190628114223-fb47a8b41948/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/envoyproxy/go-control-plane v0.8.0/go.mod h1:GSSbY9P1neVhdY7G4wu+IK1rk/dqhiCC/4ExuWJZVuk= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.0.14/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= +github.com/frankban/quicktest v1.4.0 h1:rCSCih1FnSWJEel/eub9wclBSqpF2F/PuvxUWGWnbO8= +github.com/frankban/quicktest v1.4.0/go.mod h1:36zfPVQyHxymz4cH7wlDmVwDrJuljRB60qkgn7rorfQ= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsouza/go-dockerclient v1.6.5 h1:vuFDnPcds3LvTWGYb9h0Rty14FLgkjHZdwLDROCdgsw= +github.com/fsouza/go-dockerclient v1.6.5/go.mod h1:GOdftxWLWIbIWKbIMDroKFJzPdg6Iw7r+jX1DDZdVsA= +github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= +github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= +github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/godbus/dbus v5.0.1+incompatible h1:fsDsnr/6MFSIm3kl6JJpq5pH+vO/rA5jUunalLnzSc8= +github.com/godbus/dbus v5.0.1+incompatible/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= +github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/googleapis v1.2.0/go.mod h1:Njal3psf3qN6dwBtQfUmBZh2ybovJ0tlu3o/AC7HYjU= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= +github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= +github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go v2.0.0+incompatible h1:j0GKcs05QVmm7yesiZq2+9cxHkNK9YM6zKx4D2qucQU= +github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY= +github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/googleapis/gnostic v0.2.0/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= +github.com/gophercloud/gophercloud v0.0.0-20180828235145-f29afc2cceca h1:wobTb8SE189AuxzEKClyYxiI4nUGWlpVtl13eLiFlOE= +github.com/gophercloud/gophercloud v0.0.0-20180828235145-f29afc2cceca/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= +github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/handlers v0.0.0-20150720190736-60c7bfde3e33/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= +github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= +github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc= +github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.1-0.20200228141219-3ce3d519df39 h1:MqvH60+R2JhSdvVgGxmExOndrkRQtGW7w4+gcrymN64= +github.com/grpc-ecosystem/go-grpc-middleware v1.2.1-0.20200228141219-3ce3d519df39/go.mod h1:mJzapYve32yjrKlk9GbyCZHuPgZsrbyIbyKhSzOpg6s= +github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= +github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.9.0 h1:bM6ZAFZmc/wPFaRDi0d5L7hGEZEx/2u+Tmr2evNHDiI= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/consul v1.7.1-0.20200213195527-b137060630b4 h1:KO2Xiprv+MgQ75yyakCf3m62u4UMS3C+C68Oa+f47EA= +github.com/hashicorp/consul v1.7.1-0.20200213195527-b137060630b4/go.mod h1:vKfXmSQNl6HwO/JqQ2DDLzisBDV49y+JVTkrdW1cnSU= +github.com/hashicorp/consul-template v0.24.1 h1:96zTJ5YOq4HMTgtehXRvzGoQNEG2Z4jBYY5ofhq8/Cc= +github.com/hashicorp/consul-template v0.24.1/go.mod h1:KcTEopo2kCp7kww0d4oG7d3oX2Uou4hzb1Rs/wY9TVI= +github.com/hashicorp/consul/api v1.2.0/go.mod h1:1SIkFYi2ZTXUE5Kgt179+4hH33djo11+0Eo2XgTAtkw= +github.com/hashicorp/consul/api v1.4.0 h1:jfESivXnO5uLdH650JU/6AnjRoHrLhULq0FnC3Kp9EY= +github.com/hashicorp/consul/api v1.4.0/go.mod h1:xc8u05kyMa3Wjr9eEAsIAo3dg8+LywT5E/Cl7cNS5nU= +github.com/hashicorp/consul/sdk v0.2.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= +github.com/hashicorp/consul/sdk v0.4.0 h1:zBtCfKJZcJDBvSCkQJch4ulp59m1rATFLKwNo/LYY30= +github.com/hashicorp/consul/sdk v0.4.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM= +github.com/hashicorp/cronexpr v1.1.0 h1:dnNsWtH0V2ReN7JccYe8m//Bj14+PjJDntR1dz0Cixk= +github.com/hashicorp/cronexpr v1.1.0/go.mod h1:P4wA0KBl9C5q2hABiMO7cp6jcIg96CDh1Efb3g1PWA4= +github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-bexpr v0.1.2/go.mod h1:ANbpTX1oAql27TZkKVeW8p1w8NTdnyzPe/0qqPCKohU= +github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de h1:XDCSythtg8aWSRSO29uwhgh7b127fWr+m5SemqjSUL8= +github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de/go.mod h1:xIwEieBHERyEvaeKF/TcHh1Hu+lxPM+n2vT1+g9I4m4= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-connlimit v0.2.0 h1:OZjcfNxH/hPh/bT2Iw5yOJcLzz+zuIWpsp3I1S4Pjw4= +github.com/hashicorp/go-connlimit v0.2.0/go.mod h1:OUj9FGL1tPIhl/2RCfzYHrIiWj+VVPGNyVPnUX8AqS0= +github.com/hashicorp/go-discover v0.0.0-20191202160150-7ec2cfbda7a2/go.mod h1:NnH5X4UCBEBdTuK2L8s4e4ilJm3UmGX0bANHCz0HSs0= +github.com/hashicorp/go-discover v0.0.0-20200108194735-7698de1390a1 h1:ir6YzYlYVUvoHvVpFlHa7bLGjMFUfTNC0+TFnPzTnTM= +github.com/hashicorp/go-discover v0.0.0-20200108194735-7698de1390a1/go.mod h1:txEDH3XlSg7/Ot5HIV2caLldDa/P0zoy3lr9ijypNlU= +github.com/hashicorp/go-envparse v0.0.0-20180119215841-310ca1881b22 h1:HTmDIaSN95gbdMyrsbNiXSdW4fbGctGQwEqv0H7OhDQ= +github.com/hashicorp/go-envparse v0.0.0-20180119215841-310ca1881b22/go.mod h1:/NlxCzN2D4C4L2uDE6ux/h6jM+n98VFQM14nnCIfHJU= +github.com/hashicorp/go-gatedio v0.5.0 h1:Jm1X5yP4yCqqWj5L1TgW7iZwCVPGtVc+mro5r/XX7Tg= +github.com/hashicorp/go-gatedio v0.5.0/go.mod h1:Lr3t8L6IyxD3DAeaUxGcgl2JnRUpWMCsmBl4Omu/2t4= +github.com/hashicorp/go-getter v1.3.1-0.20190822194507-f5101da01173 h1:TrGTIKbhlSy7p/gTZ4R571mnn2OQ4lvkTkSCmkAAvNU= +github.com/hashicorp/go-getter v1.3.1-0.20190822194507-f5101da01173/go.mod h1:/O1k/AizTN0QmfEKknCYGvICeyKUDqCYA8vvWtGWDeQ= +github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= +github.com/hashicorp/go-hclog v0.8.0/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-hclog v0.12.0 h1:d4QkX8FRTYaKaCZBoXYY8zJX2BXjWxurN/GA2tkrmZM= +github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= +github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.1.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-immutable-radix v1.2.0 h1:l6UW37iCXwZkZoAbEYnptSHVE/cQ5bOTPYG5W3vf9+8= +github.com/hashicorp/go-immutable-radix v1.2.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-memdb v1.0.3/go.mod h1:LWQ8R70vPrS4OEY9k28D2z8/Zzyu34NVzeRibGAzHO0= +github.com/hashicorp/go-memdb v1.2.1 h1:wI9btDjYUOJJHTCnRlAG/TkRyD/ij7meJMrLK9X31Cc= +github.com/hashicorp/go-memdb v1.2.1/go.mod h1:OSvLJ662Jim8hMM+gWGyhktyWk2xPCnWMc7DWIqtkGA= +github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= +github.com/hashicorp/go-msgpack v1.1.5 h1:9byZdVjKTe5mce63pRVNP1L7UAmdHOTEMGehn6KvJWs= +github.com/hashicorp/go-msgpack v1.1.5/go.mod h1:gWVc3sv/wbDmR3rQsj1CAktEZzoz1YNK9NfGLXJ69/4= +github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.0.1-0.20191120192120-72917a1559e1 h1:GykKxF7ikF21GDbvpNQDQ3unj6Vf7qBeBjVQJx6s38U= +github.com/hashicorp/go-multierror v1.0.1-0.20191120192120-72917a1559e1/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= +github.com/hashicorp/go-plugin v1.0.2-0.20191004171845-809113480b55 h1:XzRWU4VSJBqGVxl6tWD+6ITHftMhvRDKKyp1WVSXAhY= +github.com/hashicorp/go-plugin v1.0.2-0.20191004171845-809113480b55/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= +github.com/hashicorp/go-raftchunking v0.6.1/go.mod h1:cGlg3JtDy7qy6c/3Bu660Mic1JF+7lWqIwCFSb08fX0= +github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= +github.com/hashicorp/go-retryablehttp v0.5.4 h1:1BZvpawXoJCWX6pNtow9+rpEj+3itIlutiqnntI6jOE= +github.com/hashicorp/go-retryablehttp v0.5.4/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= +github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-rootcerts v1.0.1/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= +github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= +github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= +github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I= +github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= +github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= +github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A= +github.com/hashicorp/go-syslog v1.0.0 h1:KaodqZuhUoZereWVIYmpUgZysurB1kBLX2j0MwMrUAE= +github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= +github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go-version v1.2.1-0.20191009193637-2046c9d0f0b0 h1:8gXJgyR86/nGv7IqrnmnKJVNxC9APdvAVSxc9mGxfKk= +github.com/hashicorp/go-version v1.2.1-0.20191009193637-2046c9d0f0b0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/hcl v1.0.1-0.20191016231534-914dc3f8dd7c h1:PdZEHcpa3117kJ1Wa5EYupzCzn9QlBby8Fx2YpZPYvo= +github.com/hashicorp/hcl v1.0.1-0.20191016231534-914dc3f8dd7c/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/hcl/v2 v2.5.1 h1:5ytFZykUu2/4U59ogd2f+XZdi9+6oC/Tv5WzsH6fIDA= +github.com/hashicorp/hcl/v2 v2.5.1/go.mod h1:bQTN5mpo+jewjJgh8jr0JUguIi7qPHUF6yIfAEN3jqY= +github.com/hashicorp/hil v0.0.0-20160711231837-1e86c6b523c5/go.mod h1:KHvg/R2/dPtaePb16oW4qIyzkMxXOL38xjRN64adsts= +github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= +github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/mdns v1.0.1 h1:XFSOubp8KWB+Jd2PDyaX5xUd5bhSP/+pTDZVDMzZJM8= +github.com/hashicorp/mdns v1.0.1/go.mod h1:4gW7WsVCke5TE7EPeYliwHlRUyBtfCwuFwuMg2DmyNY= +github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/memberlist v0.1.4/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/memberlist v0.1.6 h1:ouPxvwKYaNZe+eTcHxYP0EblPduVLvIPycul+vv8his= +github.com/hashicorp/memberlist v0.1.6/go.mod h1:5VDNHjqFMgEcclnwmkCnC99IPwxBmIsxwY8qn+Nl0H4= +github.com/hashicorp/net-rpc-msgpackrpc v0.0.0-20151116020338-a14192a58a69 h1:lc3c72qGlIMDqQpQH82Y4vaglRMMFdJbziYWriR4UcE= +github.com/hashicorp/net-rpc-msgpackrpc v0.0.0-20151116020338-a14192a58a69/go.mod h1:/z+jUGRBlwVpUZfjute9jWaF6/HuhjuFQuL1YXzVD1Q= +github.com/hashicorp/raft v1.1.1/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8= +github.com/hashicorp/raft v1.1.2/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8= +github.com/hashicorp/raft v1.1.3-0.20200211192230-365023de17e6 h1:+H0NF++gFCFqQQdjRstZssPZcx9BiaMOGHxSxoNvBN8= +github.com/hashicorp/raft v1.1.3-0.20200211192230-365023de17e6/go.mod h1:vPAJM8Asw6u8LxC3eJCUZmRP/E4QmUGE1R7g7k8sG/8= +github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea h1:xykPFhrBAS2J0VBzVa5e80b5ZtYuNQtgXjN40qBZlD4= +github.com/hashicorp/raft-boltdb v0.0.0-20171010151810-6e5ba93211ea/go.mod h1:pNv7Wc3ycL6F5oOWn+tPGo2gWD4a5X+yp/ntwdKLjRk= +github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/serf v0.8.3/go.mod h1:UpNcs7fFbpKIyZaUuSW6EPiH+eZC7OuyFD+wc1oal+k= +github.com/hashicorp/serf v0.8.5 h1:ZynDUIQiA8usmRgPdGPHFdPnb1wgGI9tK3mO9hcAJjc= +github.com/hashicorp/serf v0.8.5/go.mod h1:UpNcs7fFbpKIyZaUuSW6EPiH+eZC7OuyFD+wc1oal+k= +github.com/hashicorp/vault/api v1.0.4/go.mod h1:gDcqh3WGcR1cpF5AJz/B1UFheUEneMoIospckxBxk6Q= +github.com/hashicorp/vault/api v1.0.5-0.20190730042357-746c0b111519 h1:2qdbEUXjHohC+OYHtVU5lujvPAHPKYR4IMs9rsiUTk8= +github.com/hashicorp/vault/api v1.0.5-0.20190730042357-746c0b111519/go.mod h1:i9PKqwFko/s/aihU1uuHGh/FaQS+Xcgvd9dvnfAvQb0= +github.com/hashicorp/vault/sdk v0.1.13/go.mod h1:B+hVj7TpuQY1Y/GPbCpffmgd+tSEwvhkWnjtSYCaS2M= +github.com/hashicorp/vault/sdk v0.1.14-0.20190730042320-0dc007d98cc8 h1:fLUoZ8cI/pqlVCk09r88cVoY7ggKEl1A4e6Mujr3RvU= +github.com/hashicorp/vault/sdk v0.1.14-0.20190730042320-0dc007d98cc8/go.mod h1:B+hVj7TpuQY1Y/GPbCpffmgd+tSEwvhkWnjtSYCaS2M= +github.com/hashicorp/vic v1.5.1-0.20190403131502-bbfe86ec9443 h1:O/pT5C1Q3mVXMyuqg7yuAWUg/jMZR1/0QTzTRdNR6Uw= +github.com/hashicorp/vic v1.5.1-0.20190403131502-bbfe86ec9443/go.mod h1:bEpDU35nTu0ey1EXjwNwPjI9xErAsoOCmcMb9GKvyxo= +github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= +github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hpcloud/tail v1.0.1-0.20170814160653-37f427138745 h1:8as8OQ+RF1QrsHvWWsKBtBKINhD9QaD1iozA1wrO4aA= +github.com/hpcloud/tail v1.0.1-0.20170814160653-37f427138745/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jarcoal/httpmock v0.0.0-20180424175123-9c70cfe4a1da h1:FjHUJJ7oBW4G/9j1KzlHaXL09LyMVM9rupS39lncbXk= +github.com/jarcoal/httpmock v0.0.0-20180424175123-9c70cfe4a1da/go.mod h1:ks+b9deReOc7jgqp+e7LuFiCBH6Rm5hL32cLcEAArb4= +github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= +github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.0.0-20160803190731-bd40a432e4c7/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/joyent/triton-go v0.0.0-20180628001255-830d2b111e62/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA= +github.com/joyent/triton-go v0.0.0-20190112182421-51ffac552869 h1:BvV6PYcRz0yGnWXNZrd5wginNT1GfFfPvvWpPbjfFL8= +github.com/joyent/triton-go v0.0.0-20190112182421-51ffac552869/go.mod h1:U+RSyWxWd04xTqnuOQxnai7XGS2PrPY2cfGoDKtMHjA= +github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024 h1:rBMNdlhTLzJjJSDIjNEXX1Pz3Hmwmz91v+zycvx9PJc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.5 h1:hyz3dwM5QLc1Rfoz4FuWJQG5BN7tc6K1MndAUnGpQr4= +github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4= +github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/likexian/gokit v0.0.0-20190309162924-0a377eecf7aa/go.mod h1:QdfYv6y6qPA9pbBA2qXtoT8BMKha6UyNbxWGWl/9Jfk= +github.com/likexian/gokit v0.0.0-20190418170008-ace88ad0983b/go.mod h1:KKqSnk/VVSW8kEyO2vVCXoanzEutKdlBAPohmGXkxCk= +github.com/likexian/gokit v0.0.0-20190501133040-e77ea8b19cdc/go.mod h1:3kvONayqCaj+UgrRZGpgfXzHdMYCAO0KAt4/8n0L57Y= +github.com/likexian/gokit v0.20.16/go.mod h1:kn+nTv3tqh6yhor9BC4Lfiu58SmH8NmQ2PmEl+uM6nU= +github.com/likexian/simplejson-go v0.0.0-20190409170913-40473a74d76d/go.mod h1:Typ1BfnATYtZ/+/shXfFYLrovhFyuKvzwrdOnIDHlmg= +github.com/likexian/simplejson-go v0.0.0-20190419151922-c1f9f0b4f084/go.mod h1:U4O1vIJvIKwbMZKUJ62lppfdvkCdVd2nfMimHK81eec= +github.com/likexian/simplejson-go v0.0.0-20190502021454-d8787b4bfa0b/go.mod h1:3BWwtmKP9cXWwYCr5bkoVDEfLywacOv0s06OBEDpyt8= +github.com/linode/linodego v0.7.1 h1:4WZmMpSA2NRwlPZcc0+4Gyn7rr99Evk9bnr0B3gXRKE= +github.com/linode/linodego v0.7.1/go.mod h1:ga11n3ivecUrPCHN0rANxKmfWBJVkOXfLMZinAbj2sY= +github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-shellwords v1.0.5 h1:JhhFTIOslh5ZsPrpa3Wdg8bF0WI3b44EMblmU9wIsXc= +github.com/mattn/go-shellwords v1.0.5/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= +github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/dns v1.1.15/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/dns v1.1.26 h1:gPxPSwALAeHJSjarOs00QjVdV9QoBvc1D2ujQUr5BzU= +github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= +github.com/mitchellh/cli v1.0.0 h1:iGBIsUe3+HZ/AD/Vd7DErOt5sU9fa8Uj7A2s1aggv1Y= +github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/colorstring v0.0.0-20150917214807-8631ce90f286 h1:KHyL+3mQOF9sPfs26lsefckcFNDcIZtiACQiECzIUkw= +github.com/mitchellh/colorstring v0.0.0-20150917214807-8631ce90f286/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= +github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= +github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b h1:9+ke9YJ9KGWw5ANXK6ozjoK47uI3uNbXv4YVINBnGm8= +github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b/go.mod h1:r1VsdOzOPt1ZSrGZWFoNhsAedKnEd6r9Np1+5blZCWk= +github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= +github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= +github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= +github.com/mitchellh/hashstructure v0.0.0-20170609045927-2bca23e0e452/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ= +github.com/mitchellh/hashstructure v1.0.0 h1:ZkRJX1CyOoTkar7p/mLS5TZU4nJ1Rn/F8u9dGS02Q3Y= +github.com/mitchellh/hashstructure v1.0.0/go.mod h1:QjSHrPWS+BGUVBYkbTZWEnOh3G1DutKwClXU/ABz6AQ= +github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= +github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.3.1 h1:cCBH2gTD2K0OtLlv/Y5H01VQCqmlDxz30kS5Y5bqfLA= +github.com/mitchellh/mapstructure v1.3.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= +github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/mitchellh/reflectwalk v1.0.1 h1:FVzMWA5RllMAKIdUSC8mdWo3XtwoecrH79BY70sEEpE= +github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618 h1:7InQ7/zrOh6SlFjaXFubv0xX0HsuC9qJsdqm7bNQpYM= +github.com/mrunalp/fileutils v0.0.0-20171103030105-7d4729fb3618/go.mod h1:x8F1gnqOkIEiO4rqoeEEEqQbo7HjGMTvyoq3gej4iT0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= +github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= +github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= +github.com/nicolai86/scaleway-sdk v1.10.2-0.20180628010248-798f60e20bb2 h1:BQ1HW7hr4IVovMwWg0E0PYcyW8CzqDcVmaew9cujU4s= +github.com/nicolai86/scaleway-sdk v1.10.2-0.20180628010248-798f60e20bb2/go.mod h1:TLb2Sg7HQcgGdloNxkrmtgDNR9uVYF3lfdFIN4Ro6Sk= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/oklog/run v1.0.1-0.20180308005104-6934b124db28 h1:R9vmquWCeGmxTHUVnTQJrU4oPlgEn9+x48nwXSqkIKg= +github.com/oklog/run v1.0.1-0.20180308005104-6934b124db28/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= +github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= +github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= +github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= +github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= +github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= +github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runc v1.0.0-rc7 h1:1eqSWkWzuGk04OAMJPPjan7yGMcI1SUjpr/sx3+q1+M= +github.com/opencontainers/runc v1.0.0-rc7/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.2-0.20200307132014-f49fed0d6290 h1:IV446MVY9HToNlBK/Hv7RLg5m0lu8F/dSv5r679ZbWM= +github.com/opencontainers/runtime-spec v1.0.2-0.20200307132014-f49fed0d6290/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= +github.com/opencontainers/selinux v1.4.1-0.20200311111634-a2f0d9c2aafc h1:qCDQQWKqEAkfXs1KdcU84qc2cuTVzrp7rSJr94eGsbo= +github.com/opencontainers/selinux v1.4.1-0.20200311111634-a2f0d9c2aafc/go.mod h1:yTcKuYAh6R95iDpefGLQaPaRwJFwyzAJufJyiTt7s0g= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= +github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= +github.com/packethost/packngo v0.1.1-0.20180711074735-b9cb5096f54c h1:vwpFWvAO8DeIZfFeqASzZfsxuWPno9ncAebBEP0N3uE= +github.com/packethost/packngo v0.1.1-0.20180711074735-b9cb5096f54c/go.mod h1:otzZQXgoO96RTzDB/Hycg0qZcXZsWJGJRSXbmEIJ+4M= +github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= +github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= +github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pierrec/lz4 v2.2.5+incompatible h1:xOYu2+sKj87pJz7V+I7260354UlcRyAZUGhMCToTzVw= +github.com/pierrec/lz4 v2.2.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/posener/complete v1.2.1 h1:LrvDIY//XNo65Lq84G/akBuMGlawHvGBABv8f/ZN6DI= +github.com/posener/complete v1.2.1/go.mod h1:6gapUrK/U1TAN7ciCoNRIdVC5sbdBTUh1DKN0g6uH7E= +github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= +github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.4.0 h1:YVIb/fVcOTMSqtqZWSKnHpSLBxu8DKgxq8z6RuBZwqI= +github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= +github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20180110214958-89604d197083/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/procfs v0.0.0-20180125133057-cb4147076ac7/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ= +github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/renier/xmlrpc v0.0.0-20170708154548-ce4a1a486c03 h1:Wdi9nwnhFNAlseAOekn6B5G/+GMtks9UKbvRU/CMM/o= +github.com/renier/xmlrpc v0.0.0-20170708154548-ce4a1a486c03/go.mod h1:gRAiPF5C5Nd0eyyRdqIu9qTiFSoZzpTq727b5B8fkkU= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rs/cors v0.0.0-20170801073201-eabcc6af4bbe h1:fPLXIFSIvTs99QtPSCsRITbv01v7MsPN7wpuYtD8ebI= +github.com/rs/cors v0.0.0-20170801073201-eabcc6af4bbe/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/columnize v2.1.1-0.20170703205827-abc90934186a+incompatible h1:ZVvb3R06BXNcQ3nXT2eANJAwGeRu4tbUzLI7sIyFZ2s= +github.com/ryanuber/columnize v2.1.1-0.20170703205827-abc90934186a+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= +github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= +github.com/seccomp/libseccomp-golang v0.9.2-0.20200314001724-bdab42bd5128 h1:vWI7jlfJVWN//T8jrt5JduYkSid+Sl/fRz33J1jQ83k= +github.com/seccomp/libseccomp-golang v0.9.2-0.20200314001724-bdab42bd5128/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= +github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shirou/gopsutil v0.0.0-20181107111621-48177ef5f880/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil v2.20.2+incompatible h1:ucK79BhBpgqQxPASyS2cu9HX8cfDVljBN1WWFvbNvgY= +github.com/shirou/gopsutil v2.20.2+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= +github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= +github.com/shurcooL/events v0.0.0-20181021180414-410e4ca65f48/go.mod h1:5u70Mqkb5O5cxEA8nxTsgrgLehJeAw6Oc4Ab1c/P1HM= +github.com/shurcooL/github_flavored_markdown v0.0.0-20181002035957-2122de532470/go.mod h1:2dOwnU2uBioM+SGy2aZoq1f/Sd1l9OkAeAUvjSyvgU0= +github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= +github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= +github.com/shurcooL/gofontwoff v0.0.0-20180329035133-29b52fc0a18d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= +github.com/shurcooL/gopherjslib v0.0.0-20160914041154-feb6d3990c2c/go.mod h1:8d3azKNyqcHP1GaQE/c6dDgjkgSx2BZ4IoEi4F1reUI= +github.com/shurcooL/highlight_diff v0.0.0-20170515013008-09bb4053de1b/go.mod h1:ZpfEhSmds4ytuByIcDnOLkTHGUI6KNqRNPDLHDk+mUU= +github.com/shurcooL/highlight_go v0.0.0-20181028180052-98c3abbbae20/go.mod h1:UDKB5a1T23gOMUJrI+uSuH0VRDStOiUVSjBTRDVBVag= +github.com/shurcooL/home v0.0.0-20181020052607-80b7ffcb30f9/go.mod h1:+rgNQw2P9ARFAs37qieuu7ohDNQ3gds9msbT2yn85sg= +github.com/shurcooL/htmlg v0.0.0-20170918183704-d01228ac9e50/go.mod h1:zPn1wHpTIePGnXSHpsVPWEktKXHr6+SS6x/IKRb7cpw= +github.com/shurcooL/httperror v0.0.0-20170206035902-86b7830d14cc/go.mod h1:aYMfkZ6DWSJPJ6c4Wwz3QtW22G7mf/PEgaB9k/ik5+Y= +github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= +github.com/shurcooL/httpgzip v0.0.0-20180522190206-b1c53ac65af9/go.mod h1:919LwcH0M7/W4fcZ0/jy0qGght1GIhqyS/EgWGH2j5Q= +github.com/shurcooL/issues v0.0.0-20181008053335-6292fdc1e191/go.mod h1:e2qWDig5bLteJ4fwvDAc2NHzqFEthkqn7aOZAOpj+PQ= +github.com/shurcooL/issuesapp v0.0.0-20180602232740-048589ce2241/go.mod h1:NPpHK2TI7iSaM0buivtFUc9offApnI0Alt/K8hcHy0I= +github.com/shurcooL/notifications v0.0.0-20181007000457-627ab5aea122/go.mod h1:b5uSkrEVM1jQUspwbixRBhaIjIzL2xazXp6kntxYle0= +github.com/shurcooL/octicon v0.0.0-20181028054416-fa4f57f9efb2/go.mod h1:eWdoE5JD4R5UVWDucdOPg1g2fqQRq78IQa9zlOV1vpQ= +github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lToEk4d2s07G3XGfz2QrgHXg4RJBvjrOozvoWfk= +github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= +github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= +github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c h1:fyKiXKO1/I/B6Y2U8T7WdQGWzwehOuGIrljPtt7YTTI= +github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= +github.com/smartystreets/assertions v0.0.0-20180820201707-7c9eb446e3cf/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= +github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/softlayer/softlayer-go v0.0.0-20180806151055-260589d94c7d h1:bVQRCxQvfjNUeRqaY/uT0tFuvuFY0ulgnczuR684Xic= +github.com/softlayer/softlayer-go v0.0.0-20180806151055-260589d94c7d/go.mod h1:Cw4GTlQccdRGSEf6KiMju767x0NEHE0YIVPJSaXjlsw= +github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= +github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA= +github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8 h1:zLV6q4e8Jv9EHjNg/iHfzwDkCve6Ua5jCygptrtXHvI= +github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= +github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= +github.com/tencentcloud/tencentcloud-sdk-go v3.0.83+incompatible h1:8uRvJleFpqLsO77WaAh2UrasMOzd8MxXrNj20e7El+Q= +github.com/tencentcloud/tencentcloud-sdk-go v3.0.83+incompatible/go.mod h1:0PfYow01SHPMhKY31xa+EFz2RStxIqj6JFAJS+IkCi4= +github.com/tent/http-link-go v0.0.0-20130702225549-ac974c61c2f9/go.mod h1:RHkNRtSLfOK7qBTHaeSX1D6BNpI3qw7NTxsmNr4RvN8= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8= +github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok= +github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= +github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= +github.com/vishvananda/netlink v1.1.0 h1:1iyaYNBLmP6L0220aDnYQpo1QEV4t4hJ+xEEhhJH8j0= +github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= +github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df h1:OviZH7qLw/7ZovXvuNyL3XQl8UFofeikI1NW1Gypu7k= +github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= +github.com/vmihailenco/msgpack v3.3.3+incompatible h1:wapg9xDUZDzGCNFlwc5SqI1rvcciqcxEHac4CYj89xI= +github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= +github.com/vmware/govmomi v0.18.0 h1:f7QxSmP7meCtoAmiKZogvVbLInT+CZx6Px6K5rYsJZo= +github.com/vmware/govmomi v0.18.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs= +github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA= +github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= +github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= +github.com/zclconf/go-cty v1.4.1 h1:Xzr4m4utRDhHDifag1onwwUSq32HLoLBsp+w6tD0880= +github.com/zclconf/go-cty v1.4.1/go.mod h1:nHzOclRkoj++EU9ZjSrZvRG0BXIWt8c7loYc0qXAFGQ= +go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= +go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.1-0.20190713072201-b4a14686f0a9 h1:7LiVwYOeGhrZmChB6cSFzXlk3v0aRNA28kOEygIK9mw= +go.opencensus.io v0.22.1-0.20190713072201-b4a14686f0a9/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= +golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= +golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191106202628-ed6320f186d4/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 h1:cg5LA/zNPRzIXIWSCxQW10Rvpy94aQh3LT/ShoCpkHw= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136 h1:A1gGSx58LAGVHUUsOf7IiR0u8Xb6W51gRwfDBhkdcaw= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f h1:J5lckAjkw6qYlOZNj90mLYNTEKDvWeuc1yieZ8qUzUE= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/oauth2 v0.0.0-20170807180024-9a379c6b3e95/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a h1:WXEvlFVvvGxCJLG6REjsT03iWnKLEWinaScsxF2Vm2o= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181213200352-4d1cda033e06/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190508220229-2d0786266e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190514135907-3a4b5fb9f71f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190523142557-0e01d883c5c5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606203320-7fc4e5ec1444/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190730183949-1393eb018365/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121 h1:rITEj+UZHYC927n8GT97eC3zrpzXdb/voyeOuVKS46o= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20181227161524-e6919f6577db/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3-0.20200306154105-06d492aade88 h1:FrVQfHlSD67oSu7MiglkpXjapTEe2ZF/wS9JaYQX/xA= +golang.org/x/text v0.3.3-0.20200306154105-06d492aade88/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190424220101-1e8e1cfdf96b/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375 h1:SjQ2+AKWgZLc1xej6WSzL+Dfs5Uyd5xcZH1mGC411IA= +golang.org/x/tools v0.0.0-20200522201501-cb1345f3a375/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.0.0-20160322025152-9bf6e6e569ff/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.0.0-20180829000535-087779f1d2c9/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.0.0-20180910000450-7ca32eb868bf/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.0.0-20181030000543-1d582fd0359e/go.mod h1:4mhQ8q/RsB7i+udVvVy5NUi08OU8ZlA0gRVgrF7VFY0= +google.golang.org/api v0.1.0/go.mod h1:UGEZY7KEX120AnNLIHFMKIo4obdJhkp2tPbaPlQx13Y= +google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0 h1:Q3Ui3V3/CVinFWFiW39Iw0kMuVrRzYX0wN6OPFp0lTA= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/cloud v0.0.0-20151119220103-975617b05ea8/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20181202183823-bd91e49a0898/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= +google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922/go.mod h1:L3J43x8/uS+qIUoksaLKe6OS3nUKxOKuIFz1sl2/jx4= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190404172233-64821d5d2107/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20200302123026-7795fca6ccb1 h1:RYJIKMPLUCjLP+fEg9ygjxF3KjfSHN4BSZw91aecq6U= +google.golang.org/genproto v0.0.0-20200302123026-7795fca6ccb1/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20141024133853-64131543e789/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/square/go-jose.v2 v2.4.1 h1:H0TmLt7/KmzlrDOpa1F+zr0Tk90PbJYBfsVUmRLrf9Y= +gopkg.in/square/go-jose.v2 v2.4.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/tomb.v2 v2.0.0-20140626144623-14b3d72120e8 h1:EQ3aCG3c3nkUNxx6quE0Ux47RYExj7cJyRMxUXqPf6I= +gopkg.in/tomb.v2 v2.0.0-20140626144623-14b3d72120e8/go.mod h1:BHsqpu/nsuzkT5BpiH1EMZPLyqSMM8JbIavyFACoFNk= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= +gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= +gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E= +gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= +grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= +honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +istio.io/gogo-genproto v0.0.0-20190124151557-6d926a6e6feb/go.mod h1:eIDJ6jNk/IeJz6ODSksHl5Aiczy5JUq6vFhJWI5OtiI= +k8s.io/api v0.0.0-20180806132203-61b11ee65332/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA= +k8s.io/api v0.0.0-20190325185214-7544f9db76f6/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA= +k8s.io/apimachinery v0.0.0-20180821005732-488889b0007f/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0= +k8s.io/apimachinery v0.0.0-20190223001710-c182ff3b9841/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0= +k8s.io/client-go v8.0.0+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s= +k8s.io/cri-api v0.17.3/go.mod h1:X1sbHmuXhwaHs9xxYffLqJogVsnI+f6cPRcgPel7ywM= +k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= +launchpad.net/gocheck v0.0.0-20140225173054-000000000087/go.mod h1:hj7XX3B/0A+80Vse0e+BUHsHMTEhd0O4cpUHr/e/BUM= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +sourcegraph.com/sourcegraph/go-diff v0.5.0/go.mod h1:kuch7UrkMzY0X+p9CRK03kfuPQ2zzQcaEFbx8wA8rck= +sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/vendor/github.com/shirou/gopsutil/host/include/smc.c b/lib/darwin/include/smc.c similarity index 100% rename from vendor/github.com/shirou/gopsutil/host/include/smc.c rename to lib/darwin/include/smc.c diff --git a/vendor/github.com/shirou/gopsutil/host/include/smc.h b/lib/darwin/include/smc.h similarity index 100% rename from vendor/github.com/shirou/gopsutil/host/include/smc.h rename to lib/darwin/include/smc.h diff --git a/tools/go.mod b/tools/go.mod new file mode 100644 index 000000000000..a0c923b9a444 --- /dev/null +++ b/tools/go.mod @@ -0,0 +1,25 @@ +module github.com/hashicorp/nomad/tools + +go 1.14 + +require ( + github.com/a8m/tree v0.0.0-20181222104329-6a0b80129de4 + github.com/client9/misspell v0.3.4 + github.com/elazarl/go-bindata-assetfs v1.0.0 + github.com/golang/protobuf v1.3.4 + github.com/golangci/golangci-lint v1.24.0 + github.com/google/go-cmp v0.4.0 // indirect + github.com/hashicorp/go-bindata v3.0.7+incompatible + github.com/hashicorp/go-msgpack v1.1.5 + github.com/hashicorp/hcl/v2 v2.5.1 + github.com/jteeuwen/go-bindata v3.0.7+incompatible // indirect + github.com/kr/text v0.2.0 // indirect + github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect + github.com/onsi/ginkgo v1.12.0 // indirect + github.com/onsi/gomega v1.9.0 // indirect + github.com/stretchr/testify v1.5.1 // indirect + golang.org/x/tools v0.0.0-20200502202811-ed308ab3e770 // indirect + gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect + gopkg.in/yaml.v2 v2.2.8 // indirect + gotest.tools/gotestsum v0.4.2 +) diff --git a/tools/go.sum b/tools/go.sum new file mode 100644 index 000000000000..5c71a8f663c9 --- /dev/null +++ b/tools/go.sum @@ -0,0 +1,448 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/OpenPeeDeeP/depguard v1.0.1 h1:VlW4R6jmBIv3/u1JNlawEvJMM4J+dPORPaZasQee8Us= +github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= +github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/a8m/tree v0.0.0-20181222104329-6a0b80129de4 h1:mK1/QgFPU4osbhjJ26B1w738kjQHaGJcon8uCLMS8fk= +github.com/a8m/tree v0.0.0-20181222104329-6a0b80129de4/go.mod h1:FSdwKX97koS5efgm8WevNf7XS3PqtyFkKDDXrz778cg= +github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8= +github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= +github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= +github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= +github.com/apparentlymart/go-textseg/v12 v12.0.0 h1:bNEQyAGak9tojivJNkoqWErVCQbjdL7GzRt3F8NvfJ0= +github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/bombsimon/wsl/v2 v2.0.0 h1:+Vjcn+/T5lSrO8Bjzhk4v14Un/2UyCA1E3V5j9nwTkQ= +github.com/bombsimon/wsl/v2 v2.0.0/go.mod h1:mf25kr/SqFEPhhcxW1+7pxzGlW+hIl/hYTKY95VwV8U= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk= +github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= +github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-critic/go-critic v0.4.1 h1:4DTQfT1wWwLg/hzxwD9bkdhDQrdJtxe6DUTadPlrIeE= +github.com/go-critic/go-critic v0.4.1/go.mod h1:7/14rZGnZbY6E38VEGk2kVhoq6itzc1E68facVDK23g= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-lintpack/lintpack v0.5.2 h1:DI5mA3+eKdWeJ40nU4d6Wc26qmdG8RCi/btYq0TuRN0= +github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTDqfpXvXAN0sXM= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= +github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/go-toolsmith/astcast v1.0.0 h1:JojxlmI6STnFVG9yOImLeGREv8W2ocNUM+iOhR6jE7g= +github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= +github.com/go-toolsmith/astcopy v1.0.0 h1:OMgl1b1MEpjFQ1m5ztEO06rz5CUd3oBv9RF7+DyvdG8= +github.com/go-toolsmith/astcopy v1.0.0/go.mod h1:vrgyG+5Bxrnz4MZWPF+pI4R8h3qKRjjyvV/DSez4WVQ= +github.com/go-toolsmith/astequal v0.0.0-20180903214952-dcb477bfacd6/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= +github.com/go-toolsmith/astequal v1.0.0 h1:4zxD8j3JRFNyLN46lodQuqz3xdKSrur7U/sr0SDS/gQ= +github.com/go-toolsmith/astequal v1.0.0/go.mod h1:H+xSiq0+LtiDC11+h1G32h7Of5O3CYFJ99GVbS5lDKY= +github.com/go-toolsmith/astfmt v0.0.0-20180903215011-8f8ee99c3086/go.mod h1:mP93XdblcopXwlyN4X4uodxXQhldPGZbcEJIimQHrkg= +github.com/go-toolsmith/astfmt v1.0.0 h1:A0vDDXt+vsvLEdbMFJAUBI/uTbRw1ffOPnxsILnFL6k= +github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw= +github.com/go-toolsmith/astinfo v0.0.0-20180906194353-9809ff7efb21/go.mod h1:dDStQCHtmZpYOmjRP/8gHHnCCch3Zz3oEgCdZVdtweU= +github.com/go-toolsmith/astp v0.0.0-20180903215135-0af7e3c24f30/go.mod h1:SV2ur98SGypH1UjcPpCatrV5hPazG6+IfNHbkDXBRrk= +github.com/go-toolsmith/astp v1.0.0 h1:alXE75TXgcmupDsMK1fRAy0YUzLzqPVvBKoyWV+KPXg= +github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI= +github.com/go-toolsmith/pkgload v0.0.0-20181119091011-e9e65178eee8/go.mod h1:WoMrjiy4zvdS+Bg6z9jZH82QXwkcgCBX6nOfnmdaHks= +github.com/go-toolsmith/pkgload v1.0.0 h1:4DFWWMXVfbcN5So1sBNW9+yeiMqLFGl1wFLTL5R0Tgg= +github.com/go-toolsmith/pkgload v1.0.0/go.mod h1:5eFArkbO80v7Z0kdngIxsRXRMTaX4Ilcwuh3clNrQJc= +github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4= +github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= +github.com/go-toolsmith/typep v1.0.0 h1:zKymWyA1TRYvqYrYDrfEMZULyrhcnGY3x7LDKU2XQaA= +github.com/go-toolsmith/typep v1.0.0/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/gofrs/flock v0.0.0-20190320160742-5135e617513b h1:ekuhfTjngPhisSjOJ0QWKpPQE8/rbknHaes6WVJj5Hw= +github.com/gofrs/flock v0.0.0-20190320160742-5135e617513b/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= +github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= +github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= +github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= +github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6 h1:YYWNAGTKWhKpcLLt7aSj/odlKrSrelQwlovBpDuf19w= +github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6/go.mod h1:DbHgvLiFKX1Sh2T1w8Q/h4NAI8MHIpzCdnBUDTXU3I0= +github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 h1:9kfjN3AdxcbsZBf8NjltjWihK2QfBBBZuv91cMFfDHw= +github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= +github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3 h1:pe9JHs3cHHDQgOFXJJdYkK6fLz2PWyYtP4hthoCMvs8= +github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3/go.mod h1:JXrF4TWy4tXYn62/9x8Wm/K/dm06p8tCKwFRDPZG/1o= +github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee h1:J2XAy40+7yz70uaOiMbNnluTg7gyQhtGqLQncQh+4J8= +github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee/go.mod h1:ozx7R9SIwqmqf5pRP90DhR2Oay2UIjGuKheCBCNwAYU= +github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks= +github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= +github.com/golangci/golangci-lint v1.24.0 h1:OcmSTTMPqI/VT4GvN1fKuE9NX15dDXIwolO0l08334U= +github.com/golangci/golangci-lint v1.24.0/go.mod h1:yIqiAZ2SSQqg+1JeFlAdvEWjGVz4uu5jr4lrciqA1gE= +github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc h1:gLLhTLMk2/SutryVJ6D4VZCU3CUqr8YloG7FPIBWFpI= +github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc/go.mod h1:e5tpTHCfVze+7EpLEozzMB3eafxo2KT5veNg1k6byQU= +github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= +github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= +github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca h1:kNY3/svz5T29MYHubXix4aDDuE3RWHkPvopM/EDv/MA= +github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= +github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770 h1:EL/O5HGrF7Jaq0yNhBLucz9hTuRzj2LdwGBOaENgxIk= +github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770/go.mod h1:dEbvlSfYbMQDtrpRMQU675gSDLDNa8sCPPChZ7PhiVA= +github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 h1:leSNB7iYzLYSSx3J/s5sVf4Drkc68W2wm4Ixh/mr0us= +github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21/go.mod h1:tf5+bzsHdTM0bsB7+8mt0GUMvjCgwLpTapNZHU8AajI= +github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0 h1:HVfrLniijszjS1aiNg8JbBMO2+E1WIQ+j/gL4SQqGPg= +github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0/go.mod h1:qOQCunEYvmd/TLamH+7LlVccLvUH5kZNhbCgTHoBbp4= +github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 h1:zwtduBRr5SSWhqsYNgcuWO2kFlpdOZbP0+yRjmvPGys= +github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3 h1:JVnpOZS+qxli+rgVl98ILOXVNbW+kb5wcxeGx8ShUIw= +github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/go-bindata v3.0.7+incompatible h1:tnw1ukCrIsFR0IyN3C+ABwePoiAqEVjR9BFiGauTo1M= +github.com/hashicorp/go-bindata v3.0.7+incompatible/go.mod h1:+IrDq36jUYG0q6TsDY9uO2p77C8f8S5y+RbYHr2UI+U= +github.com/hashicorp/go-msgpack v1.1.5 h1:9byZdVjKTe5mce63pRVNP1L7UAmdHOTEMGehn6KvJWs= +github.com/hashicorp/go-msgpack v1.1.5/go.mod h1:gWVc3sv/wbDmR3rQsj1CAktEZzoz1YNK9NfGLXJ69/4= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/hcl/v2 v2.5.1 h1:5ytFZykUu2/4U59ogd2f+XZdi9+6oC/Tv5WzsH6fIDA= +github.com/hashicorp/hcl/v2 v2.5.1/go.mod h1:bQTN5mpo+jewjJgh8jr0JUguIi7qPHUF6yIfAEN3jqY= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jingyugao/rowserrcheck v0.0.0-20191204022205-72ab7603b68a h1:GmsqmapfzSJkm28dhRoHz2tLRbJmqhU86IPgBtN3mmk= +github.com/jingyugao/rowserrcheck v0.0.0-20191204022205-72ab7603b68a/go.mod h1:xRskid8CManxVta/ALEhJha/pweKBaVG6fWgc0yH25s= +github.com/jirfag/go-printf-func-name v0.0.0-20191110105641-45db9963cdd3 h1:jNYPNLe3d8smommaoQlK7LOA5ESyUJJ+Wf79ZtA7Vp4= +github.com/jirfag/go-printf-func-name v0.0.0-20191110105641-45db9963cdd3/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= +github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= +github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/jteeuwen/go-bindata v3.0.7+incompatible h1:91Uy4d9SYVr1kyTJ15wJsog+esAZZl7JmEfTkwmhJts= +github.com/jteeuwen/go-bindata v3.0.7+incompatible/go.mod h1:JVvhzYOiGBnFSYRyV00iY8q7/0PThjIYav1p9h5dmKs= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4= +github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= +github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb h1:RHba4YImhrUVQDHUCe2BNSOz4tVy2yGyXhvYDvxGgeE= +github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b/go.mod h1:r1VsdOzOPt1ZSrGZWFoNhsAedKnEd6r9Np1+5blZCWk= +github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM= +github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mozilla/tls-observatory v0.0.0-20190404164649-a3c1b6cfecfd/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d h1:AREM5mwr4u1ORQBMvzfzBgpsctsbQikCVpvC+tX285E= +github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= +github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= +github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= +github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= +github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= +github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1:5STLWrekHfjyYwxBRVRXNOSewLJ3PWfDJd1VyTS21fI= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/securego/gosec v0.0.0-20200103095621-79fbf3af8d83 h1:AtnWoOvTioyDXFvu96MWEeE8qj4COSQnJogzLy/u41A= +github.com/securego/gosec v0.0.0-20200103095621-79fbf3af8d83/go.mod h1:vvbZ2Ae7AzSq3/kywjUDxSNq2SJ27RxCz2un0H3ePqE= +github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc= +github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= +github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e h1:MZM7FHLqUHYI0Y/mQAt3d2aYa0SiNms/hFqC9qJYolM= +github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= +github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041 h1:llrF3Fs4018ePo4+G/HV/uQUqEI1HMDjCeOf2V6puPc= +github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= +github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/sourcegraph/go-diff v0.5.1 h1:gO6i5zugwzo1RVTvgvfwCOSVegNuvnNi6bAD1QCmkHs= +github.com/sourcegraph/go-diff v0.5.1/go.mod h1:j2dHj3m8aZgQO8lMTcTnBcXkRRRqi34cd2MNlA9u1mE= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.6.1 h1:VPZzIkznI1YhVMRi6vNFLHSwhnhReBfgTxIPccpfdZk= +github.com/spf13/viper v1.6.1/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= +github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= +github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e h1:RumXZ56IrCj4CL+g1b9OL/oH0QnsF976bC8xQFYUD5Q= +github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa h1:RC4maTWLKKwb7p1cnoygsbKIgNlJqSYBeAFON3Ar8As= +github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa/go.mod h1:dSUh0FtTP8VhvkL1S+gUR1OKd9ZnSaozuI6r3m6wOig= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ultraware/funlen v0.0.2 h1:Av96YVBwwNSe4MLR7iI/BIa3VyI7/djnto/pK3Uxbdo= +github.com/ultraware/funlen v0.0.2/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= +github.com/ultraware/whitespace v0.0.4 h1:If7Va4cM03mpgrNH9k49/VOicWpGoG70XPBFFODYDsg= +github.com/ultraware/whitespace v0.0.4/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= +github.com/uudashr/gocognit v1.0.1 h1:MoG2fZ0b/Eo7NXoIwCVFLG5JED3qgQz5/NEE+rOsjPs= +github.com/uudashr/gocognit v1.0.1/go.mod h1:j44Ayx2KW4+oB6SWMv8KsmHzZrOInQav7D3cQMJ5JUM= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.2.0/go.mod h1:4vX61m6KN+xDduDNwXrhIAVZaZaZiQ1luJk8LWSxF3s= +github.com/valyala/quicktemplate v1.2.0/go.mod h1:EH+4AkTd43SvgIbQHYu59/cJyxDoOVRUAfrukLPuGJ4= +github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= +github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/zclconf/go-cty v1.2.0 h1:sPHsy7ADcIZQP3vILvTjrh74ZA175TFP5vqiNK1UmlI= +github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e h1:N7DeIrjYszNmSW409R3frPPwglRwMkXSBzwVbkOjLLA= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181117154741-2ddaf7f79a09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190110163146-51295c7ec13a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190221204921-83362c3779f5/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190311215038-5c2858a9cfe5/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190424220101-1e8e1cfdf96b/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190719005602-e377ae9d6386/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI= +golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113232020-e2727e816f5a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200102140908-9497f49d5709/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204192400-7124308813f3/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200502202811-ed308ab3e770 h1:M9Fif0OxNji8w+HvmhVQ8KJtiZOsjU9RgslJGhn95XE= +golang.org/x/tools v0.0.0-20200502202811-ed308ab3e770/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= +gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gotest.tools/gotestsum v0.4.2 h1:QOdtb6bnnPUuHKkR9+/QQa8e6qjpTTP7cDi7G9/10C4= +gotest.tools/gotestsum v0.4.2/go.mod h1:a32lmn/7xfm0+QHj8K5NyQY1NNNNhZoAp+/OHkLs77Y= +gotest.tools/v3 v3.0.2 h1:kG1BFyqVHuQoVQiR1bWGnfz/fmHvvuiSPIV7rvl360E= +gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= +mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= +mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b h1:DxJ5nJdkhDlLok9K6qO+5290kphDJbHOQO1DFFFTeBo= +mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= +mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f h1:Cq7MalBHYACRd6EesksG1Q8EoIAKOsiZviGKbOLIej4= +mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw= +sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4 h1:JPJh2pk3+X4lXAkZIk2RuE/7/FoK9maXw+TNPJhVS/c= +sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4/go.mod h1:ketZ/q3QxT9HOBeFhu6RdvsftgpsbFHBF5Cas6cDKZ0= diff --git a/tools/tools.go b/tools/tools.go new file mode 100644 index 000000000000..debf706a046d --- /dev/null +++ b/tools/tools.go @@ -0,0 +1,18 @@ +//+build tools + +// Package tools anonymously imports packages of tools used to build nomad. +// See the GNUMakefile for 'go get` commands. +package tools + +import ( + _ "github.com/a8m/tree/cmd/tree" + _ "github.com/client9/misspell/cmd/misspell" + _ "github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs" + _ "github.com/hashicorp/hcl/v2/cmd/hclfmt" + _ "github.com/golang/protobuf/protoc-gen-go" + _ "github.com/golangci/golangci-lint/cmd/golangci-lint" + _ "github.com/hashicorp/go-bindata/go-bindata" + _ "github.com/hashicorp/go-msgpack/codec/codecgen" + _ "gotest.tools/gotestsum" +) + diff --git a/vendor/cloud.google.com/go/CHANGES.md b/vendor/cloud.google.com/go/CHANGES.md new file mode 100644 index 000000000000..5be36db43955 --- /dev/null +++ b/vendor/cloud.google.com/go/CHANGES.md @@ -0,0 +1,1383 @@ +# Changes + +## v0.46.3 + +This is an empty release that was created solely to aid in storage's module +carve-out. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository. + +## v0.46.2 + +This is an empty release that was created solely to aid in spanner's module +carve-out. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository. + +## v0.46.1 + +This is an empty release that was created solely to aid in firestore's module +carve-out. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository. + +## v0.46.0 + +- spanner: + - Retry "Session not found" for read-only transactions. + - Retry aborted PDMLs. +- spanner/spannertest: + - Fix a bug that was causing 0X-prefixed number to be parsed incorrectly. +- storage: + - Add HMACKeyOptions. + - Remove *REGIONAL from StorageClass. MULTI_REGIONAL, + DURABLE_REDUCED_AVAILABILITY, and REGIONAL are no longer StorageClasses but + they are still LocationTypes. +- trace: + - Remove cloud.google.com/go/trace. Package cloud.google.com/go/trace has been + marked OBSOLETE for several years: it is now no longer provided. If you + relied on this package, please vendor it or switch to using + https://cloud.google.com/trace/docs/setup/go (which obsoleted it). + +## v0.45.1 + +This is an empty release that was created solely to aid in pubsub's module +carve-out. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository. + +## v0.45.0 + +- compute/metadata: + - Add Email method. +- storage: + - Fix duplicated retry logic. + - Add ReaderObjectAttrs.StartOffset. + - Support reading last N bytes of a file when a negative range is given, such + as `obj.NewRangeReader(ctx, -10, -1)`. + - Add HMACKey listing functionality. +- spanner/spannertest: + - Support primary keys with no columns. + - Fix MinInt64 parsing. + - Implement deletion of key ranges. + - Handle reads during a read-write transaction. + - Handle returning DATE values. +- pubsub: + - Fix Ack/Modack request size calculation. +- logging: + - Add auto-detection of monitored resources on GAE Standard. + +## v0.44.3 + +This is an empty release that was created solely to aid in bigtable's module +carve-out. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository. + +## v0.44.2 + +This is an empty release that was created solely to aid in bigquery's module +carve-out. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository. + +## v0.44.1 + +This is an empty release that was created solely to aid in datastore's module +carve-out. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository. + +## v0.44.0 + +- datastore: + - Interface elements whose underlying types are supported, are now supported. + - Reduce time to initial retry from 1s to 100ms. +- firestore: + - Add Increment transformation. +- storage: + - Allow emulator with STORAGE_EMULATOR_HOST. + - Add methods for HMAC key management. +- pubsub: + - Add PublishCount and PublishLatency measurements. + - Add DefaultPublishViews and DefaultSubscribeViews for convenience of + importing all views. + - Add add Subscription.PushConfig.AuthenticationMethod. +- spanner: + - Allow emulator usage with SPANNER_EMULATOR_HOST. + - Add cloud.google.com/go/spanner/spannertest, a spanner emulator. + - Add cloud.google.com/go/spanner/spansql which contains types and a parser + for the Cloud Spanner SQL dialect. +- asset: + - Add apiv1p2beta1 client. + +## v0.43.0 + +This is an empty release that was created solely to aid in logging's module +carve-out. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository. + +## v0.42.0 + +- bigtable: + - Add an admin method to update an instance and clusters. + - Fix bttest regex matching behavior for alternations (things like `|a`). + - Expose BlockAllFilter filter. +- bigquery: + - Add Routines API support. +- storage: + - Add read-only Bucket.LocationType. +- logging: + - Add TraceSampled to Entry. + - Fix to properly extract {Trace, Span}Id from X-Cloud-Trace-Context. +- pubsub: + - Add Cloud Key Management to TopicConfig. + - Change ExpirationPolicy to optional.Duration. +- automl: + - Add apiv1beta1 client. +- iam: + - Fix compilation problem with iam/credentials/apiv1. + +## v0.41.0 + +- bigtable: + - Check results from PredicateFilter in bttest, which fixes certain false matches. +- profiler: + - debugLog checks user defined logging options before logging. +- spanner: + - PartitionedUpdates respect query parameters. + - StartInstance allows specifying cloud API access scopes. +- bigquery: + - Use empty slice instead of nil for ValueSaver, fixing an issue with zero-length, repeated, nested fields causing panics. +- firestore: + - Return same number of snapshots as doc refs (in the form of duplicate records) during GetAll. +- replay: + - Change references to IPv4 addresses to localhost, making replay compatible with IPv6. + +## v0.40.0 + +- all: + - Update to protobuf-golang v1.3.1. +- datastore: + - Attempt to decode GAE-encoded keys if initial decoding attempt fails. + - Support integer time conversion. +- pubsub: + - Add PublishSettings.BundlerByteLimit. If users receive pubsub.ErrOverflow, + this value should be adjusted higher. + - Use IPv6 compatible target in testutil. +- bigtable: + - Fix Latin-1 regexp filters in bttest, allowing \C. + - Expose PassAllFilter. +- profiler: + - Add log messages for slow path in start. + - Fix start to allow retry until success. +- firestore: + - Add admin client. +- containeranalysis: + - Add apiv1 client. +- grafeas: + - Add apiv1 client. + +## 0.39.0 + +- bigtable: + - Implement DeleteInstance in bttest. + - Return an error on invalid ReadRowsRequest.RowRange key ranges in bttest. +- bigquery: + - Move RequirePartitionFilter outside of TimePartioning. + - Expose models API. +- firestore: + - Allow array values in create and update calls. + - Add CollectionGroup method. +- pubsub: + - Add ExpirationPolicy to Subscription. +- storage: + - Add V4 signing. +- rpcreplay: + - Match streams by first sent request. This further improves rpcreplay's + ability to distinguish streams. +- httpreplay: + - Set up Man-In-The-Middle config only once. This should improve proxy + creation when multiple proxies are used in a single process. + - Remove error on empty Content-Type, allowing requests with no Content-Type + header but a non-empty body. +- all: + - Fix an edge case bug in auto-generated library pagination by properly + propagating pagetoken. + +## 0.38.0 + +This update includes a substantial reduction in our transitive dependency list +by way of updating to opencensus@v0.21.0. + +- spanner: + - Error implements GRPCStatus, allowing status.Convert. +- bigtable: + - Fix a bug in bttest that prevents single column queries returning results + that match other filters. + - Remove verbose retry logging. +- logging: + - Ensure RequestUrl has proper UTF-8, removing the need for users to wrap and + rune replace manually. +- recaptchaenterprise: + - Add v1beta1 client. +- phishingprotection: + - Add v1beta1 client. + +## 0.37.4 + +This patch releases re-builds the go.sum. This was not possible in the +previous release. + +- firestore: + - Add sentinel value DetectProjectID for auto-detecting project ID. + - Add OpenCensus tracing for public methods. + - Marked stable. All future changes come with a backwards compatibility + guarantee. + - Removed firestore/apiv1beta1. All users relying on this low-level library + should migrate to firestore/apiv1. Note that most users should use the + high-level firestore package instead. +- pubsub: + - Allow large messages in synchronous pull case. + - Cap bundler byte limit. This should prevent OOM conditions when there are + a very large number of message publishes occurring. +- storage: + - Add ETag to BucketAttrs and ObjectAttrs. +- datastore: + - Removed some non-sensical OpenCensus traces. +- webrisk: + - Add v1 client. +- asset: + - Add v1 client. +- cloudtasks: + - Add v2 client. + +## 0.37.3 + +This patch release removes github.com/golang/lint from the transitive +dependency list, resolving `go get -u` problems. + +Note: this release intentionally has a broken go.sum. Please use v0.37.4. + +## 0.37.2 + +This patch release is mostly intended to bring in v0.3.0 of +google.golang.org/api, which fixes a GCF deployment issue. + +Note: we had to-date accidentally marked Redis as stable. In this release, we've +fixed it by downgrading its documentation to alpha, as it is in other languages +and docs. + +- all: + - Document context in generated libraries. + +## 0.37.1 + +Small go.mod version bumps to bring in v0.2.0 of google.golang.org/api, which +introduces a new oauth2 url. + +## 0.37.0 + +- spanner: + - Add BatchDML method. + - Reduced initial time between retries. +- bigquery: + - Produce better error messages for InferSchema. + - Add logical type control for avro loads. + - Add support for the GEOGRAPHY type. +- datastore: + - Add sentinel value DetectProjectID for auto-detecting project ID. + - Allow flatten tag on struct pointers. + - Fixed a bug that caused queries to panic with invalid queries. Instead they + will now return an error. +- profiler: + - Add ability to override GCE zone and instance. +- pubsub: + - BEHAVIOR CHANGE: Refactor error code retry logic. RPCs should now more + consistently retry specific error codes based on whether they're idempotent + or non-idempotent. +- httpreplay: Fixed a bug when a non-GET request had a zero-length body causing + the Content-Length header to be dropped. +- iot: + - Add new apiv1 client. +- securitycenter: + - Add new apiv1 client. +- cloudscheduler: + - Add new apiv1 client. + +## 0.36.0 + +- spanner: + - Reduce minimum retry backoff from 1s to 100ms. This makes time between + retries much faster and should improve latency. +- storage: + - Add support for Bucket Policy Only. +- kms: + - Add ResourceIAM helper method. + - Deprecate KeyRingIAM and CryptoKeyIAM. Please use ResourceIAM. +- firestore: + - Switch from v1beta1 API to v1 API. + - Allow emulator with FIRESTORE_EMULATOR_HOST. +- bigquery: + - Add NumLongTermBytes to Table. + - Add TotalBytesProcessedAccuracy to QueryStatistics. +- irm: + - Add new v1alpha2 client. +- talent: + - Add new v4beta1 client. +- rpcreplay: + - Fix connection to work with grpc >= 1.17. + - It is now required for an actual gRPC server to be running for Dial to + succeed. + +## 0.35.1 + +- spanner: + - Adds OpenCensus views back to public API. + +## v0.35.0 + +- all: + - Add go.mod and go.sum. + - Switch usage of gax-go to gax-go/v2. +- bigquery: + - Fix bug where time partitioning could not be removed from a table. + - Fix panic that occurred with empty query parameters. +- bttest: + - Fix bug where deleted rows were returned by ReadRows. +- bigtable/emulator: + - Configure max message size to 256 MiB. +- firestore: + - Allow non-transactional queries in transactions. + - Allow StartAt/EndBefore on direct children at any depth. + - QuerySnapshotIterator.Stop may be called in an error state. + - Fix bug the prevented reset of transaction write state in between retries. +- functions/metadata: + - Make Metadata.Resource a pointer. +- logging: + - Make SpanID available in logging.Entry. +- metadata: + - Wrap !200 error code in a typed err. +- profiler: + - Add function to check if function name is within a particular file in the + profile. + - Set parent field in create profile request. + - Return kubernetes client to start cluster, so client can be used to poll + cluster. + - Add function for checking if filename is in profile. +- pubsub: + - Fix bug where messages expired without an initial modack in + synchronous=true mode. + - Receive does not retry ResourceExhausted errors. +- spanner: + - client.Close now cancels existing requests and should be much faster for + large amounts of sessions. + - Correctly allow MinOpened sessions to be spun up. + +## v0.34.0 + +- functions/metadata: + - Switch to using JSON in context. + - Make Resource a value. +- vision: Fix ProductSearch return type. +- datastore: Add an example for how to handle MultiError. + +## v0.33.1 + +- compute: Removes an erroneously added go.mod. +- logging: Populate source location in fromLogEntry. + +## v0.33.0 + +- bttest: + - Add support for apply_label_transformer. +- expr: + - Add expr library. +- firestore: + - Support retrieval of missing documents. +- kms: + - Add IAM methods. +- pubsub: + - Clarify extension documentation. +- scheduler: + - Add v1beta1 client. +- vision: + - Add product search helper. + - Add new product search client. + +## v0.32.0 + +Note: This release is the last to support Go 1.6 and 1.8. + +- bigquery: + - Add support for removing an expiration. + - Ignore NeverExpire in Table.Create. + - Validate table expiration time. +- cbt: + - Add note about not supporting arbitrary bytes. +- datastore: + - Align key checks. +- firestore: + - Return an error when using Start/End without providing values. +- pubsub: + - Add pstest Close method. + - Clarify MaxExtension documentation. +- securitycenter: + - Add v1beta1 client. +- spanner: + - Allow nil in mutations. + - Improve doc of SessionPoolConfig.MaxOpened. + - Increase session deletion timeout from 5s to 15s. + +## v0.31.0 + +- bigtable: + - Group mutations across multiple requests. +- bigquery: + - Link to bigquery troubleshooting errors page in bigquery.Error comment. +- cbt: + - Fix go generate command. + - Document usage of both maxage + maxversions. +- datastore: + - Passing nil keys results in ErrInvalidKey. +- firestore: + - Clarify what Document.DataTo does with untouched struct fields. +- profile: + - Validate service name in agent. +- pubsub: + - Fix deadlock with pstest and ctx.Cancel. + - Fix a possible deadlock in pstest. +- trace: + - Update doc URL with new fragment. + +Special thanks to @fastest963 for going above and beyond helping us to debug +hard-to-reproduce Pub/Sub issues. + +## v0.30.0 + +- spanner: DML support added. See https://godoc.org/cloud.google.com/go/spanner#hdr-DML_and_Partitioned_DML for more information. +- bigtable: bttest supports row sample filter. +- functions: metadata package added for accessing Cloud Functions resource metadata. + +## v0.29.0 + +- bigtable: + - Add retry to all idempotent RPCs. + - cbt supports complex GC policies. + - Emulator supports arbitrary bytes in regex filters. +- firestore: Add ArrayUnion and ArrayRemove. +- logging: Add the ContextFunc option to supply the context used for + asynchronous RPCs. +- profiler: Ignore NotDefinedError when fetching the instance name +- pubsub: + - BEHAVIOR CHANGE: Receive doesn't retry if an RPC returns codes.Cancelled. + - BEHAVIOR CHANGE: Receive retries on Unavailable intead of returning. + - Fix deadlock. + - Restore Ack/Nack/Modacks metrics. + - Improve context handling in iterator. + - Implement synchronous mode for Receive. + - pstest: add Pull. +- spanner: Add a metric for the number of sessions currently opened. +- storage: + - Canceling the context releases all resources. + - Add additional RetentionPolicy attributes. +- vision/apiv1: Add LocalizeObjects method. + +## v0.28.0 + +- bigtable: + - Emulator returns Unimplemented for snapshot RPCs. +- bigquery: + - Support zero-length repeated, nested fields. +- cloud assets: + - Add v1beta client. +- datastore: + - Don't nil out transaction ID on retry. +- firestore: + - BREAKING CHANGE: When watching a query with Query.Snapshots, QuerySnapshotIterator.Next + returns a QuerySnapshot which contains read time, result size, change list and the DocumentIterator + (previously, QuerySnapshotIterator.Next returned just the DocumentIterator). See: https://godoc.org/cloud.google.com/go/firestore#Query.Snapshots. + - Add array-contains operator. +- IAM: + - Add iam/credentials/apiv1 client. +- pubsub: + - Canceling the context passed to Subscription.Receive causes Receive to return when + processing finishes on all messages currently in progress, even if new messages are arriving. +- redis: + - Add redis/apiv1 client. +- storage: + - Add Reader.Attrs. + - Deprecate several Reader getter methods: please use Reader.Attrs for these instead. + - Add ObjectHandle.Bucket and ObjectHandle.Object methods. + +## v0.27.0 + +- bigquery: + - Allow modification of encryption configuration and partitioning options to a table via the Update call. + - Add a SchemaFromJSON function that converts a JSON table schema. +- bigtable: + - Restore cbt count functionality. +- containeranalysis: + - Add v1beta client. +- spanner: + - Fix a case where an iterator might not be closed correctly. +- storage: + - Add ServiceAccount method https://godoc.org/cloud.google.com/go/storage#Client.ServiceAccount. + - Add a method to Reader that returns the parsed value of the Last-Modified header. + +## v0.26.0 + +- bigquery: + - Support filtering listed jobs by min/max creation time. + - Support data clustering (https://godoc.org/cloud.google.com/go/bigquery#Clustering). + - Include job creator email in Job struct. +- bigtable: + - Add `RowSampleFilter`. + - emulator: BREAKING BEHAVIOR CHANGE: Regexps in row, family, column and value filters + must match the entire target string to succeed. Previously, the emulator was + succeeding on partial matches. + NOTE: As of this release, this change only affects the emulator when run + from this repo (bigtable/cmd/emulator/cbtemulator.go). The version launched + from `gcloud` will be updated in a subsequent `gcloud` release. +- dataproc: Add apiv1beta2 client. +- datastore: Save non-nil pointer fields on omitempty. +- logging: populate Entry.Trace from the HTTP X-Cloud-Trace-Context header. +- logging/logadmin: Support writer_identity and include_children. +- pubsub: + - Support labels on topics and subscriptions. + - Support message storage policy for topics. + - Use the distribution of ack times to determine when to extend ack deadlines. + The only user-visible effect of this change should be that programs that + call only `Subscription.Receive` need no IAM permissions other than `Pub/Sub + Subscriber`. +- storage: + - Support predefined ACLs. + - Support additional ACL fields other than Entity and Role. + - Support bucket websites. + - Support bucket logging. + + +## v0.25.0 + +- Added [Code of Conduct](https://github.com/googleapis/google-cloud-go/blob/master/CODE_OF_CONDUCT.md) +- bigtable: + - cbt: Support a GC policy of "never". +- errorreporting: + - Support User. + - Close now calls Flush. + - Use OnError (previously ignored). + - Pass through the RPC error as-is to OnError. +- httpreplay: A tool for recording and replaying HTTP requests + (for the bigquery and storage clients in this repo). +- kms: v1 client added +- logging: add SourceLocation to Entry. +- storage: improve CRC checking on read. + +## v0.24.0 + +- bigquery: Support for the NUMERIC type. +- bigtable: + - cbt: Optionally specify columns for read/lookup + - Support instance-level administration. +- oslogin: New client for the OS Login API. +- pubsub: + - The package is now stable. There will be no further breaking changes. + - Internal changes to improve Subscription.Receive behavior. +- storage: Support updating bucket lifecycle config. +- spanner: Support struct-typed parameter bindings. +- texttospeech: New client for the Text-to-Speech API. + +## v0.23.0 + +- bigquery: Add DDL stats to query statistics. +- bigtable: + - cbt: Add cells-per-column limit for row lookup. + - cbt: Make it possible to combine read filters. +- dlp: v2beta2 client removed. Use the v2 client instead. +- firestore, spanner: Fix compilation errors due to protobuf changes. + +## v0.22.0 + +- bigtable: + - cbt: Support cells per column limit for row read. + - bttest: Correctly handle empty RowSet. + - Fix ReadModifyWrite operation in emulator. + - Fix API path in GetCluster. + +- bigquery: + - BEHAVIOR CHANGE: Retry on 503 status code. + - Add dataset.DeleteWithContents. + - Add SchemaUpdateOptions for query jobs. + - Add Timeline to QueryStatistics. + - Add more stats to ExplainQueryStage. + - Support Parquet data format. + +- datastore: + - Support omitempty for times. + +- dlp: + - **BREAKING CHANGE:** Remove v1beta1 client. Please migrate to the v2 client, + which is now out of beta. + - Add v2 client. + +- firestore: + - BEHAVIOR CHANGE: Treat set({}, MergeAll) as valid. + +- iam: + - Support JWT signing via SignJwt callopt. + +- profiler: + - BEHAVIOR CHANGE: PollForSerialOutput returns an error when context.Done. + - BEHAVIOR CHANGE: Increase the initial backoff to 1 minute. + - Avoid returning empty serial port output. + +- pubsub: + - BEHAVIOR CHANGE: Don't backoff during next retryable error once stream is healthy. + - BEHAVIOR CHANGE: Don't backoff on EOF. + - pstest: Support Acknowledge and ModifyAckDeadline RPCs. + +- redis: + - Add v1 beta Redis client. + +- spanner: + - Support SessionLabels. + +- speech: + - Add api v1 beta1 client. + +- storage: + - BEHAVIOR CHANGE: Retry reads when retryable error occurs. + - Fix delete of object in requester-pays bucket. + - Support KMS integration. + +## v0.21.0 + +- bigquery: + - Add OpenCensus tracing. + +- firestore: + - **BREAKING CHANGE:** If a document does not exist, return a DocumentSnapshot + whose Exists method returns false. DocumentRef.Get and Transaction.Get + return the non-nil DocumentSnapshot in addition to a NotFound error. + **DocumentRef.GetAll and Transaction.GetAll return a non-nil + DocumentSnapshot instead of nil.** + - Add DocumentIterator.Stop. **Call Stop whenever you are done with a + DocumentIterator.** + - Added Query.Snapshots and DocumentRef.Snapshots, which provide realtime + notification of updates. See https://cloud.google.com/firestore/docs/query-data/listen. + - Canceling an RPC now always returns a grpc.Status with codes.Canceled. + +- spanner: + - Add `CommitTimestamp`, which supports inserting the commit timestamp of a + transaction into a column. + +## v0.20.0 + +- bigquery: Support SchemaUpdateOptions for load jobs. + +- bigtable: + - Add SampleRowKeys. + - cbt: Support union, intersection GCPolicy. + - Retry admin RPCS. + - Add trace spans to retries. + +- datastore: Add OpenCensus tracing. + +- firestore: + - Fix queries involving Null and NaN. + - Allow Timestamp protobuffers for time values. + +- logging: Add a WriteTimeout option. + +- spanner: Support Batch API. + +- storage: Add OpenCensus tracing. + +## v0.19.0 + +- bigquery: + - Support customer-managed encryption keys. + +- bigtable: + - Improved emulator support. + - Support GetCluster. + +- datastore: + - Add general mutations. + - Support pointer struct fields. + - Support transaction options. + +- firestore: + - Add Transaction.GetAll. + - Support document cursors. + +- logging: + - Support concurrent RPCs to the service. + - Support per-entry resources. + +- profiler: + - Add config options to disable heap and thread profiling. + - Read the project ID from $GOOGLE_CLOUD_PROJECT when it's set. + +- pubsub: + - BEHAVIOR CHANGE: Release flow control after ack/nack (instead of after the + callback returns). + - Add SubscriptionInProject. + - Add OpenCensus instrumentation for streaming pull. + +- storage: + - Support CORS. + +## v0.18.0 + +- bigquery: + - Marked stable. + - Schema inference of nullable fields supported. + - Added TimePartitioning to QueryConfig. + +- firestore: Data provided to DocumentRef.Set with a Merge option can contain + Delete sentinels. + +- logging: Clients can accept parent resources other than projects. + +- pubsub: + - pubsub/pstest: A lighweight fake for pubsub. Experimental; feedback welcome. + - Support updating more subscription metadata: AckDeadline, + RetainAckedMessages and RetentionDuration. + +- oslogin/apiv1beta: New client for the Cloud OS Login API. + +- rpcreplay: A package for recording and replaying gRPC traffic. + +- spanner: + - Add a ReadWithOptions that supports a row limit, as well as an index. + - Support query plan and execution statistics. + - Added [OpenCensus](http://opencensus.io) support. + +- storage: Clarify checksum validation for gzipped files (it is not validated + when the file is served uncompressed). + + +## v0.17.0 + +- firestore BREAKING CHANGES: + - Remove UpdateMap and UpdateStruct; rename UpdatePaths to Update. + Change + `docref.UpdateMap(ctx, map[string]interface{}{"a.b", 1})` + to + `docref.Update(ctx, []firestore.Update{{Path: "a.b", Value: 1}})` + + Change + `docref.UpdateStruct(ctx, []string{"Field"}, aStruct)` + to + `docref.Update(ctx, []firestore.Update{{Path: "Field", Value: aStruct.Field}})` + - Rename MergePaths to Merge; require args to be FieldPaths + - A value stored as an integer can be read into a floating-point field, and vice versa. +- bigtable/cmd/cbt: + - Support deleting a column. + - Add regex option for row read. +- spanner: Mark stable. +- storage: + - Add Reader.ContentEncoding method. + - Fix handling of SignedURL headers. +- bigquery: + - If Uploader.Put is called with no rows, it returns nil without making a + call. + - Schema inference supports the "nullable" option in struct tags for + non-required fields. + - TimePartitioning supports "Field". + + +## v0.16.0 + +- Other bigquery changes: + - `JobIterator.Next` returns `*Job`; removed `JobInfo` (BREAKING CHANGE). + - UseStandardSQL is deprecated; set UseLegacySQL to true if you need + Legacy SQL. + - Uploader.Put will generate a random insert ID if you do not provide one. + - Support time partitioning for load jobs. + - Support dry-run queries. + - A `Job` remembers its last retrieved status. + - Support retrieving job configuration. + - Support labels for jobs and tables. + - Support dataset access lists. + - Improve support for external data sources, including data from Bigtable and + Google Sheets, and tables with external data. + - Support updating a table's view configuration. + - Fix uploading civil times with nanoseconds. + +- storage: + - Support PubSub notifications. + - Support Requester Pays buckets. + +- profiler: Support goroutine and mutex profile types. + +## v0.15.0 + +- firestore: beta release. See the + [announcement](https://firebase.googleblog.com/2017/10/introducing-cloud-firestore.html). + +- errorreporting: The existing package has been redesigned. + +- errors: This package has been removed. Use errorreporting. + + +## v0.14.0 + +- bigquery BREAKING CHANGES: + - Standard SQL is the default for queries and views. + - `Table.Create` takes `TableMetadata` as a second argument, instead of + options. + - `Dataset.Create` takes `DatasetMetadata` as a second argument. + - `DatasetMetadata` field `ID` renamed to `FullID` + - `TableMetadata` field `ID` renamed to `FullID` + +- Other bigquery changes: + - The client will append a random suffix to a provided job ID if you set + `AddJobIDSuffix` to true in a job config. + - Listing jobs is supported. + - Better retry logic. + +- vision, language, speech: clients are now stable + +- monitoring: client is now beta + +- profiler: + - Rename InstanceName to Instance, ZoneName to Zone + - Auto-detect service name and version on AppEngine. + +## v0.13.0 + +- bigquery: UseLegacySQL options for CreateTable and QueryConfig. Use these + options to continue using Legacy SQL after the client switches its default + to Standard SQL. + +- bigquery: Support for updating dataset labels. + +- bigquery: Set DatasetIterator.ProjectID to list datasets in a project other + than the client's. DatasetsInProject is no longer needed and is deprecated. + +- bigtable: Fail ListInstances when any zones fail. + +- spanner: support decoding of slices of basic types (e.g. []string, []int64, + etc.) + +- logging/logadmin: UpdateSink no longer creates a sink if it is missing + (actually a change to the underlying service, not the client) + +- profiler: Service and ServiceVersion replace Target in Config. + +## v0.12.0 + +- pubsub: Subscription.Receive now uses streaming pull. + +- pubsub: add Client.TopicInProject to access topics in a different project + than the client. + +- errors: renamed errorreporting. The errors package will be removed shortly. + +- datastore: improved retry behavior. + +- bigquery: support updates to dataset metadata, with etags. + +- bigquery: add etag support to Table.Update (BREAKING: etag argument added). + +- bigquery: generate all job IDs on the client. + +- storage: support bucket lifecycle configurations. + + +## v0.11.0 + +- Clients for spanner, pubsub and video are now in beta. + +- New client for DLP. + +- spanner: performance and testing improvements. + +- storage: requester-pays buckets are supported. + +- storage, profiler, bigtable, bigquery: bug fixes and other minor improvements. + +- pubsub: bug fixes and other minor improvements + +## v0.10.0 + +- pubsub: Subscription.ModifyPushConfig replaced with Subscription.Update. + +- pubsub: Subscription.Receive now runs concurrently for higher throughput. + +- vision: cloud.google.com/go/vision is deprecated. Use +cloud.google.com/go/vision/apiv1 instead. + +- translation: now stable. + +- trace: several changes to the surface. See the link below. + +### Code changes required from v0.9.0 + +- pubsub: Replace + + ``` + sub.ModifyPushConfig(ctx, pubsub.PushConfig{Endpoint: "https://example.com/push"}) + ``` + + with + + ``` + sub.Update(ctx, pubsub.SubscriptionConfigToUpdate{ + PushConfig: &pubsub.PushConfig{Endpoint: "https://example.com/push"}, + }) + ``` + +- trace: traceGRPCServerInterceptor will be provided from *trace.Client. +Given an initialized `*trace.Client` named `tc`, instead of + + ``` + s := grpc.NewServer(grpc.UnaryInterceptor(trace.GRPCServerInterceptor(tc))) + ``` + + write + + ``` + s := grpc.NewServer(grpc.UnaryInterceptor(tc.GRPCServerInterceptor())) + ``` + +- trace trace.GRPCClientInterceptor will also provided from *trace.Client. +Instead of + + ``` + conn, err := grpc.Dial(srv.Addr, grpc.WithUnaryInterceptor(trace.GRPCClientInterceptor())) + ``` + + write + + ``` + conn, err := grpc.Dial(srv.Addr, grpc.WithUnaryInterceptor(tc.GRPCClientInterceptor())) + ``` + +- trace: We removed the deprecated `trace.EnableGRPCTracing`. Use the gRPC +interceptor as a dial option as shown below when initializing Cloud package +clients: + + ``` + c, err := pubsub.NewClient(ctx, "project-id", option.WithGRPCDialOption(grpc.WithUnaryInterceptor(tc.GRPCClientInterceptor()))) + if err != nil { + ... + } + ``` + + +## v0.9.0 + +- Breaking changes to some autogenerated clients. +- rpcreplay package added. + +## v0.8.0 + +- profiler package added. +- storage: + - Retry Objects.Insert call. + - Add ProgressFunc to WRiter. +- pubsub: breaking changes: + - Publish is now asynchronous ([announcement](https://groups.google.com/d/topic/google-api-go-announce/aaqRDIQ3rvU/discussion)). + - Subscription.Pull replaced by Subscription.Receive, which takes a callback ([announcement](https://groups.google.com/d/topic/google-api-go-announce/8pt6oetAdKc/discussion)). + - Message.Done replaced with Message.Ack and Message.Nack. + +## v0.7.0 + +- Release of a client library for Spanner. See +the +[blog +post](https://cloudplatform.googleblog.com/2017/02/introducing-Cloud-Spanner-a-global-database-service-for-mission-critical-applications.html). +Note that although the Spanner service is beta, the Go client library is alpha. + +## v0.6.0 + +- Beta release of BigQuery, DataStore, Logging and Storage. See the +[blog post](https://cloudplatform.googleblog.com/2016/12/announcing-new-google-cloud-client.html). + +- bigquery: + - struct support. Read a row directly into a struct with +`RowIterator.Next`, and upload a row directly from a struct with `Uploader.Put`. +You can also use field tags. See the [package documentation][cloud-bigquery-ref] +for details. + + - The `ValueList` type was removed. It is no longer necessary. Instead of + ```go + var v ValueList + ... it.Next(&v) .. + ``` + use + + ```go + var v []Value + ... it.Next(&v) ... + ``` + + - Previously, repeatedly calling `RowIterator.Next` on the same `[]Value` or + `ValueList` would append to the slice. Now each call resets the size to zero first. + + - Schema inference will infer the SQL type BYTES for a struct field of + type []byte. Previously it inferred STRING. + + - The types `uint`, `uint64` and `uintptr` are no longer supported in schema + inference. BigQuery's integer type is INT64, and those types may hold values + that are not correctly represented in a 64-bit signed integer. + +## v0.5.0 + +- bigquery: + - The SQL types DATE, TIME and DATETIME are now supported. They correspond to + the `Date`, `Time` and `DateTime` types in the new `cloud.google.com/go/civil` + package. + - Support for query parameters. + - Support deleting a dataset. + - Values from INTEGER columns will now be returned as int64, not int. This + will avoid errors arising from large values on 32-bit systems. +- datastore: + - Nested Go structs encoded as Entity values, instead of a +flattened list of the embedded struct's fields. This means that you may now have twice-nested slices, eg. + ```go + type State struct { + Cities []struct{ + Populations []int + } + } + ``` + See [the announcement](https://groups.google.com/forum/#!topic/google-api-go-announce/79jtrdeuJAg) for +more details. + - Contexts no longer hold namespaces; instead you must set a key's namespace + explicitly. Also, key functions have been changed and renamed. + - The WithNamespace function has been removed. To specify a namespace in a Query, use the Query.Namespace method: + ```go + q := datastore.NewQuery("Kind").Namespace("ns") + ``` + - All the fields of Key are exported. That means you can construct any Key with a struct literal: + ```go + k := &Key{Kind: "Kind", ID: 37, Namespace: "ns"} + ``` + - As a result of the above, the Key methods Kind, ID, d.Name, Parent, SetParent and Namespace have been removed. + - `NewIncompleteKey` has been removed, replaced by `IncompleteKey`. Replace + ```go + NewIncompleteKey(ctx, kind, parent) + ``` + with + ```go + IncompleteKey(kind, parent) + ``` + and if you do use namespaces, make sure you set the namespace on the returned key. + - `NewKey` has been removed, replaced by `NameKey` and `IDKey`. Replace + ```go + NewKey(ctx, kind, name, 0, parent) + NewKey(ctx, kind, "", id, parent) + ``` + with + ```go + NameKey(kind, name, parent) + IDKey(kind, id, parent) + ``` + and if you do use namespaces, make sure you set the namespace on the returned key. + - The `Done` variable has been removed. Replace `datastore.Done` with `iterator.Done`, from the package `google.golang.org/api/iterator`. + - The `Client.Close` method will have a return type of error. It will return the result of closing the underlying gRPC connection. + - See [the announcement](https://groups.google.com/forum/#!topic/google-api-go-announce/hqXtM_4Ix-0) for +more details. + +## v0.4.0 + +- bigquery: + -`NewGCSReference` is now a function, not a method on `Client`. + - `Table.LoaderFrom` now accepts a `ReaderSource`, enabling + loading data into a table from a file or any `io.Reader`. + * Client.Table and Client.OpenTable have been removed. + Replace + ```go + client.OpenTable("project", "dataset", "table") + ``` + with + ```go + client.DatasetInProject("project", "dataset").Table("table") + ``` + + * Client.CreateTable has been removed. + Replace + ```go + client.CreateTable(ctx, "project", "dataset", "table") + ``` + with + ```go + client.DatasetInProject("project", "dataset").Table("table").Create(ctx) + ``` + + * Dataset.ListTables have been replaced with Dataset.Tables. + Replace + ```go + tables, err := ds.ListTables(ctx) + ``` + with + ```go + it := ds.Tables(ctx) + for { + table, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: use table. + } + ``` + + * Client.Read has been replaced with Job.Read, Table.Read and Query.Read. + Replace + ```go + it, err := client.Read(ctx, job) + ``` + with + ```go + it, err := job.Read(ctx) + ``` + and similarly for reading from tables or queries. + + * The iterator returned from the Read methods is now named RowIterator. Its + behavior is closer to the other iterators in these libraries. It no longer + supports the Schema method; see the next item. + Replace + ```go + for it.Next(ctx) { + var vals ValueList + if err := it.Get(&vals); err != nil { + // TODO: Handle error. + } + // TODO: use vals. + } + if err := it.Err(); err != nil { + // TODO: Handle error. + } + ``` + with + ``` + for { + var vals ValueList + err := it.Next(&vals) + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: use vals. + } + ``` + Instead of the `RecordsPerRequest(n)` option, write + ```go + it.PageInfo().MaxSize = n + ``` + Instead of the `StartIndex(i)` option, write + ```go + it.StartIndex = i + ``` + + * ValueLoader.Load now takes a Schema in addition to a slice of Values. + Replace + ```go + func (vl *myValueLoader) Load(v []bigquery.Value) + ``` + with + ```go + func (vl *myValueLoader) Load(v []bigquery.Value, s bigquery.Schema) + ``` + + + * Table.Patch is replace by Table.Update. + Replace + ```go + p := table.Patch() + p.Description("new description") + metadata, err := p.Apply(ctx) + ``` + with + ```go + metadata, err := table.Update(ctx, bigquery.TableMetadataToUpdate{ + Description: "new description", + }) + ``` + + * Client.Copy is replaced by separate methods for each of its four functions. + All options have been replaced by struct fields. + + * To load data from Google Cloud Storage into a table, use Table.LoaderFrom. + + Replace + ```go + client.Copy(ctx, table, gcsRef) + ``` + with + ```go + table.LoaderFrom(gcsRef).Run(ctx) + ``` + Instead of passing options to Copy, set fields on the Loader: + ```go + loader := table.LoaderFrom(gcsRef) + loader.WriteDisposition = bigquery.WriteTruncate + ``` + + * To extract data from a table into Google Cloud Storage, use + Table.ExtractorTo. Set fields on the returned Extractor instead of + passing options. + + Replace + ```go + client.Copy(ctx, gcsRef, table) + ``` + with + ```go + table.ExtractorTo(gcsRef).Run(ctx) + ``` + + * To copy data into a table from one or more other tables, use + Table.CopierFrom. Set fields on the returned Copier instead of passing options. + + Replace + ```go + client.Copy(ctx, dstTable, srcTable) + ``` + with + ```go + dst.Table.CopierFrom(srcTable).Run(ctx) + ``` + + * To start a query job, create a Query and call its Run method. Set fields + on the query instead of passing options. + + Replace + ```go + client.Copy(ctx, table, query) + ``` + with + ```go + query.Run(ctx) + ``` + + * Table.NewUploader has been renamed to Table.Uploader. Instead of options, + configure an Uploader by setting its fields. + Replace + ```go + u := table.NewUploader(bigquery.UploadIgnoreUnknownValues()) + ``` + with + ```go + u := table.NewUploader(bigquery.UploadIgnoreUnknownValues()) + u.IgnoreUnknownValues = true + ``` + +- pubsub: remove `pubsub.Done`. Use `iterator.Done` instead, where `iterator` is the package +`google.golang.org/api/iterator`. + +## v0.3.0 + +- storage: + * AdminClient replaced by methods on Client. + Replace + ```go + adminClient.CreateBucket(ctx, bucketName, attrs) + ``` + with + ```go + client.Bucket(bucketName).Create(ctx, projectID, attrs) + ``` + + * BucketHandle.List replaced by BucketHandle.Objects. + Replace + ```go + for query != nil { + objs, err := bucket.List(d.ctx, query) + if err != nil { ... } + query = objs.Next + for _, obj := range objs.Results { + fmt.Println(obj) + } + } + ``` + with + ```go + iter := bucket.Objects(d.ctx, query) + for { + obj, err := iter.Next() + if err == iterator.Done { + break + } + if err != nil { ... } + fmt.Println(obj) + } + ``` + (The `iterator` package is at `google.golang.org/api/iterator`.) + + Replace `Query.Cursor` with `ObjectIterator.PageInfo().Token`. + + Replace `Query.MaxResults` with `ObjectIterator.PageInfo().MaxSize`. + + + * ObjectHandle.CopyTo replaced by ObjectHandle.CopierFrom. + Replace + ```go + attrs, err := src.CopyTo(ctx, dst, nil) + ``` + with + ```go + attrs, err := dst.CopierFrom(src).Run(ctx) + ``` + + Replace + ```go + attrs, err := src.CopyTo(ctx, dst, &storage.ObjectAttrs{ContextType: "text/html"}) + ``` + with + ```go + c := dst.CopierFrom(src) + c.ContextType = "text/html" + attrs, err := c.Run(ctx) + ``` + + * ObjectHandle.ComposeFrom replaced by ObjectHandle.ComposerFrom. + Replace + ```go + attrs, err := dst.ComposeFrom(ctx, []*storage.ObjectHandle{src1, src2}, nil) + ``` + with + ```go + attrs, err := dst.ComposerFrom(src1, src2).Run(ctx) + ``` + + * ObjectHandle.Update's ObjectAttrs argument replaced by ObjectAttrsToUpdate. + Replace + ```go + attrs, err := obj.Update(ctx, &storage.ObjectAttrs{ContextType: "text/html"}) + ``` + with + ```go + attrs, err := obj.Update(ctx, storage.ObjectAttrsToUpdate{ContextType: "text/html"}) + ``` + + * ObjectHandle.WithConditions replaced by ObjectHandle.If. + Replace + ```go + obj.WithConditions(storage.Generation(gen), storage.IfMetaGenerationMatch(mgen)) + ``` + with + ```go + obj.Generation(gen).If(storage.Conditions{MetagenerationMatch: mgen}) + ``` + + Replace + ```go + obj.WithConditions(storage.IfGenerationMatch(0)) + ``` + with + ```go + obj.If(storage.Conditions{DoesNotExist: true}) + ``` + + * `storage.Done` replaced by `iterator.Done` (from package `google.golang.org/api/iterator`). + +- Package preview/logging deleted. Use logging instead. + +## v0.2.0 + +- Logging client replaced with preview version (see below). + +- New clients for some of Google's Machine Learning APIs: Vision, Speech, and +Natural Language. + +- Preview version of a new [Stackdriver Logging][cloud-logging] client in +[`cloud.google.com/go/preview/logging`](https://godoc.org/cloud.google.com/go/preview/logging). +This client uses gRPC as its transport layer, and supports log reading, sinks +and metrics. It will replace the current client at `cloud.google.com/go/logging` shortly. + + diff --git a/vendor/cloud.google.com/go/CODE_OF_CONDUCT.md b/vendor/cloud.google.com/go/CODE_OF_CONDUCT.md new file mode 100644 index 000000000000..8fd1bc9c22bd --- /dev/null +++ b/vendor/cloud.google.com/go/CODE_OF_CONDUCT.md @@ -0,0 +1,44 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, +and in the interest of fostering an open and welcoming community, +we pledge to respect all people who contribute through reporting issues, +posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. + +We are committed to making participation in this project +a harassment-free experience for everyone, +regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, +such as physical or electronic +addresses, without explicit permission +* Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct. +By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently +applying these principles to every aspect of managing this project. +Project maintainers who do not follow or enforce the Code of Conduct +may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by opening an issue +or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) + diff --git a/vendor/cloud.google.com/go/CONTRIBUTING.md b/vendor/cloud.google.com/go/CONTRIBUTING.md new file mode 100644 index 000000000000..85ed4dfd250c --- /dev/null +++ b/vendor/cloud.google.com/go/CONTRIBUTING.md @@ -0,0 +1,301 @@ +# Contributing + +1. [Install Go](https://golang.org/dl/). + 1. Ensure that your `GOBIN` directory (by default `$(go env GOPATH)/bin`) + is in your `PATH`. + 1. Check it's working by running `go version`. + * If it doesn't work, check the install location, usually + `/usr/local/go`, is on your `PATH`. + +1. Sign one of the +[contributor license agreements](#contributor-license-agreements) below. + +1. Run `GO111MODULE=off go get golang.org/x/review/git-codereview` to install +the code reviewing tool. + + 1. Ensure it's working by running `git codereview` (check your `PATH` if + not). + + 1. If you would like, you may want to set up aliases for `git-codereview`, + such that `git codereview change` becomes `git change`. See the + [godoc](https://godoc.org/golang.org/x/review/git-codereview) for details. + + * Should you run into issues with the `git-codereview` tool, please note + that all error messages will assume that you have set up these aliases. + +1. Change to a directory of your choosing and clone the repo.b + + ``` + cd ~/code + git clone https://code.googlesource.com/gocloud + ``` + + * If you have already checked out the source, make sure that the remote + `git` `origin` is https://code.googlesource.com/gocloud: + + ``` + git remote -v + # ... + git remote set-url origin https://code.googlesource.com/gocloud + ``` + + * The project uses [Go Modules](https://blog.golang.org/using-go-modules) + for dependency management See + [`gopls`](https://github.com/golang/go/wiki/gopls) for making your editor + work with modules. + +1. Change to the project directory: + + ``` + cd ~/code/gocloud + ``` + +1. Make sure your `git` auth is configured correctly by visiting +https://code.googlesource.com, clicking "Generate Password" at the top-right, +and following the directions. Otherwise, `git codereview mail` in the next step +will fail. + +1. Make changes then use `git codereview` to create a commit and create a Gerrit +CL: + + ``` + git codereview change + # Make changes. + git add ... + git codereview change + git codereview mail # If this fails, the error message will contain instructions to fix it. + ``` + + * This will create a new `git` branch for you to develop on. Once your + change is merged, you can delete this branch. + +1. As you make changes for code review, ammend the commit and re-mail the +change: + + ``` + # Make more changes. + git add ... + git codereview change + git codereview mail + ``` + + * **Warning**: do not change the `Change-Id` at the bottom of the commit + message - it's how Gerrit knows which change this is (or if it's new). + + * When you fixes issues from code review, respond to each code review + message then click **Reply** at the top of the page. + + * Each new mailed amendment will create a new patch set for + your change in Gerrit. Patch sets can be compared and reviewed. + + * **Note**: if your change includes a breaking change, our breaking change + detector will cause CI/CD to fail. If your breaking change is acceptable + in some way, add a `BREAKING_CHANGE_ACCEPTABLE=` line to the commit + message to cause the detector not to be run and to make it clear why that is + acceptable. + +## Integration Tests + +In addition to the unit tests, you may run the integration test suite. These +directions describe setting up your environment to run integration tests for +_all_ packages: note that many of these instructions may be redundant if you +intend only to run integration tests on a single package. + +#### GCP Setup + +To run the integrations tests, creation and configuration of two projects in +the Google Developers Console is required: one specifically for Firestore +integration tests, and another for all other integration tests. We'll refer to +these projects as "general project" and "Firestore project". + +After creating each project, you must [create a service account](https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount) +for each project. Ensure the project-level **Owner** +[IAM role](console.cloud.google.com/iam-admin/iam/project) role is added to +each service account. During the creation of the service account, you should +download the JSON credential file for use later. + +Next, ensure the following APIs are enabled in the general project: + +- BigQuery API +- BigQuery Data Transfer API +- Cloud Dataproc API +- Cloud Dataproc Control API Private +- Cloud Datastore API +- Cloud Firestore API +- Cloud Key Management Service (KMS) API +- Cloud Natural Language API +- Cloud OS Login API +- Cloud Pub/Sub API +- Cloud Resource Manager API +- Cloud Spanner API +- Cloud Speech API +- Cloud Translation API +- Cloud Video Intelligence API +- Cloud Vision API +- Compute Engine API +- Compute Engine Instance Group Manager API +- Container Registry API +- Firebase Rules API +- Google Cloud APIs +- Google Cloud Deployment Manager V2 API +- Google Cloud SQL +- Google Cloud Storage +- Google Cloud Storage JSON API +- Google Compute Engine Instance Group Updater API +- Google Compute Engine Instance Groups API +- Kubernetes Engine API +- Stackdriver Error Reporting API + +Next, create a Datastore database in the general project, and a Firestore +database in the Firestore project. + +Finally, in the general project, create an API key for the translate API: + +- Go to GCP Developer Console. +- Navigate to APIs & Services > Credentials. +- Click Create Credentials > API Key. +- Save this key for use in `GCLOUD_TESTS_API_KEY` as described below. + +#### Local Setup + +Once the two projects are created and configured, set the following environment +variables: + +- `GCLOUD_TESTS_GOLANG_PROJECT_ID`: Developers Console project's ID (e.g. +bamboo-shift-455) for the general project. +- `GCLOUD_TESTS_GOLANG_KEY`: The path to the JSON key file of the general +project's service account. +- `GCLOUD_TESTS_GOLANG_FIRESTORE_PROJECT_ID`: Developers Console project's ID +(e.g. doorway-cliff-677) for the Firestore project. +- `GCLOUD_TESTS_GOLANG_FIRESTORE_KEY`: The path to the JSON key file of the +Firestore project's service account. +- `GCLOUD_TESTS_GOLANG_KEYRING`: The full name of the keyring for the tests, +in the form +"projects/P/locations/L/keyRings/R". The creation of this is described below. +- `GCLOUD_TESTS_API_KEY`: API key for using the Translate API. +- `GCLOUD_TESTS_GOLANG_ZONE`: Compute Engine zone. + +Install the [gcloud command-line tool][gcloudcli] to your machine and use it to +create some resources used in integration tests. + +From the project's root directory: + +``` sh +# Sets the default project in your env. +$ gcloud config set project $GCLOUD_TESTS_GOLANG_PROJECT_ID + +# Authenticates the gcloud tool with your account. +$ gcloud auth login + +# Create the indexes used in the datastore integration tests. +$ gcloud datastore indexes create datastore/testdata/index.yaml + +# Creates a Google Cloud storage bucket with the same name as your test project, +# and with the Stackdriver Logging service account as owner, for the sink +# integration tests in logging. +$ gsutil mb gs://$GCLOUD_TESTS_GOLANG_PROJECT_ID +$ gsutil acl ch -g cloud-logs@google.com:O gs://$GCLOUD_TESTS_GOLANG_PROJECT_ID + +# Creates a PubSub topic for integration tests of storage notifications. +$ gcloud beta pubsub topics create go-storage-notification-test +# Next, go to the Pub/Sub dashboard in GCP console. Authorize the user +# "service-@gs-project-accounts.iam.gserviceaccount.com" +# as a publisher to that topic. + +# Creates a Spanner instance for the spanner integration tests. +$ gcloud beta spanner instances create go-integration-test --config regional-us-central1 --nodes 10 --description 'Instance for go client test' +# NOTE: Spanner instances are priced by the node-hour, so you may want to +# delete the instance after testing with 'gcloud beta spanner instances delete'. + +$ export MY_KEYRING=some-keyring-name +$ export MY_LOCATION=global +# Creates a KMS keyring, in the same location as the default location for your +# project's buckets. +$ gcloud kms keyrings create $MY_KEYRING --location $MY_LOCATION +# Creates two keys in the keyring, named key1 and key2. +$ gcloud kms keys create key1 --keyring $MY_KEYRING --location $MY_LOCATION --purpose encryption +$ gcloud kms keys create key2 --keyring $MY_KEYRING --location $MY_LOCATION --purpose encryption +# Sets the GCLOUD_TESTS_GOLANG_KEYRING environment variable. +$ export GCLOUD_TESTS_GOLANG_KEYRING=projects/$GCLOUD_TESTS_GOLANG_PROJECT_ID/locations/$MY_LOCATION/keyRings/$MY_KEYRING +# Authorizes Google Cloud Storage to encrypt and decrypt using key1. +gsutil kms authorize -p $GCLOUD_TESTS_GOLANG_PROJECT_ID -k $GCLOUD_TESTS_GOLANG_KEYRING/cryptoKeys/key1 +``` + +#### Running + +Once you've done the necessary setup, you can run the integration tests by +running: + +``` sh +$ go test -v cloud.google.com/go/... +``` + +#### Replay + +Some packages can record the RPCs during integration tests to a file for +subsequent replay. To record, pass the `-record` flag to `go test`. The +recording will be saved to the _package_`.replay` file. To replay integration +tests from a saved recording, the replay file must be present, the `-short` +flag must be passed to `go test`, and the `GCLOUD_TESTS_GOLANG_ENABLE_REPLAY` +environment variable must have a non-empty value. + +## Contributor License Agreements + +Before we can accept your pull requests you'll need to sign a Contributor +License Agreement (CLA): + +- **If you are an individual writing original source code** and **you own the +intellectual property**, then you'll need to sign an [individual CLA][indvcla]. +- **If you work for a company that wants to allow you to contribute your +work**, then you'll need to sign a [corporate CLA][corpcla]. + +You can sign these electronically (just scroll to the bottom). After that, +we'll be able to accept your pull requests. + +## Contributor Code of Conduct + +As contributors and maintainers of this project, +and in the interest of fostering an open and welcoming community, +we pledge to respect all people who contribute through reporting issues, +posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. + +We are committed to making participation in this project +a harassment-free experience for everyone, +regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, +such as physical or electronic +addresses, without explicit permission +* Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct. +By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently +applying these principles to every aspect of managing this project. +Project maintainers who do not follow or enforce the Code of Conduct +may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by opening an issue +or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) + +[gcloudcli]: https://developers.google.com/cloud/sdk/gcloud/ +[indvcla]: https://developers.google.com/open-source/cla/individual +[corpcla]: https://developers.google.com/open-source/cla/corporate diff --git a/vendor/cloud.google.com/go/README.md b/vendor/cloud.google.com/go/README.md new file mode 100644 index 000000000000..f3a0c3c5e8fc --- /dev/null +++ b/vendor/cloud.google.com/go/README.md @@ -0,0 +1,227 @@ +# Google Cloud Client Libraries for Go + +[![GoDoc](https://godoc.org/cloud.google.com/go?status.svg)](https://godoc.org/cloud.google.com/go) + +Go packages for [Google Cloud Platform](https://cloud.google.com) services. + +``` go +import "cloud.google.com/go" +``` + +To install the packages on your system, *do not clone the repo*. Instead use + +``` +$ go get -u cloud.google.com/go/... +``` + +**NOTE:** Some of these packages are under development, and may occasionally +make backwards-incompatible changes. + +**NOTE:** Github repo is a mirror of [https://code.googlesource.com/gocloud](https://code.googlesource.com/gocloud). + +## Supported APIs + +Google API | Status | Package +------------------------------------------------|--------------|----------------------------------------------------------- +[Asset][cloud-asset] | alpha | [`cloud.google.com/go/asset/v1beta`][cloud-asset-ref] +[BigQuery][cloud-bigquery] | stable | [`cloud.google.com/go/bigquery`][cloud-bigquery-ref] +[Bigtable][cloud-bigtable] | stable | [`cloud.google.com/go/bigtable`][cloud-bigtable-ref] +[Cloudtasks][cloud-tasks] | stable | [`cloud.google.com/go/cloudtasks/apiv2`][cloud-tasks-ref] +[Container][cloud-container] | stable | [`cloud.google.com/go/container/apiv1`][cloud-container-ref] +[ContainerAnalysis][cloud-containeranalysis] | beta | [`cloud.google.com/go/containeranalysis/apiv1beta1`][cloud-containeranalysis-ref] +[Dataproc][cloud-dataproc] | stable | [`cloud.google.com/go/dataproc/apiv1`][cloud-dataproc-ref] +[Datastore][cloud-datastore] | stable | [`cloud.google.com/go/datastore`][cloud-datastore-ref] +[Debugger][cloud-debugger] | alpha | [`cloud.google.com/go/debugger/apiv2`][cloud-debugger-ref] +[Dialogflow][cloud-dialogflow] | alpha | [`cloud.google.com/go/dialogflow/apiv2`][cloud-dialogflow-ref] +[Data Loss Prevention][cloud-dlp] | alpha | [`cloud.google.com/go/dlp/apiv2`][cloud-dlp-ref] +[ErrorReporting][cloud-errors] | alpha | [`cloud.google.com/go/errorreporting`][cloud-errors-ref] +[Firestore][cloud-firestore] | stable | [`cloud.google.com/go/firestore`][cloud-firestore-ref] +[IAM][cloud-iam] | stable | [`cloud.google.com/go/iam`][cloud-iam-ref] +[IoT][cloud-iot] | alpha | [`cloud.google.com/iot/apiv1`][cloud-iot-ref] +[KMS][cloud-kms] | stable | [`cloud.google.com/go/kms`][cloud-kms-ref] +[Natural Language][cloud-natural-language] | stable | [`cloud.google.com/go/language/apiv1`][cloud-natural-language-ref] +[Logging][cloud-logging] | stable | [`cloud.google.com/go/logging`][cloud-logging-ref] +[Monitoring][cloud-monitoring] | alpha | [`cloud.google.com/go/monitoring/apiv3`][cloud-monitoring-ref] +[OS Login][cloud-oslogin] | alpha | [`cloud.google.com/go/oslogin/apiv1`][cloud-oslogin-ref] +[Pub/Sub][cloud-pubsub] | stable | [`cloud.google.com/go/pubsub`][cloud-pubsub-ref] +[Phishing Protection][cloud-phishingprotection] | alpha | [`cloud.google.com/go/phishingprotection/apiv1betad1`][cloud-phishingprotection-ref] +[reCAPTCHA Enterprise][cloud-recaptcha] | alpha | [`cloud.google.com/go/recaptchaenterprise/apiv1betad1`][cloud-recaptcha-ref] +[Memorystore][cloud-memorystore] | alpha | [`cloud.google.com/go/redis/apiv1`][cloud-memorystore-ref] +[Scheduler][cloud-scheduler] | stable | [`cloud.google.com/go/scheduler/apiv1`][cloud-scheduler-ref] +[Spanner][cloud-spanner] | stable | [`cloud.google.com/go/spanner`][cloud-spanner-ref] +[Speech][cloud-speech] | stable | [`cloud.google.com/go/speech/apiv1`][cloud-speech-ref] +[Storage][cloud-storage] | stable | [`cloud.google.com/go/storage`][cloud-storage-ref] +[Talent][cloud-talent] | alpha | [`cloud.google.com/go/talent/apiv4beta1`][cloud-talent-ref] +[Text To Speech][cloud-texttospeech] | alpha | [`cloud.google.com/go/texttospeech/apiv1`][cloud-texttospeech-ref] +[Trace][cloud-trace] | alpha | [`cloud.google.com/go/trace/apiv2`][cloud-trace-ref] +[Translate][cloud-translate] | stable | [`cloud.google.com/go/translate`][cloud-translate-ref] +[Video Intelligence][cloud-video] | alpha | [`cloud.google.com/go/videointelligence/apiv1beta1`][cloud-video-ref] +[Vision][cloud-vision] | stable | [`cloud.google.com/go/vision/apiv1`][cloud-vision-ref] + +> **Alpha status**: the API is still being actively developed. As a +> result, it might change in backward-incompatible ways and is not recommended +> for production use. +> +> **Beta status**: the API is largely complete, but still has outstanding +> features and bugs to be addressed. There may be minor backwards-incompatible +> changes where necessary. +> +> **Stable status**: the API is mature and ready for production use. We will +> continue addressing bugs and feature requests. + +Documentation and examples are available at [godoc.org/cloud.google.com/go](godoc.org/cloud.google.com/go) + +## Go Versions Supported + +We support the two most recent major versions of Go. If Google App Engine uses +an older version, we support that as well. + +## Authorization + +By default, each API will use [Google Application Default Credentials](https://developers.google.com/identity/protocols/application-default-credentials) +for authorization credentials used in calling the API endpoints. This will allow your +application to run in many environments without requiring explicit configuration. + +[snip]:# (auth) +```go +client, err := storage.NewClient(ctx) +``` + +To authorize using a +[JSON key file](https://cloud.google.com/iam/docs/managing-service-account-keys), +pass +[`option.WithCredentialsFile`](https://godoc.org/google.golang.org/api/option#WithCredentialsFile) +to the `NewClient` function of the desired package. For example: + +[snip]:# (auth-JSON) +```go +client, err := storage.NewClient(ctx, option.WithCredentialsFile("path/to/keyfile.json")) +``` + +You can exert more control over authorization by using the +[`golang.org/x/oauth2`](https://godoc.org/golang.org/x/oauth2) package to +create an `oauth2.TokenSource`. Then pass +[`option.WithTokenSource`](https://godoc.org/google.golang.org/api/option#WithTokenSource) +to the `NewClient` function: +[snip]:# (auth-ts) +```go +tokenSource := ... +client, err := storage.NewClient(ctx, option.WithTokenSource(tokenSource)) +``` + +## Contributing + +Contributions are welcome. Please, see the +[CONTRIBUTING](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/CONTRIBUTING.md) +document for details. We're using Gerrit for our code reviews. Please don't open pull +requests against this repo, new pull requests will be automatically closed. + +Please note that this project is released with a Contributor Code of Conduct. +By participating in this project you agree to abide by its terms. +See [Contributor Code of Conduct](https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/CONTRIBUTING.md#contributor-code-of-conduct) +for more information. + +[cloud-datastore]: https://cloud.google.com/datastore/ +[cloud-datastore-ref]: https://godoc.org/cloud.google.com/go/datastore + +[cloud-firestore]: https://cloud.google.com/firestore/ +[cloud-firestore-ref]: https://godoc.org/cloud.google.com/go/firestore + +[cloud-pubsub]: https://cloud.google.com/pubsub/ +[cloud-pubsub-ref]: https://godoc.org/cloud.google.com/go/pubsub + +[cloud-storage]: https://cloud.google.com/storage/ +[cloud-storage-ref]: https://godoc.org/cloud.google.com/go/storage + +[cloud-bigtable]: https://cloud.google.com/bigtable/ +[cloud-bigtable-ref]: https://godoc.org/cloud.google.com/go/bigtable + +[cloud-bigquery]: https://cloud.google.com/bigquery/ +[cloud-bigquery-ref]: https://godoc.org/cloud.google.com/go/bigquery + +[cloud-logging]: https://cloud.google.com/logging/ +[cloud-logging-ref]: https://godoc.org/cloud.google.com/go/logging + +[cloud-monitoring]: https://cloud.google.com/monitoring/ +[cloud-monitoring-ref]: https://godoc.org/cloud.google.com/go/monitoring/apiv3 + +[cloud-vision]: https://cloud.google.com/vision +[cloud-vision-ref]: https://godoc.org/cloud.google.com/go/vision/apiv1 + +[cloud-language]: https://cloud.google.com/natural-language +[cloud-language-ref]: https://godoc.org/cloud.google.com/go/language/apiv1 + +[cloud-oslogin]: https://cloud.google.com/compute/docs/oslogin/rest +[cloud-oslogin-ref]: https://cloud.google.com/go/oslogin/apiv1 + +[cloud-speech]: https://cloud.google.com/speech +[cloud-speech-ref]: https://godoc.org/cloud.google.com/go/speech/apiv1 + +[cloud-spanner]: https://cloud.google.com/spanner/ +[cloud-spanner-ref]: https://godoc.org/cloud.google.com/go/spanner + +[cloud-translate]: https://cloud.google.com/translate +[cloud-translate-ref]: https://godoc.org/cloud.google.com/go/translate + +[cloud-video]: https://cloud.google.com/video-intelligence/ +[cloud-video-ref]: https://godoc.org/cloud.google.com/go/videointelligence/apiv1beta1 + +[cloud-errors]: https://cloud.google.com/error-reporting/ +[cloud-errors-ref]: https://godoc.org/cloud.google.com/go/errorreporting + +[cloud-container]: https://cloud.google.com/containers/ +[cloud-container-ref]: https://godoc.org/cloud.google.com/go/container/apiv1 + +[cloud-debugger]: https://cloud.google.com/debugger/ +[cloud-debugger-ref]: https://godoc.org/cloud.google.com/go/debugger/apiv2 + +[cloud-dlp]: https://cloud.google.com/dlp/ +[cloud-dlp-ref]: https://godoc.org/cloud.google.com/go/dlp/apiv2beta1 + +[cloud-dataproc]: https://cloud.google.com/dataproc/ +[cloud-dataproc-ref]: https://godoc.org/cloud.google.com/go/dataproc/apiv1 + +[cloud-iam]: https://cloud.google.com/iam/ +[cloud-iam-ref]: https://godoc.org/cloud.google.com/go/iam + +[cloud-kms]: https://cloud.google.com/kms/ +[cloud-kms-ref]: https://godoc.org/cloud.google.com/go/kms/apiv1 + +[cloud-natural-language]: https://cloud.google.com/natural-language/ +[cloud-natural-language-ref]: https://godoc.org/cloud.google.com/go/language/apiv1 + +[cloud-memorystore]: https://cloud.google.com/memorystore/ +[cloud-memorystore-ref]: https://godoc.org/cloud.google.com/go/redis/apiv1 + +[cloud-texttospeech]: https://cloud.google.com/texttospeech/ +[cloud-texttospeech-ref]: https://godoc.org/cloud.google.com/go/texttospeech/apiv1 + +[cloud-trace]: https://cloud.google.com/trace/ +[cloud-trace-ref]: https://godoc.org/cloud.google.com/go/trace/apiv2 + +[cloud-dialogflow]: https://cloud.google.com/dialogflow-enterprise/ +[cloud-dialogflow-ref]: https://godoc.org/cloud.google.com/go/dialogflow/apiv2 + +[cloud-containeranalysis]: https://cloud.google.com/container-registry/docs/container-analysis +[cloud-containeranalysis-ref]: https://godoc.org/cloud.google.com/go/devtools/containeranalysis/apiv1beta1 + +[cloud-asset]: https://cloud.google.com/security-command-center/docs/how-to-asset-inventory +[cloud-asset-ref]: https://godoc.org/cloud.google.com/go/asset/apiv1 + +[cloud-tasks]: https://cloud.google.com/tasks/ +[cloud-tasks-ref]: https://godoc.org/cloud.google.com/go/cloudtasks/apiv2 + +[cloud-scheduler]: https://cloud.google.com/scheduler +[cloud-scheduler-ref]: https://godoc.org/cloud.google.com/go/scheduler/apiv1 + +[cloud-iot]: https://cloud.google.com/iot-core/ +[cloud-iot-ref]: https://godoc.org/cloud.google.com/go/iot/apiv1 + +[cloud-phishingprotection]: https://cloud.google.com/phishing-protection/ +[cloud-phishingprotection-ref]: https://cloud.google.com/go/phishingprotection/apiv1beta1 + +[cloud-recaptcha]: https://cloud.google.com/recaptcha-enterprise/ +[cloud-recaptcha-ref]: https://cloud.google.com/go/recaptchaenterprise/apiv1beta1 + +[cloud-talent]: https://cloud.google.com/solutions/talent-solution/ +[cloud-talent-ref]: https://godoc.org/cloud.google.com/go/talent/apiv4beta1 diff --git a/vendor/cloud.google.com/go/RELEASING.md b/vendor/cloud.google.com/go/RELEASING.md new file mode 100644 index 000000000000..c1c07338ebd5 --- /dev/null +++ b/vendor/cloud.google.com/go/RELEASING.md @@ -0,0 +1,49 @@ +# How to release `cloud.google.com/go` + +1. Determine the current release version with `git tag -l`. It should look + something like `vX.Y.Z`. We'll call the current version `$CV` and the new + version `$NV`. +1. On master, run `git log $CV...` to list all the changes since the last + release. NOTE: You must manually exclude changes from submodules [1]. +1. Edit `CHANGES.md` to include a summary of the changes. +1. `cd internal/version && go generate && cd -` +1. `./tidyall.sh` +1. Mail the CL. When the CL is approved, submit it. +1. Without submitting any other CLs: + a. Switch to master. + b. `git pull` + c. Tag the repo with the next version: `git tag $NV`. + d. Push the tag: `git push origin $NV`. +1. Update [the releases page](https://github.com/googleapis/google-cloud-go/releases) + with the new release, copying the contents of `CHANGES.md`. + +# How to release a submodule + +We have several submodules, including cloud.google.com/go/logging, +cloud.google.com/go/datastore, and so on. + +To release a submodule: + +1. (these instructions assume we're releasing cloud.google.com/go/datastore - + adjust accordingly) +1. Determine the current release version with `git tag -l`. It should look + something like `datastore/vX.Y.Z`. We'll call the current version `$CV` and + the new version `$NV`, which should look something like `datastore/vX.Y+1.Z` + (assuming a minor bump). +1. On master, run `git log $CV.. -- datastore/` to list all the changes to the + submodule directory since the last release. +1. Edit `datastore/CHANGES.md` to include a summary of the changes. +1. `./tidyall.sh` +1. `cd internal/version && go generate && cd -` +1. Mail the CL. When the CL is approved, submit it. +1. Without submitting any other CLs: + a. Switch to master. + b. `git pull` + c. Tag the repo with the next version: `git tag $NV`. + d. Push the tag: `git push origin $NV`. +1. Update [the releases page](https://github.com/googleapis/google-cloud-go/releases) + with the new release, copying the contents of `datastore/CHANGES.md`. + +# Appendix + +1: This should get better as submodule tooling matures. diff --git a/vendor/cloud.google.com/go/compute/metadata/.repo-metadata.json b/vendor/cloud.google.com/go/compute/metadata/.repo-metadata.json new file mode 100644 index 000000000000..ca022ccc41a0 --- /dev/null +++ b/vendor/cloud.google.com/go/compute/metadata/.repo-metadata.json @@ -0,0 +1,12 @@ +{ + "name": "metadata", + "name_pretty": "Google Compute Engine Metadata API", + "product_documentation": "https://cloud.google.com/compute/docs/storing-retrieving-metadata", + "client_documentation": "https://godoc.org/cloud.google.com/go/compute/metadata", + "release_level": "ga", + "language": "go", + "repo": "googleapis/google-cloud-go", + "distribution_name": "cloud.google.com/go/compute/metadata", + "api_id": "compute:metadata", + "requires_billing": false +} diff --git a/vendor/cloud.google.com/go/compute/metadata/metadata.go b/vendor/cloud.google.com/go/compute/metadata/metadata.go index 125b7033c96b..4ff4e2f1ca6d 100644 --- a/vendor/cloud.google.com/go/compute/metadata/metadata.go +++ b/vendor/cloud.google.com/go/compute/metadata/metadata.go @@ -227,6 +227,9 @@ func InternalIP() (string, error) { return defaultClient.InternalIP() } // ExternalIP returns the instance's primary external (public) IP address. func ExternalIP() (string, error) { return defaultClient.ExternalIP() } +// Email calls Client.Email on the default client. +func Email(serviceAccount string) (string, error) { return defaultClient.Email(serviceAccount) } + // Hostname returns the instance's hostname. This will be of the form // ".c..internal". func Hostname() (string, error) { return defaultClient.Hostname() } @@ -367,6 +370,16 @@ func (c *Client) InternalIP() (string, error) { return c.getTrimmed("instance/network-interfaces/0/ip") } +// Email returns the email address associated with the service account. +// The account may be empty or the string "default" to use the instance's +// main account. +func (c *Client) Email(serviceAccount string) (string, error) { + if serviceAccount == "" { + serviceAccount = "default" + } + return c.getTrimmed("instance/service-accounts/" + serviceAccount + "/email") +} + // ExternalIP returns the instance's primary external (public) IP address. func (c *Client) ExternalIP() (string, error) { return c.getTrimmed("instance/network-interfaces/0/access-configs/0/external-ip") diff --git a/vendor/cloud.google.com/go/doc.go b/vendor/cloud.google.com/go/doc.go new file mode 100644 index 000000000000..237d84561ce0 --- /dev/null +++ b/vendor/cloud.google.com/go/doc.go @@ -0,0 +1,100 @@ +// Copyright 2014 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 cloud is the root of the packages used to access Google Cloud +Services. See https://godoc.org/cloud.google.com/go for a full list +of sub-packages. + + +Client Options + +All clients in sub-packages are configurable via client options. These options are +described here: https://godoc.org/google.golang.org/api/option. + + +Authentication and Authorization + +All the clients in sub-packages support authentication via Google Application Default +Credentials (see https://cloud.google.com/docs/authentication/production), or +by providing a JSON key file for a Service Account. See the authentication examples +in this package for details. + + +Timeouts and Cancellation + +By default, all requests in sub-packages will run indefinitely, retrying on transient +errors when correctness allows. To set timeouts or arrange for cancellation, use +contexts. See the examples for details. + +Do not attempt to control the initial connection (dialing) of a service by setting a +timeout on the context passed to NewClient. Dialing is non-blocking, so timeouts +would be ineffective and would only interfere with credential refreshing, which uses +the same context. + + +Connection Pooling + +Connection pooling differs in clients based on their transport. Cloud +clients either rely on HTTP or gRPC transports to communicate +with Google Cloud. + +Cloud clients that use HTTP (bigquery, compute, storage, and translate) rely on the +underlying HTTP transport to cache connections for later re-use. These are cached to +the default http.MaxIdleConns and http.MaxIdleConnsPerHost settings in +http.DefaultTransport. + +For gRPC clients (all others in this repo), connection pooling is configurable. Users +of cloud client libraries may specify option.WithGRPCConnectionPool(n) as a client +option to NewClient calls. This configures the underlying gRPC connections to be +pooled and addressed in a round robin fashion. + + +Using the Libraries with Docker + +Minimal docker images like Alpine lack CA certificates. This causes RPCs to appear to +hang, because gRPC retries indefinitely. See https://github.com/googleapis/google-cloud-go/issues/928 +for more information. + + +Debugging + +To see gRPC logs, set the environment variable GRPC_GO_LOG_SEVERITY_LEVEL. See +https://godoc.org/google.golang.org/grpc/grpclog for more information. + +For HTTP logging, set the GODEBUG environment variable to "http2debug=1" or "http2debug=2". + + +Client Stability + +Clients in this repository are considered alpha or beta unless otherwise +marked as stable in the README.md. Semver is not used to communicate stability +of clients. + +Alpha and beta clients may change or go away without notice. + +Clients marked stable will maintain compatibility with future versions for as +long as we can reasonably sustain. Incompatible changes might be made in some +situations, including: + +- Security bugs may prompt backwards-incompatible changes. + +- Situations in which components are no longer feasible to maintain without +making breaking changes, including removal. + +- Parts of the client surface may be outright unstable and subject to change. +These parts of the surface will be labeled with the note, "It is EXPERIMENTAL +and subject to change or removal without notice." +*/ +package cloud // import "cloud.google.com/go" diff --git a/vendor/cloud.google.com/go/go.mod b/vendor/cloud.google.com/go/go.mod new file mode 100644 index 000000000000..989ed611dd7d --- /dev/null +++ b/vendor/cloud.google.com/go/go.mod @@ -0,0 +1,27 @@ +module cloud.google.com/go + +go 1.9 + +require ( + cloud.google.com/go/bigquery v1.0.1 + cloud.google.com/go/datastore v1.0.0 + cloud.google.com/go/pubsub v1.0.1 + github.com/golang/mock v1.3.1 + github.com/golang/protobuf v1.3.2 + github.com/google/go-cmp v0.3.0 + github.com/google/martian v2.1.0+incompatible + github.com/google/pprof v0.0.0-20190515194954-54271f7e092f + github.com/googleapis/gax-go/v2 v2.0.5 + github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024 + go.opencensus.io v0.22.0 + golang.org/x/exp v0.0.0-20190829153037-c13cbed26979 + golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac + golang.org/x/net v0.0.0-20190620200207-3b0461eec859 + golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 + golang.org/x/text v0.3.2 + golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff + google.golang.org/api v0.9.0 + google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51 + google.golang.org/grpc v1.21.1 + honnef.co/go/tools v0.0.1-2019.2.3 +) diff --git a/vendor/cloud.google.com/go/go.sum b/vendor/cloud.google.com/go/go.sum new file mode 100644 index 000000000000..e20de20997e5 --- /dev/null +++ b/vendor/cloud.google.com/go/go.sum @@ -0,0 +1,193 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go/bigquery v1.0.1 h1:hL+ycaJpVE9M7nLoiXb/Pn10ENE2u+oddxbD8uu0ZVU= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0 h1:Kt+gOPPp2LEPWp8CSfxhsM8ik9CcyE/gYu+0r+RnZvM= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/pubsub v1.0.1 h1:W9tAK3E57P75u0XLLR82LZyw8VpAnhmyTOxW9qzmyj8= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0 h1:28o5sBqPkBsMGnC6b4MvE2TzSr5/AT4c/1fLqVGIwlk= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57 h1:eqyIo2HjKhKe/mJzTG8n4VqvLXIOEG+SLdDqX7xGtkY= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f h1:Jnx61latede7zDD3DiiP4gmNz33uK0U5HDUaF0a/HVQ= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go/v2 v2.0.4 h1:hU4mGcQI4DaAYW+IbTun+2qEZVFxK0ySjQLTbS0VQKc= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024 h1:rBMNdlhTLzJjJSDIjNEXX1Pz3Hmwmz91v+zycvx9PJc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +go.opencensus.io v0.21.0 h1:mU6zScU4U1YAFPHEHYk+3JC4SY7JxgkqS10ZOSyksNg= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4 h1:c2HOrn5iMezYjSlGPncknSEr/8x5LELb/ilJbXi9DEA= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522 h1:OeRHuibLsmZkFj773W4LcfAGsSxJgfPONhr8cmO+eLA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979 h1:Agxu5KLo8o7Bb634SVDnhIfpTvxmzUwhbYAzBvXt6h4= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f h1:hX65Cu3JDlGH3uEdK7I99Ii+9kjD6mvnnpfLdEAH0x4= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422 h1:QzoH/1pFpZguR8NrRHLcO6jKqfv2zpuSqZLgdm7ZmjI= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac h1:8R1esu+8QioDxo4E4mX6bFztO+dMTM49DNAaWfO5OeY= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c h1:uOCk1iQW6Vc18bnC13MfzScl+wdKBmM9Y9kU7Z83/lw= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421 h1:Wo7BWFiOk0QRFMLYMqJGFMd9CgUAcGx7V+qEg/h5IBI= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6 h1:bjcUS9ztw9kFmmIxJInhon/0Is3p+EHBKNgquIzo1OI= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b h1:ag/x1USPSsqHud38I9BAC88qdNLDHHtQ4mlgQIZPPNA= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0 h1:HyfiK1WMnHj5FXFXatD+Qs1A/xC2Run6RzeW1SyHxpc= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c h1:fqgJT0MGcGpPgpWU7VRdRjuArfcOvC4AoJmILihzhDg= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138 h1:H3uGjxCR/6Ds0Mjgyp7LMK81+LvmbvWWEnJhzk1Pi9E= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c h1:97SnQk1GYRXJgvwZ8fadnxDOWfKvkNQHH3CtZntPSrM= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0 h1:Dh6fw+p6FyRl5x/FvNswO1ji0lIGzm3KP8Y9VkS9PTE= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff h1:On1qIo75ByTwFJ4/W2bIqHcwJ9XAqtSWUs8GwRrIhtc= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0 h1:VGGbLNyPF7dvYHhcUGYBBGCRDDK0RRJAI6KCvo0CL+E= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0 h1:jbyannxz0XFD3zdjgrSUsaJbgpH4eTrkdhRChkHPfO8= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0 h1:KxkO13IPW4Lslp2bz+KHP2E3gtFlrIGNThxkZQ3g+4c= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19 h1:Lj2SnHtxkRGJDqnGaSjo+CCdIieEnwVazbOXILwQemk= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873 h1:nfPFGzJkUDX6uBmpN/pSw7MbOAWegH5QDQuoXFHedLg= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64 h1:iKtrH9Y8mcbADOP0YFaEMth7OfuHY9xHOwNj4znpM1A= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51 h1:Ex1mq5jaJof+kRnYi3SlYJ8KKa9Ao3NHyIT5XJ1gF6U= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1 h1:Hz2g2wirWK7H0qIIhGIqRGTuMwTE8HEKFnDZZ7lm9NU= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a h1:/8zB6iBfHCl1qAnEAWwGPNrUvapuy6CPla1VM0k8hQw= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a h1:LJwr7TCTghdatWv40WobzlKXc9c4s8oGa7QKJUtHhWA= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/vendor/cloud.google.com/go/iam/.repo-metadata.json b/vendor/cloud.google.com/go/iam/.repo-metadata.json new file mode 100644 index 000000000000..0edb2d8b454c --- /dev/null +++ b/vendor/cloud.google.com/go/iam/.repo-metadata.json @@ -0,0 +1,12 @@ +{ + "name": "iam", + "name_pretty": "Cloud Identify and Access Management API", + "product_documentation": "https://cloud.google.com/iam", + "client_documentation": "https://godoc.org/cloud.google.com/go/iam", + "release_level": "ga", + "language": "go", + "repo": "googleapis/google-cloud-go", + "distribution_name": "cloud.google.com/go/iam", + "api_id": "iam.googleapis.com", + "requires_billing": true +} diff --git a/vendor/cloud.google.com/go/internal/version/update_version.sh b/vendor/cloud.google.com/go/internal/version/update_version.sh old mode 100755 new mode 100644 diff --git a/vendor/cloud.google.com/go/issue_template.md b/vendor/cloud.google.com/go/issue_template.md new file mode 100644 index 000000000000..e2ccef3e78df --- /dev/null +++ b/vendor/cloud.google.com/go/issue_template.md @@ -0,0 +1,17 @@ +(delete this for feature requests) + +## Client + +e.g. PubSub + +## Describe Your Environment + +e.g. Alpine Docker on GKE + +## Expected Behavior + +e.g. Messages arrive really fast. + +## Actual Behavior + +e.g. Messages arrive really slowly. \ No newline at end of file diff --git a/vendor/cloud.google.com/go/regen-gapic.sh b/vendor/cloud.google.com/go/regen-gapic.sh new file mode 100644 index 000000000000..f60f1bef5abc --- /dev/null +++ b/vendor/cloud.google.com/go/regen-gapic.sh @@ -0,0 +1,163 @@ +#!/bin/bash +# Copyright 2019 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. + +# This script generates all GAPIC clients in this repo. +# One-time setup: +# cd path/to/googleapis # https://github.com/googleapis/googleapis +# virtualenv env +# . env/bin/activate +# pip install googleapis-artman +# deactivate +# +# Regenerate: +# cd path/to/googleapis +# . env/bin/activate +# $GOPATH/src/cloud.google.com/go/regen-gapic.sh +# deactivate +# +# Being in googleapis directory is important; +# that's where we find YAML files and where artman puts the "artman-genfiles" directory. +# +# NOTE: This script does not generate the "raw" gRPC client found in google.golang.org/genproto. +# To do that, use the regen.sh script in the genproto repo instead. + +set -ex + +APIS=( +google/api/expr/artman_cel.yaml +google/iam/artman_iam_admin.yaml +google/cloud/asset/artman_cloudasset_v1beta1.yaml +google/cloud/asset/artman_cloudasset_v1p2beta1.yaml +google/cloud/asset/artman_cloudasset_v1.yaml +google/iam/credentials/artman_iamcredentials_v1.yaml +google/cloud/automl/artman_automl_v1beta1.yaml +google/cloud/bigquery/datatransfer/artman_bigquerydatatransfer.yaml +google/cloud/bigquery/storage/artman_bigquerystorage_v1beta1.yaml +google/cloud/dataproc/artman_dataproc_v1.yaml +google/cloud/dataproc/artman_dataproc_v1beta2.yaml +google/cloud/dialogflow/artman_dialogflow_v2.yaml +google/cloud/iot/artman_cloudiot.yaml +google/cloud/irm/artman_irm_v1alpha2.yaml +google/cloud/kms/artman_cloudkms.yaml +google/cloud/language/artman_language_v1.yaml +google/cloud/language/artman_language_v1beta2.yaml +google/cloud/oslogin/artman_oslogin_v1.yaml +google/cloud/oslogin/artman_oslogin_v1beta.yaml +google/cloud/phishingprotection/artman_phishingprotection_v1beta1.yaml +google/cloud/recaptchaenterprise/artman_recaptchaenterprise_v1beta1.yaml +google/cloud/redis/artman_redis_v1beta1.yaml +google/cloud/redis/artman_redis_v1.yaml +google/cloud/scheduler/artman_cloudscheduler_v1beta1.yaml +google/cloud/scheduler/artman_cloudscheduler_v1.yaml +google/cloud/securitycenter/artman_securitycenter_v1beta1.yaml +google/cloud/securitycenter/artman_securitycenter_v1.yaml +google/cloud/speech/artman_speech_v1.yaml +google/cloud/speech/artman_speech_v1p1beta1.yaml +google/cloud/talent/artman_talent_v4beta1.yaml +google/cloud/tasks/artman_cloudtasks_v2beta2.yaml +google/cloud/tasks/artman_cloudtasks_v2beta3.yaml +google/cloud/tasks/artman_cloudtasks_v2.yaml +google/cloud/texttospeech/artman_texttospeech_v1.yaml +google/cloud/videointelligence/artman_videointelligence_v1.yaml +google/cloud/videointelligence/artman_videointelligence_v1beta1.yaml +google/cloud/videointelligence/artman_videointelligence_v1beta2.yaml +google/cloud/vision/artman_vision_v1.yaml +google/cloud/vision/artman_vision_v1p1beta1.yaml +google/cloud/webrisk/artman_webrisk_v1beta1.yaml +google/devtools/artman_clouddebugger.yaml +google/devtools/clouderrorreporting/artman_errorreporting.yaml +google/devtools/cloudtrace/artman_cloudtrace_v1.yaml +google/devtools/cloudtrace/artman_cloudtrace_v2.yaml + +# The containeranalysis team wants manual changes in the auto-generated gapic. +# So, let's remove it from the autogen list until we're ready to spend energy +# generating and manually updating it. +# google/devtools/containeranalysis/artman_containeranalysis_v1.yaml + +google/devtools/containeranalysis/artman_containeranalysis_v1beta1.yaml +google/firestore/artman_firestore.yaml +google/firestore/admin/artman_firestore_v1.yaml + +# See containeranalysis note above. +# grafeas/artman_grafeas_v1.yaml + +google/logging/artman_logging.yaml +google/longrunning/artman_longrunning.yaml +google/monitoring/artman_monitoring.yaml +google/privacy/dlp/artman_dlp_v2.yaml +google/pubsub/artman_pubsub.yaml +google/spanner/admin/database/artman_spanner_admin_database.yaml +google/spanner/admin/instance/artman_spanner_admin_instance.yaml +google/spanner/artman_spanner.yaml +) + +for api in "${APIS[@]}"; do + rm -rf artman-genfiles/* + artman --config "$api" generate go_gapic + cp -r artman-genfiles/gapi-*/cloud.google.com/go/* $GOPATH/src/cloud.google.com/go/ +done + +microgen() { + input=$1 + options="${@:2}" + + # see https://github.com/googleapis/gapic-generator-go/blob/master/README.md#docker-wrapper for details + docker run \ + --mount type=bind,source=$(pwd),destination=/conf,readonly \ + --mount type=bind,source=$(pwd)/$input,destination=/in/$input,readonly \ + --mount type=bind,source=$GOPATH/src,destination=/out \ + --rm \ + gcr.io/gapic-images/gapic-generator-go:latest \ + $options +} + +MICROAPIS=( + # input proto directory | gapic-generator-go flag | gapic-service-config flag + # "google/cloud/language/v1 --go-gapic-package cloud.google.com/go/language/apiv1;language --gapic-service-config google/cloud/language/language_v1.yaml" +) + +for api in "${MICROAPIS[@]}"; do + microgen $api +done + +pushd $GOPATH/src/cloud.google.com/go/ + gofmt -s -d -l -w . && goimports -w . + + # NOTE(pongad): `sed -i` doesn't work on Macs, because -i option needs an argument. + # `-i ''` doesn't work on GNU, since the empty string is treated as a file name. + # So we just create the backup and delete it after. + ver=$(date +%Y%m%d) + git ls-files -mo | while read modified; do + dir=${modified%/*.*} + find . -path "*/$dir/doc.go" -exec sed -i.backup -e "s/^const versionClient.*/const versionClient = \"$ver\"/" '{}' + + done +popd + + +HASMANUAL=( +errorreporting/apiv1beta1 +firestore/apiv1beta1 +firestore/apiv1 +logging/apiv2 +longrunning/autogen +pubsub/apiv1 +spanner/apiv1 +trace/apiv1 +) +for dir in "${HASMANUAL[@]}"; do + find "$GOPATH/src/cloud.google.com/go/$dir" -name '*.go' -exec sed -i.backup -e 's/setGoogleClientInfo/SetGoogleClientInfo/g' '{}' '+' +done + +find $GOPATH/src/cloud.google.com/go/ -name '*.backup' -delete diff --git a/vendor/cloud.google.com/go/storage/.repo-metadata.json b/vendor/cloud.google.com/go/storage/.repo-metadata.json new file mode 100644 index 000000000000..a42f91cd35f1 --- /dev/null +++ b/vendor/cloud.google.com/go/storage/.repo-metadata.json @@ -0,0 +1,12 @@ +{ + "name": "storage", + "name_pretty": "storage", + "product_documentation": "https://cloud.google.com/storage", + "client_documentation": "https://godoc.org/cloud.google.com/go/storage", + "release_level": "ga", + "language": "go", + "repo": "googleapis/google-cloud-go", + "distribution_name": "cloud.google.com/go/storage", + "api_id": "storage:v2", + "requires_billing": true +} diff --git a/vendor/cloud.google.com/go/storage/CHANGES.md b/vendor/cloud.google.com/go/storage/CHANGES.md new file mode 100644 index 000000000000..952fff68e8e3 --- /dev/null +++ b/vendor/cloud.google.com/go/storage/CHANGES.md @@ -0,0 +1,6 @@ +# Changes + +## v1.0.0 + +This is the first tag to carve out storage as its own module. See: +https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository. \ No newline at end of file diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/LICENSE b/vendor/cloud.google.com/go/storage/LICENSE similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/google.golang.org/appengine/LICENSE rename to vendor/cloud.google.com/go/storage/LICENSE diff --git a/vendor/cloud.google.com/go/storage/bucket.go b/vendor/cloud.google.com/go/storage/bucket.go index 07c470d3e0d4..0ba45e8f8e71 100644 --- a/vendor/cloud.google.com/go/storage/bucket.go +++ b/vendor/cloud.google.com/go/storage/bucket.go @@ -267,14 +267,8 @@ type BucketAttrs struct { // StorageClass is the default storage class of the bucket. This defines // how objects in the bucket are stored and determines the SLA - // and the cost of storage. Typical values are "MULTI_REGIONAL", - // "REGIONAL", "NEARLINE", "COLDLINE", "STANDARD" and - // "DURABLE_REDUCED_AVAILABILITY". Defaults to "STANDARD", which - // is equivalent to "MULTI_REGIONAL" or "REGIONAL" depending on - // the bucket's location settings. - // - // "DURABLE_REDUCED_AVAILABILITY", "MULTI_REGIONAL" and "REGIONAL" - // are considered legacy storage classes. + // and the cost of storage. Typical values are "NEARLINE", "COLDLINE" and + // "STANDARD". Defaults to "STANDARD". StorageClass string // Created is the creation time of the bucket. @@ -446,8 +440,7 @@ type LifecycleCondition struct { // MatchesStorageClasses is the condition matching the object's storage // class. // - // Values include "MULTI_REGIONAL", "REGIONAL", "NEARLINE", "COLDLINE", - // "STANDARD", and "DURABLE_REDUCED_AVAILABILITY". + // Values include "NEARLINE", "COLDLINE" and "STANDARD". MatchesStorageClasses []string // NumNewerVersions is the condition matching objects with a number of newer versions. diff --git a/vendor/cloud.google.com/go/storage/go.mod b/vendor/cloud.google.com/go/storage/go.mod new file mode 100644 index 000000000000..ce68c9daaaaa --- /dev/null +++ b/vendor/cloud.google.com/go/storage/go.mod @@ -0,0 +1,14 @@ +module cloud.google.com/go/storage + +go 1.9 + +require ( + cloud.google.com/go v0.46.3 + github.com/golang/protobuf v1.3.2 + github.com/google/go-cmp v0.3.0 + github.com/googleapis/gax-go/v2 v2.0.5 + golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 + google.golang.org/api v0.9.0 + google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51 + google.golang.org/grpc v1.21.1 +) diff --git a/vendor/cloud.google.com/go/storage/go.sum b/vendor/cloud.google.com/go/storage/go.sum new file mode 100644 index 000000000000..96d9ee7c0dac --- /dev/null +++ b/vendor/cloud.google.com/go/storage/go.sum @@ -0,0 +1,156 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.1/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go/bigquery v1.0.1 h1:hL+ycaJpVE9M7nLoiXb/Pn10ENE2u+oddxbD8uu0ZVU= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/datastore v1.0.0 h1:Kt+gOPPp2LEPWp8CSfxhsM8ik9CcyE/gYu+0r+RnZvM= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/firestore v1.0.0/go.mod h1:SdFEKccng5n2jTXm5x01uXEvi4MBzxWFR6YI781XSJI= +cloud.google.com/go/pubsub v1.0.1 h1:W9tAK3E57P75u0XLLR82LZyw8VpAnhmyTOxW9qzmyj8= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024 h1:rBMNdlhTLzJjJSDIjNEXX1Pz3Hmwmz91v+zycvx9PJc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979 h1:Agxu5KLo8o7Bb634SVDnhIfpTvxmzUwhbYAzBvXt6h4= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac h1:8R1esu+8QioDxo4E4mX6bFztO+dMTM49DNAaWfO5OeY= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0 h1:HyfiK1WMnHj5FXFXatD+Qs1A/xC2Run6RzeW1SyHxpc= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff h1:On1qIo75ByTwFJ4/W2bIqHcwJ9XAqtSWUs8GwRrIhtc= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0 h1:jbyannxz0XFD3zdjgrSUsaJbgpH4eTrkdhRChkHPfO8= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51 h1:Ex1mq5jaJof+kRnYi3SlYJ8KKa9Ao3NHyIT5XJ1gF6U= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/vendor/cloud.google.com/go/storage/go_mod_tidy_hack.go b/vendor/cloud.google.com/go/storage/go_mod_tidy_hack.go new file mode 100644 index 000000000000..7df7a1d7155a --- /dev/null +++ b/vendor/cloud.google.com/go/storage/go_mod_tidy_hack.go @@ -0,0 +1,22 @@ +// Copyright 2019 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. + +// This file, and the cloud.google.com/go import, won't actually become part of +// the resultant binary. +// +build modhack + +package storage + +// Necessary for safely adding multi-module repo. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository +import _ "cloud.google.com/go" diff --git a/vendor/cloud.google.com/go/storage/hmac.go b/vendor/cloud.google.com/go/storage/hmac.go index 4a5c1b5121f4..c39632740e35 100644 --- a/vendor/cloud.google.com/go/storage/hmac.go +++ b/vendor/cloud.google.com/go/storage/hmac.go @@ -250,18 +250,23 @@ type HMACKeysIterator struct { pageInfo *iterator.PageInfo nextFunc func() error index int + desc hmacKeyDesc } // ListHMACKeys returns an iterator for listing HMACKeys. // // This method is EXPERIMENTAL and subject to change or removal without notice. -func (c *Client) ListHMACKeys(ctx context.Context, projectID string) *HMACKeysIterator { +func (c *Client) ListHMACKeys(ctx context.Context, projectID string, opts ...HMACKeyOption) *HMACKeysIterator { it := &HMACKeysIterator{ ctx: ctx, raw: raw.NewProjectsHmacKeysService(c.raw), projectID: projectID, } + for _, opt := range opts { + opt.withHMACKeyDesc(&it.desc) + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo( it.fetch, func() int { return len(it.hmacKeys) - it.index }, @@ -298,10 +303,18 @@ func (it *HMACKeysIterator) PageInfo() *iterator.PageInfo { return it.pageInfo } func (it *HMACKeysIterator) fetch(pageSize int, pageToken string) (token string, err error) { call := it.raw.List(it.projectID) setClientHeader(call.Header()) - call = call.PageToken(pageToken) - // By default we'll also show deleted keys and then - // let users filter on their own. - call = call.ShowDeletedKeys(true) + if pageToken != "" { + call = call.PageToken(pageToken) + } + if it.desc.showDeletedKeys { + call = call.ShowDeletedKeys(true) + } + if it.desc.userProjectID != "" { + call = call.UserProject(it.desc.userProjectID) + } + if it.desc.forServiceAccountEmail != "" { + call = call.ServiceAccountEmail(it.desc.forServiceAccountEmail) + } if pageSize > 0 { call = call.MaxResults(int64(pageSize)) } @@ -328,3 +341,47 @@ func (it *HMACKeysIterator) fetch(pageSize int, pageToken string) (token string, } return resp.NextPageToken, nil } + +type hmacKeyDesc struct { + forServiceAccountEmail string + showDeletedKeys bool + userProjectID string +} + +// HMACKeyOption configures the behavior of HMACKey related methods and actions. +type HMACKeyOption interface { + withHMACKeyDesc(*hmacKeyDesc) +} + +type hmacKeyDescFunc func(*hmacKeyDesc) + +func (hkdf hmacKeyDescFunc) withHMACKeyDesc(hkd *hmacKeyDesc) { + hkdf(hkd) +} + +// ForHMACKeyServiceAccountEmail returns HMAC Keys that are +// associated with the email address of a service account in the project. +// +// Only one service account email can be used as a filter, so if multiple +// of these options are applied, the last email to be set will be used. +func ForHMACKeyServiceAccountEmail(serviceAccountEmail string) HMACKeyOption { + return hmacKeyDescFunc(func(hkd *hmacKeyDesc) { + hkd.forServiceAccountEmail = serviceAccountEmail + }) +} + +// ShowDeletedHMACKeys will also list keys whose state is "DELETED". +func ShowDeletedHMACKeys() HMACKeyOption { + return hmacKeyDescFunc(func(hkd *hmacKeyDesc) { + hkd.showDeletedKeys = true + }) +} + +// HMACKeysForUserProject will bill the request against userProjectID. +// +// Note: This is a noop right now and only provided for API compatibility. +func HMACKeysForUserProject(userProjectID string) HMACKeyOption { + return hmacKeyDescFunc(func(hkd *hmacKeyDesc) { + hkd.userProjectID = userProjectID + }) +} diff --git a/vendor/cloud.google.com/go/storage/reader.go b/vendor/cloud.google.com/go/storage/reader.go index dbed8ac1bc99..5c83651bd9b7 100644 --- a/vendor/cloud.google.com/go/storage/reader.go +++ b/vendor/cloud.google.com/go/storage/reader.go @@ -43,6 +43,11 @@ type ReaderObjectAttrs struct { // Size is the length of the object's content. Size int64 + // StartOffset is the byte offset within the object + // from which reading begins. + // This value is only non-zero for range requests. + StartOffset int64 + // ContentType is the MIME type of the object's content. ContentType string @@ -78,7 +83,9 @@ func (o *ObjectHandle) NewReader(ctx context.Context) (*Reader, error) { // NewRangeReader reads part of an object, reading at most length bytes // starting at the given offset. If length is negative, the object is read -// until the end. +// until the end. If offset is negative, the object is read abs(offset) bytes +// from the end, and length must also be negative to indicate all remaining +// bytes will be read. func (o *ObjectHandle) NewRangeReader(ctx context.Context, offset, length int64) (r *Reader, err error) { ctx = trace.StartSpan(ctx, "cloud.google.com/go/storage.Object.NewRangeReader") defer func() { trace.EndSpan(ctx, err) }() @@ -86,8 +93,8 @@ func (o *ObjectHandle) NewRangeReader(ctx context.Context, offset, length int64) if err := o.validate(); err != nil { return nil, err } - if offset < 0 { - return nil, fmt.Errorf("storage: invalid offset %d < 0", offset) + if offset < 0 && length >= 0 { + return nil, fmt.Errorf("storage: invalid offset %d < 0 requires negative length", offset) } if o.conds != nil { if err := o.conds.validate("NewRangeReader"); err != nil { @@ -124,7 +131,9 @@ func (o *ObjectHandle) NewRangeReader(ctx context.Context, offset, length int64) // have already read seen bytes. reopen := func(seen int64) (*http.Response, error) { start := offset + seen - if length < 0 && start > 0 { + if length < 0 && start < 0 { + req.Header.Set("Range", fmt.Sprintf("bytes=%d", start)) + } else if length < 0 && start > 0 { req.Header.Set("Range", fmt.Sprintf("bytes=%d-", start)) } else if length > 0 { // The end character isn't affected by how many bytes we've seen. @@ -177,20 +186,28 @@ func (o *ObjectHandle) NewRangeReader(ctx context.Context, offset, length int64) return nil, err } var ( - size int64 // total size of object, even if a range was requested. - checkCRC bool - crc uint32 + size int64 // total size of object, even if a range was requested. + checkCRC bool + crc uint32 + startOffset int64 // non-zero if range request. ) if res.StatusCode == http.StatusPartialContent { cr := strings.TrimSpace(res.Header.Get("Content-Range")) if !strings.HasPrefix(cr, "bytes ") || !strings.Contains(cr, "/") { - return nil, fmt.Errorf("storage: invalid Content-Range %q", cr) } size, err = strconv.ParseInt(cr[strings.LastIndex(cr, "/")+1:], 10, 64) if err != nil { return nil, fmt.Errorf("storage: invalid Content-Range %q", cr) } + + dashIndex := strings.Index(cr, "-") + if dashIndex >= 0 { + startOffset, err = strconv.ParseInt(cr[len("bytes="):dashIndex], 10, 64) + if err != nil { + return nil, fmt.Errorf("storage: invalid Content-Range %q: %v", cr, err) + } + } } else { size = res.ContentLength // Check the CRC iff all of the following hold: @@ -236,6 +253,7 @@ func (o *ObjectHandle) NewRangeReader(ctx context.Context, offset, length int64) ContentEncoding: res.Header.Get("Content-Encoding"), CacheControl: res.Header.Get("Cache-Control"), LastModified: lm, + StartOffset: startOffset, Generation: gen, Metageneration: metaGen, } diff --git a/vendor/cloud.google.com/go/storage/storage.go b/vendor/cloud.google.com/go/storage/storage.go index d35bd7568e79..1ffb10f6446e 100644 --- a/vendor/cloud.google.com/go/storage/storage.go +++ b/vendor/cloud.google.com/go/storage/storage.go @@ -992,10 +992,8 @@ type ObjectAttrs struct { // StorageClass is the storage class of the object. // This value defines how objects in the bucket are stored and // determines the SLA and the cost of storage. Typical values are - // "MULTI_REGIONAL", "REGIONAL", "NEARLINE", "COLDLINE", "STANDARD" - // and "DURABLE_REDUCED_AVAILABILITY". - // It defaults to "STANDARD", which is equivalent to "MULTI_REGIONAL" - // or "REGIONAL" depending on the bucket's location settings. + // "NEARLINE", "COLDLINE" and "STANDARD". + // It defaults to "STANDARD". StorageClass string // Created is the time the object was created. This field is read-only. diff --git a/vendor/cloud.google.com/go/storage/writer.go b/vendor/cloud.google.com/go/storage/writer.go index 0f52414b84c7..a11659212870 100644 --- a/vendor/cloud.google.com/go/storage/writer.go +++ b/vendor/cloud.google.com/go/storage/writer.go @@ -148,21 +148,16 @@ func (w *Writer) open() error { call.UserProject(w.o.userProject) } setClientHeader(call.Header()) - // If the chunk size is zero, then no chunking is done on the Reader, - // which means we cannot retry: the first call will read the data, and if - // it fails, there is no way to re-read. - if w.ChunkSize == 0 { - resp, err = call.Do() - } else { - // We will only retry here if the initial POST, which obtains a URI for - // the resumable upload, fails with a retryable error. The upload itself - // has its own retry logic. - err = runWithRetry(w.ctx, func() error { - var err2 error - resp, err2 = call.Do() - return err2 - }) - } + + // The internals that perform call.Do automatically retry + // uploading chunks, hence no need to add retries here. + // See issue https://github.com/googleapis/google-cloud-go/issues/1507. + // + // However, since this whole call's internals involve making the initial + // resumable upload session, the first HTTP request is not retried. + // TODO: Follow-up with google.golang.org/gensupport to solve + // https://github.com/googleapis/google-api-go-client/issues/392. + resp, err = call.Do() } if err != nil { w.mu.Lock() @@ -231,7 +226,7 @@ func (w *Writer) Close() error { } // monitorCancel is intended to be used as a background goroutine. It monitors the -// the context, and when it observes that the context has been canceled, it manually +// context, and when it observes that the context has been canceled, it manually // closes things that do not take a context. func (w *Writer) monitorCancel() { select { diff --git a/vendor/cloud.google.com/go/tidyall.sh b/vendor/cloud.google.com/go/tidyall.sh new file mode 100644 index 000000000000..cdfa4964d03f --- /dev/null +++ b/vendor/cloud.google.com/go/tidyall.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# Copyright 2019 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Run at repo root. + +go mod tidy +for m in logging datastore bigquery bigtable; do + pushd $m + go mod tidy + popd +done diff --git a/vendor/cloud.google.com/go/tools.go b/vendor/cloud.google.com/go/tools.go new file mode 100644 index 000000000000..fa01cc44ccc4 --- /dev/null +++ b/vendor/cloud.google.com/go/tools.go @@ -0,0 +1,33 @@ +// +build tools + +// Copyright 2018 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. + +// This package exists to cause `go mod` and `go get` to believe these tools +// are dependencies, even though they are not runtime dependencies of any +// package (these are tools used by our CI builds). This means they will appear +// in our `go.mod` file, but will not be a part of the build. Also, since the +// build target is something non-existent, these should not be included in any +// binaries. + +package cloud + +import ( + _ "github.com/golang/protobuf/protoc-gen-go" + _ "github.com/jstemmer/go-junit-report" + _ "golang.org/x/exp/cmd/apidiff" + _ "golang.org/x/lint/golint" + _ "golang.org/x/tools/cmd/goimports" + _ "honnef.co/go/tools/cmd/staticcheck" +) diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/.travis.yml b/vendor/contrib.go.opencensus.io/exporter/ocagent/.travis.yml new file mode 100644 index 000000000000..ee417bbe6b64 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/.travis.yml @@ -0,0 +1,18 @@ +language: go + +go: + - 1.11.x + +go_import_path: contrib.go.opencensus.io/exporter/ocagent + +before_script: + - GO_FILES=$(find . -iname '*.go' | grep -v /vendor/) # All the .go files, excluding vendor/ if any + - PKGS=$(go list ./... | grep -v /vendor/) # All the import paths, excluding vendor/ if any + +script: + - go build ./... # Ensure dependency updates don't break build + - if [ -n "$(gofmt -s -l $GO_FILES)" ]; then echo "gofmt the following files:"; gofmt -s -l $GO_FILES; exit 1; fi + - go vet ./... + - GO111MODULE=on go test -v -race $PKGS # Run all the tests with the race detector enabled + - GO111MODULE=off go test -v -race $PKGS # Make sure tests still pass when not using Go modules. + - 'if [[ $TRAVIS_GO_VERSION = 1.8* ]]; then ! golint ./... | grep -vE "(_mock|_string|\.pb)\.go:"; fi' diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/CONTRIBUTING.md b/vendor/contrib.go.opencensus.io/exporter/ocagent/CONTRIBUTING.md new file mode 100644 index 000000000000..0786fdf43468 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/CONTRIBUTING.md @@ -0,0 +1,24 @@ +# How to contribute + +We'd love to accept your patches and contributions to this project. There are +just a few small guidelines you need to follow. + +## Contributor License Agreement + +Contributions to this project must be accompanied by a Contributor License +Agreement. You (or your employer) retain the copyright to your contribution, +this simply gives us permission to use and redistribute your contributions as +part of the project. Head over to to see +your current agreements on file or to sign a new one. + +You generally only need to submit a CLA once, so if you've already submitted one +(even if it was for a different project), you probably don't need to do it +again. + +## Code reviews + +All submissions, including submissions by project members, require review. We +use GitHub pull requests for this purpose. Consult [GitHub Help] for more +information on using pull requests. + +[GitHub Help]: https://help.github.com/articles/about-pull-requests/ 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 000000000000..261eeb9e9f8b --- /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/README.md b/vendor/contrib.go.opencensus.io/exporter/ocagent/README.md new file mode 100644 index 000000000000..3b9e908f5967 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/README.md @@ -0,0 +1,61 @@ +# OpenCensus Agent Go Exporter + +[![Build Status][travis-image]][travis-url] [![GoDoc][godoc-image]][godoc-url] + + +This repository contains the Go implementation of the OpenCensus Agent (OC-Agent) Exporter. +OC-Agent is a deamon process running in a VM that can retrieve spans/stats/metrics from +OpenCensus Library, export them to other backends and possibly push configurations back to +Library. See more details on [OC-Agent Readme][OCAgentReadme]. + +Note: This is an experimental repository and is likely to get backwards-incompatible changes. +Ultimately we may want to move the OC-Agent Go Exporter to [OpenCensus Go core library][OpenCensusGo]. + +## Installation + +```bash +$ go get -u contrib.go.opencensus.io/exporter/ocagent +``` + +## Usage + +```go +import ( + "context" + "fmt" + "log" + "time" + + "contrib.go.opencensus.io/exporter/ocagent" + "go.opencensus.io/trace" +) + +func Example() { + exp, err := ocagent.NewExporter(ocagent.WithInsecure(), ocagent.WithServiceName("your-service-name")) + if err != nil { + log.Fatalf("Failed to create the agent exporter: %v", err) + } + defer exp.Stop() + + // Now register it as a trace exporter. + trace.RegisterExporter(exp) + + // Then use the OpenCensus tracing library, like we normally would. + ctx, span := trace.StartSpan(context.Background(), "AgentExporter-Example") + defer span.End() + + for i := 0; i < 10; i++ { + _, iSpan := trace.StartSpan(ctx, fmt.Sprintf("Sample-%d", i)) + <-time.After(6 * time.Millisecond) + iSpan.End() + } +} +``` + +[OCAgentReadme]: https://github.com/census-instrumentation/opencensus-proto/tree/master/opencensus/proto/agent#opencensus-agent-proto +[OpenCensusGo]: https://github.com/census-instrumentation/opencensus-go +[godoc-image]: https://godoc.org/contrib.go.opencensus.io/exporter/ocagent?status.svg +[godoc-url]: https://godoc.org/contrib.go.opencensus.io/exporter/ocagent +[travis-image]: https://travis-ci.org/census-ecosystem/opencensus-go-exporter-ocagent.svg?branch=master +[travis-url]: https://travis-ci.org/census-ecosystem/opencensus-go-exporter-ocagent + 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 000000000000..297e44b6e76d --- /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 000000000000..3e05ae8b301b --- /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 000000000000..983ebe7b70f2 --- /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 000000000000..43f18dec1938 --- /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 000000000000..68be4c75bde7 --- /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/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/LICENSE b/vendor/github.com/Azure/azure-sdk-for-go/LICENSE similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/LICENSE rename to vendor/github.com/Azure/azure-sdk-for-go/LICENSE diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/NOTICE b/vendor/github.com/Azure/azure-sdk-for-go/NOTICE similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/NOTICE rename to vendor/github.com/Azure/azure-sdk-for-go/NOTICE diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/applicationgateways.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/applicationgateways.go similarity index 95% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/applicationgateways.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/applicationgateways.go index f02c887e63d5..e12351eae75c 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/applicationgateways.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/applicationgateways.go @@ -97,9 +97,9 @@ func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(ctx context.Conte // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) CreateOrUpdateSender(req *http.Request) (future ApplicationGatewaysCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -174,9 +174,9 @@ func (client ApplicationGatewaysClient) DeletePreparer(ctx context.Context, reso // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) DeleteSender(req *http.Request) (future ApplicationGatewaysDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -256,8 +256,8 @@ func (client ApplicationGatewaysClient) GetPreparer(ctx context.Context, resourc // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -332,8 +332,8 @@ func (client ApplicationGatewaysClient) ListPreparer(ctx context.Context, resour // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always @@ -442,8 +442,8 @@ func (client ApplicationGatewaysClient) ListAllPreparer(ctx context.Context) (*h // ListAllSender sends the ListAll request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) ListAllSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListAllResponder handles the response to the ListAll request. The method always @@ -550,9 +550,9 @@ func (client ApplicationGatewaysClient) StartPreparer(ctx context.Context, resou // StartSender sends the Start request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) StartSender(req *http.Request) (future ApplicationGatewaysStartFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -626,9 +626,9 @@ func (client ApplicationGatewaysClient) StopPreparer(ctx context.Context, resour // StopSender sends the Stop request. The method will close the // http.Response Body if it receives an error. func (client ApplicationGatewaysClient) StopSender(req *http.Request) (future ApplicationGatewaysStopFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/client.go new file mode 100644 index 000000000000..2005cb7e27d2 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/client.go @@ -0,0 +1,135 @@ +// Package network implements the Azure ARM Network service API version 2015-06-15. +// +// Network Client +package network + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +const ( + // DefaultBaseURI is the default URI used for the service Network + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Network. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} + +// CheckDNSNameAvailability checks whether a domain name in the cloudapp.net zone is available for use. +// Parameters: +// location - the location of the domain name. +// domainNameLabel - the domain name to be verified. It must conform to the following regular expression: +// ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. +func (client BaseClient) CheckDNSNameAvailability(ctx context.Context, location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.CheckDNSNameAvailability") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CheckDNSNameAvailabilityPreparer(ctx, location, domainNameLabel) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckDNSNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckDNSNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", resp, "Failure responding to request") + } + + return +} + +// CheckDNSNameAvailabilityPreparer prepares the CheckDNSNameAvailability request. +func (client BaseClient) CheckDNSNameAvailabilityPreparer(ctx context.Context, location string, domainNameLabel string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-06-15" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(domainNameLabel) > 0 { + queryParameters["domainNameLabel"] = autorest.Encode("query", domainNameLabel) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckDNSNameAvailabilitySender sends the CheckDNSNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) CheckDNSNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CheckDNSNameAvailabilityResponder handles the response to the CheckDNSNameAvailability request. The method always +// closes the http.Response Body. +func (client BaseClient) CheckDNSNameAvailabilityResponder(resp *http.Response) (result DNSNameAvailabilityResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitauthorizations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitauthorizations.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitauthorizations.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitauthorizations.go index 52155a321975..1492edc96df4 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitauthorizations.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitauthorizations.go @@ -102,9 +102,9 @@ func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(ctx // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -181,9 +181,9 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(ctx context // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitAuthorizationsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitAuthorizationsDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -265,8 +265,8 @@ func (client ExpressRouteCircuitAuthorizationsClient) GetPreparer(ctx context.Co // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitAuthorizationsClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -343,8 +343,8 @@ func (client ExpressRouteCircuitAuthorizationsClient) ListPreparer(ctx context.C // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitAuthorizationsClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitpeerings.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitpeerings.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitpeerings.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitpeerings.go index 81252fe0cd0c..8c3d65379d83 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitpeerings.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuitpeerings.go @@ -99,9 +99,9 @@ func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(ctx conte // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitPeeringsCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -178,9 +178,9 @@ func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(ctx context.Conte // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitPeeringsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitPeeringsDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -262,8 +262,8 @@ func (client ExpressRouteCircuitPeeringsClient) GetPreparer(ctx context.Context, // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitPeeringsClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -340,8 +340,8 @@ func (client ExpressRouteCircuitPeeringsClient) ListPreparer(ctx context.Context // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitPeeringsClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuits.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuits.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuits.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuits.go index 893e8e468359..ed7cb5b0b442 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuits.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressroutecircuits.go @@ -97,9 +97,9 @@ func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(ctx context.Cont // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitsCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -174,9 +174,9 @@ func (client ExpressRouteCircuitsClient) DeletePreparer(ctx context.Context, res // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitsDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -256,8 +256,8 @@ func (client ExpressRouteCircuitsClient) GetPreparer(ctx context.Context, resour // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -332,8 +332,8 @@ func (client ExpressRouteCircuitsClient) ListPreparer(ctx context.Context, resou // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always @@ -442,8 +442,8 @@ func (client ExpressRouteCircuitsClient) ListAllPreparer(ctx context.Context) (* // ListAllSender sends the ListAll request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) ListAllSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListAllResponder handles the response to the ListAll request. The method always @@ -558,8 +558,8 @@ func (client ExpressRouteCircuitsClient) ListArpTablePreparer(ctx context.Contex // ListArpTableSender sends the ListArpTable request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) ListArpTableSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListArpTableResponder handles the response to the ListArpTable request. The method always @@ -674,8 +674,8 @@ func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(ctx context.Con // ListRoutesTableSender sends the ListRoutesTable request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) ListRoutesTableSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListRoutesTableResponder handles the response to the ListRoutesTable request. The method always @@ -790,8 +790,8 @@ func (client ExpressRouteCircuitsClient) ListStatsPreparer(ctx context.Context, // ListStatsSender sends the ListStats request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteCircuitsClient) ListStatsSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListStatsResponder handles the response to the ListStats request. The method always diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressrouteserviceproviders.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressrouteserviceproviders.go similarity index 97% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressrouteserviceproviders.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressrouteserviceproviders.go index 680b36c9153c..7c1ef67e3edf 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressrouteserviceproviders.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/expressrouteserviceproviders.go @@ -97,8 +97,8 @@ func (client ExpressRouteServiceProvidersClient) ListPreparer(ctx context.Contex // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client ExpressRouteServiceProvidersClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/interfacesgroup.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/interfacesgroup.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/interfacesgroup.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/interfacesgroup.go index cef9933f56ba..48ab5feeda2d 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/interfacesgroup.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/interfacesgroup.go @@ -97,9 +97,9 @@ func (client InterfacesClient) CreateOrUpdatePreparer(ctx context.Context, resou // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) CreateOrUpdateSender(req *http.Request) (future InterfacesCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -174,9 +174,9 @@ func (client InterfacesClient) DeletePreparer(ctx context.Context, resourceGroup // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) DeleteSender(req *http.Request) (future InterfacesDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -260,8 +260,8 @@ func (client InterfacesClient) GetPreparer(ctx context.Context, resourceGroupNam // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -345,8 +345,8 @@ func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfacePreparer // GetVirtualMachineScaleSetNetworkInterfaceSender sends the GetVirtualMachineScaleSetNetworkInterface request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfaceSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetVirtualMachineScaleSetNetworkInterfaceResponder handles the response to the GetVirtualMachineScaleSetNetworkInterface request. The method always @@ -421,8 +421,8 @@ func (client InterfacesClient) ListPreparer(ctx context.Context, resourceGroupNa // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always @@ -531,8 +531,8 @@ func (client InterfacesClient) ListAllPreparer(ctx context.Context) (*http.Reque // ListAllSender sends the ListAll request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) ListAllSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListAllResponder handles the response to the ListAll request. The method always @@ -646,8 +646,8 @@ func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesPrepar // ListVirtualMachineScaleSetNetworkInterfacesSender sends the ListVirtualMachineScaleSetNetworkInterfaces request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListVirtualMachineScaleSetNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetNetworkInterfaces request. The method always @@ -764,8 +764,8 @@ func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesPrep // ListVirtualMachineScaleSetVMNetworkInterfacesSender sends the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method will close the // http.Response Body if it receives an error. func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListVirtualMachineScaleSetVMNetworkInterfacesResponder handles the response to the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method always diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/loadbalancers.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/loadbalancers.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/loadbalancers.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/loadbalancers.go index 200eeea9c480..70b711a00556 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/loadbalancers.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/loadbalancers.go @@ -97,9 +97,9 @@ func (client LoadBalancersClient) CreateOrUpdatePreparer(ctx context.Context, re // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client LoadBalancersClient) CreateOrUpdateSender(req *http.Request) (future LoadBalancersCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -174,9 +174,9 @@ func (client LoadBalancersClient) DeletePreparer(ctx context.Context, resourceGr // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client LoadBalancersClient) DeleteSender(req *http.Request) (future LoadBalancersDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -260,8 +260,8 @@ func (client LoadBalancersClient) GetPreparer(ctx context.Context, resourceGroup // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client LoadBalancersClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -336,8 +336,8 @@ func (client LoadBalancersClient) ListPreparer(ctx context.Context, resourceGrou // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client LoadBalancersClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always @@ -446,8 +446,8 @@ func (client LoadBalancersClient) ListAllPreparer(ctx context.Context) (*http.Re // ListAllSender sends the ListAll request. The method will close the // http.Response Body if it receives an error. func (client LoadBalancersClient) ListAllSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListAllResponder handles the response to the ListAll request. The method always diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/localnetworkgateways.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/localnetworkgateways.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/localnetworkgateways.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/localnetworkgateways.go index 7806579d1bce..1e1acd111721 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/localnetworkgateways.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/localnetworkgateways.go @@ -97,9 +97,9 @@ func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(ctx context.Cont // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client LocalNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (future LocalNetworkGatewaysCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -174,9 +174,9 @@ func (client LocalNetworkGatewaysClient) DeletePreparer(ctx context.Context, res // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client LocalNetworkGatewaysClient) DeleteSender(req *http.Request) (future LocalNetworkGatewaysDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -256,8 +256,8 @@ func (client LocalNetworkGatewaysClient) GetPreparer(ctx context.Context, resour // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client LocalNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -332,8 +332,8 @@ func (client LocalNetworkGatewaysClient) ListPreparer(ctx context.Context, resou // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client LocalNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/models.go similarity index 99% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/models.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/models.go index 71e378c5d8c4..16f07917671c 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/models.go @@ -8689,35 +8689,6 @@ func (future *VirtualNetworkGatewaysDeleteFuture) Result(client VirtualNetworkGa return } -// VirtualNetworkGatewaysGeneratevpnclientpackageFuture an abstraction for monitoring and retrieving the -// results of a long-running operation. -type VirtualNetworkGatewaysGeneratevpnclientpackageFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *VirtualNetworkGatewaysGeneratevpnclientpackageFuture) Result(client VirtualNetworkGatewaysClient) (s String, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.GeneratevpnclientpackageResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysGeneratevpnclientpackageFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - // VirtualNetworkGatewaySku virtualNetworkGatewaySku details type VirtualNetworkGatewaySku struct { // Name - Gateway sku name -Basic/HighPerformance/Standard. Possible values include: 'VirtualNetworkGatewaySkuNameBasic', 'VirtualNetworkGatewaySkuNameHighPerformance', 'VirtualNetworkGatewaySkuNameStandard' diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/publicipaddresses.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/publicipaddresses.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/publicipaddresses.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/publicipaddresses.go index 2eb805666a0a..96c7461e2cac 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/publicipaddresses.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/publicipaddresses.go @@ -109,9 +109,9 @@ func (client PublicIPAddressesClient) CreateOrUpdatePreparer(ctx context.Context // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client PublicIPAddressesClient) CreateOrUpdateSender(req *http.Request) (future PublicIPAddressesCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -186,9 +186,9 @@ func (client PublicIPAddressesClient) DeletePreparer(ctx context.Context, resour // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client PublicIPAddressesClient) DeleteSender(req *http.Request) (future PublicIPAddressesDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -272,8 +272,8 @@ func (client PublicIPAddressesClient) GetPreparer(ctx context.Context, resourceG // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client PublicIPAddressesClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -348,8 +348,8 @@ func (client PublicIPAddressesClient) ListPreparer(ctx context.Context, resource // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client PublicIPAddressesClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always @@ -458,8 +458,8 @@ func (client PublicIPAddressesClient) ListAllPreparer(ctx context.Context) (*htt // ListAllSender sends the ListAll request. The method will close the // http.Response Body if it receives an error. func (client PublicIPAddressesClient) ListAllSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListAllResponder handles the response to the ListAll request. The method always diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/routes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/routes.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/routes.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/routes.go index d25923ad0244..ac1c3972d6f3 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/routes.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/routes.go @@ -99,9 +99,9 @@ func (client RoutesClient) CreateOrUpdatePreparer(ctx context.Context, resourceG // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client RoutesClient) CreateOrUpdateSender(req *http.Request) (future RoutesCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -178,9 +178,9 @@ func (client RoutesClient) DeletePreparer(ctx context.Context, resourceGroupName // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client RoutesClient) DeleteSender(req *http.Request) (future RoutesDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -262,8 +262,8 @@ func (client RoutesClient) GetPreparer(ctx context.Context, resourceGroupName st // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client RoutesClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -340,8 +340,8 @@ func (client RoutesClient) ListPreparer(ctx context.Context, resourceGroupName s // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client RoutesClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/routetables.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/routetables.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/routetables.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/routetables.go index e4dbd6bbe0f7..73fd48f3dbf7 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/routetables.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/routetables.go @@ -97,9 +97,9 @@ func (client RouteTablesClient) CreateOrUpdatePreparer(ctx context.Context, reso // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client RouteTablesClient) CreateOrUpdateSender(req *http.Request) (future RouteTablesCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -174,9 +174,9 @@ func (client RouteTablesClient) DeletePreparer(ctx context.Context, resourceGrou // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client RouteTablesClient) DeleteSender(req *http.Request) (future RouteTablesDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -260,8 +260,8 @@ func (client RouteTablesClient) GetPreparer(ctx context.Context, resourceGroupNa // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client RouteTablesClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -336,8 +336,8 @@ func (client RouteTablesClient) ListPreparer(ctx context.Context, resourceGroupN // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client RouteTablesClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always @@ -446,8 +446,8 @@ func (client RouteTablesClient) ListAllPreparer(ctx context.Context) (*http.Requ // ListAllSender sends the ListAll request. The method will close the // http.Response Body if it receives an error. func (client RouteTablesClient) ListAllSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListAllResponder handles the response to the ListAll request. The method always diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/securitygroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/securitygroups.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/securitygroups.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/securitygroups.go index 3cd8cb5a0fe3..7496a2de81c4 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/securitygroups.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/securitygroups.go @@ -97,9 +97,9 @@ func (client SecurityGroupsClient) CreateOrUpdatePreparer(ctx context.Context, r // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client SecurityGroupsClient) CreateOrUpdateSender(req *http.Request) (future SecurityGroupsCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -174,9 +174,9 @@ func (client SecurityGroupsClient) DeletePreparer(ctx context.Context, resourceG // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client SecurityGroupsClient) DeleteSender(req *http.Request) (future SecurityGroupsDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -260,8 +260,8 @@ func (client SecurityGroupsClient) GetPreparer(ctx context.Context, resourceGrou // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client SecurityGroupsClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -336,8 +336,8 @@ func (client SecurityGroupsClient) ListPreparer(ctx context.Context, resourceGro // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client SecurityGroupsClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always @@ -446,8 +446,8 @@ func (client SecurityGroupsClient) ListAllPreparer(ctx context.Context) (*http.R // ListAllSender sends the ListAll request. The method will close the // http.Response Body if it receives an error. func (client SecurityGroupsClient) ListAllSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListAllResponder handles the response to the ListAll request. The method always diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/securityrules.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/securityrules.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/securityrules.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/securityrules.go index a220095940df..3700045bc4d2 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/securityrules.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/securityrules.go @@ -109,9 +109,9 @@ func (client SecurityRulesClient) CreateOrUpdatePreparer(ctx context.Context, re // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client SecurityRulesClient) CreateOrUpdateSender(req *http.Request) (future SecurityRulesCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -188,9 +188,9 @@ func (client SecurityRulesClient) DeletePreparer(ctx context.Context, resourceGr // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client SecurityRulesClient) DeleteSender(req *http.Request) (future SecurityRulesDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -272,8 +272,8 @@ func (client SecurityRulesClient) GetPreparer(ctx context.Context, resourceGroup // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client SecurityRulesClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -350,8 +350,8 @@ func (client SecurityRulesClient) ListPreparer(ctx context.Context, resourceGrou // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client SecurityRulesClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/subnets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/subnets.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/subnets.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/subnets.go index c389547c9269..c77bb796d4f6 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/subnets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/subnets.go @@ -99,9 +99,9 @@ func (client SubnetsClient) CreateOrUpdatePreparer(ctx context.Context, resource // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client SubnetsClient) CreateOrUpdateSender(req *http.Request) (future SubnetsCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -178,9 +178,9 @@ func (client SubnetsClient) DeletePreparer(ctx context.Context, resourceGroupNam // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client SubnetsClient) DeleteSender(req *http.Request) (future SubnetsDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -266,8 +266,8 @@ func (client SubnetsClient) GetPreparer(ctx context.Context, resourceGroupName s // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client SubnetsClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -344,8 +344,8 @@ func (client SubnetsClient) ListPreparer(ctx context.Context, resourceGroupName // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client SubnetsClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/usages.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/usages.go similarity index 97% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/usages.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/usages.go index f3de0561d2ce..05bdc20cb03b 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/usages.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/usages.go @@ -106,8 +106,8 @@ func (client UsagesClient) ListPreparer(ctx context.Context, location string) (* // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client UsagesClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/version.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/version.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/version.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworkgatewayconnections.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworkgatewayconnections.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworkgatewayconnections.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworkgatewayconnections.go index 1c7f86a58e3c..e6e7494937e8 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworkgatewayconnections.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworkgatewayconnections.go @@ -98,9 +98,9 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(ctx // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkGatewayConnectionsCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -175,9 +175,9 @@ func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(ctx context. // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) DeleteSender(req *http.Request) (future VirtualNetworkGatewayConnectionsDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -257,8 +257,8 @@ func (client VirtualNetworkGatewayConnectionsClient) GetPreparer(ctx context.Con // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -335,8 +335,8 @@ func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyPreparer(ctx co // GetSharedKeySender sends the GetSharedKey request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeySender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetSharedKeyResponder handles the response to the GetSharedKey request. The method always @@ -412,8 +412,8 @@ func (client VirtualNetworkGatewayConnectionsClient) ListPreparer(ctx context.Co // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always @@ -526,9 +526,9 @@ func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(ctx // ResetSharedKeySender sends the ResetSharedKey request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeySender(req *http.Request) (future VirtualNetworkGatewayConnectionsResetSharedKeyFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -609,9 +609,9 @@ func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(ctx co // SetSharedKeySender sends the SetSharedKey request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeySender(req *http.Request) (future VirtualNetworkGatewayConnectionsSetSharedKeyFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworkgateways.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworkgateways.go similarity index 93% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworkgateways.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworkgateways.go index 5498c9bf8ec8..3bdf38bf0194 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworkgateways.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworkgateways.go @@ -97,9 +97,9 @@ func (client VirtualNetworkGatewaysClient) CreateOrUpdatePreparer(ctx context.Co // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkGatewaysCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -174,9 +174,9 @@ func (client VirtualNetworkGatewaysClient) DeletePreparer(ctx context.Context, r // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) DeleteSender(req *http.Request) (future VirtualNetworkGatewaysDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -202,13 +202,13 @@ func (client VirtualNetworkGatewaysClient) DeleteResponder(resp *http.Response) // resourceGroupName - the name of the resource group. // virtualNetworkGatewayName - the name of the virtual network gateway. // parameters - parameters supplied to the generate virtual network gateway VPN client package operation. -func (client VirtualNetworkGatewaysClient) Generatevpnclientpackage(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result VirtualNetworkGatewaysGeneratevpnclientpackageFuture, err error) { +func (client VirtualNetworkGatewaysClient) Generatevpnclientpackage(ctx context.Context, resourceGroupName string, virtualNetworkGatewayName string, parameters VpnClientParameters) (result String, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/VirtualNetworkGatewaysClient.Generatevpnclientpackage") defer func() { sc := -1 - if result.Response() != nil { - sc = result.Response().StatusCode + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -219,12 +219,18 @@ func (client VirtualNetworkGatewaysClient) Generatevpnclientpackage(ctx context. return } - result, err = client.GeneratevpnclientpackageSender(req) + resp, err := client.GeneratevpnclientpackageSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", result.Response(), "Failure sending request") + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", resp, "Failure sending request") return } + result, err = client.GeneratevpnclientpackageResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewaysClient", "Generatevpnclientpackage", resp, "Failure responding to request") + } + return } @@ -253,15 +259,9 @@ func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackagePreparer(ctx // GeneratevpnclientpackageSender sends the Generatevpnclientpackage request. The method will close the // http.Response Body if it receives an error. -func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageSender(req *http.Request) (future VirtualNetworkGatewaysGeneratevpnclientpackageFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) - if err != nil { - return - } - future.Future, err = azure.NewFutureFromResponse(resp) - return +func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GeneratevpnclientpackageResponder handles the response to the Generatevpnclientpackage request. The method always @@ -271,7 +271,7 @@ func (client VirtualNetworkGatewaysClient) GeneratevpnclientpackageResponder(res resp, client.ByInspecting(), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), + autorest.ByUnmarshallingJSON(&result.Value), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} return @@ -337,8 +337,8 @@ func (client VirtualNetworkGatewaysClient) GetPreparer(ctx context.Context, reso // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -413,8 +413,8 @@ func (client VirtualNetworkGatewaysClient) ListPreparer(ctx context.Context, res // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always @@ -525,9 +525,9 @@ func (client VirtualNetworkGatewaysClient) ResetPreparer(ctx context.Context, re // ResetSender sends the Reset request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworkGatewaysClient) ResetSender(req *http.Request) (future VirtualNetworkGatewaysResetFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworks.go b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworks.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworks.go rename to vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworks.go index b5e5b0206cfd..3a2dd6d03092 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworks.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2015-06-15/network/virtualnetworks.go @@ -97,9 +97,9 @@ func (client VirtualNetworksClient) CreateOrUpdatePreparer(ctx context.Context, // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworksClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworksCreateOrUpdateFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -174,9 +174,9 @@ func (client VirtualNetworksClient) DeletePreparer(ctx context.Context, resource // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworksClient) DeleteSender(req *http.Request) (future VirtualNetworksDeleteFuture, err error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) var resp *http.Response - resp, err = autorest.SendWithSender(client, req, sd...) + resp, err = autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) if err != nil { return } @@ -260,8 +260,8 @@ func (client VirtualNetworksClient) GetPreparer(ctx context.Context, resourceGro // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworksClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -336,8 +336,8 @@ func (client VirtualNetworksClient) ListPreparer(ctx context.Context, resourceGr // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworksClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListResponder handles the response to the List request. The method always @@ -446,8 +446,8 @@ func (client VirtualNetworksClient) ListAllPreparer(ctx context.Context) (*http. // ListAllSender sends the ListAll request. The method will close the // http.Response Body if it receives an error. func (client VirtualNetworksClient) ListAllSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) } // ListAllResponder handles the response to the ListAll request. The method always 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 new file mode 100644 index 000000000000..2f58cd8cfd72 --- /dev/null +++ b/vendor/github.com/Azure/azure-sdk-for-go/version/version.go @@ -0,0 +1,21 @@ +package version + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Number contains the semantic version of this SDK. +const Number = "v29.0.0" diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/README.md b/vendor/github.com/Azure/go-autorest/autorest/adal/README.md new file mode 100644 index 000000000000..7b0c4bc4d21a --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/README.md @@ -0,0 +1,292 @@ +# Azure Active Directory authentication for Go + +This is a standalone package for authenticating with Azure Active +Directory from other Go libraries and applications, in particular the [Azure SDK +for Go](https://github.com/Azure/azure-sdk-for-go). + +Note: Despite the package's name it is not related to other "ADAL" libraries +maintained in the [github.com/AzureAD](https://github.com/AzureAD) org. Issues +should be opened in [this repo's](https://github.com/Azure/go-autorest/issues) +or [the SDK's](https://github.com/Azure/azure-sdk-for-go/issues) issue +trackers. + +## Install + +```bash +go get -u github.com/Azure/go-autorest/autorest/adal +``` + +## Usage + +An Active Directory application is required in order to use this library. An application can be registered in the [Azure Portal](https://portal.azure.com/) by following these [guidelines](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-integrating-applications) or using the [Azure CLI](https://github.com/Azure/azure-cli). + +### Register an Azure AD Application with secret + + +1. Register a new application with a `secret` credential + + ``` + az ad app create \ + --display-name example-app \ + --homepage https://example-app/home \ + --identifier-uris https://example-app/app \ + --password secret + ``` + +2. Create a service principal using the `Application ID` from previous step + + ``` + az ad sp create --id "Application ID" + ``` + + * Replace `Application ID` with `appId` from step 1. + +### Register an Azure AD Application with certificate + +1. Create a private key + + ``` + openssl genrsa -out "example-app.key" 2048 + ``` + +2. Create the certificate + + ``` + openssl req -new -key "example-app.key" -subj "/CN=example-app" -out "example-app.csr" + openssl x509 -req -in "example-app.csr" -signkey "example-app.key" -out "example-app.crt" -days 10000 + ``` + +3. Create the PKCS12 version of the certificate containing also the private key + + ``` + openssl pkcs12 -export -out "example-app.pfx" -inkey "example-app.key" -in "example-app.crt" -passout pass: + + ``` + +4. Register a new application with the certificate content form `example-app.crt` + + ``` + certificateContents="$(tail -n+2 "example-app.crt" | head -n-1)" + + az ad app create \ + --display-name example-app \ + --homepage https://example-app/home \ + --identifier-uris https://example-app/app \ + --key-usage Verify --end-date 2018-01-01 \ + --key-value "${certificateContents}" + ``` + +5. Create a service principal using the `Application ID` from previous step + + ``` + az ad sp create --id "APPLICATION_ID" + ``` + + * Replace `APPLICATION_ID` with `appId` from step 4. + + +### Grant the necessary permissions + +Azure relies on a Role-Based Access Control (RBAC) model to manage the access to resources at a fine-grained +level. There is a set of [pre-defined roles](https://docs.microsoft.com/en-us/azure/active-directory/role-based-access-built-in-roles) +which can be assigned to a service principal of an Azure AD application depending of your needs. + +``` +az role assignment create --assigner "SERVICE_PRINCIPAL_ID" --role "ROLE_NAME" +``` + +* Replace the `SERVICE_PRINCIPAL_ID` with the `appId` from previous step. +* Replace the `ROLE_NAME` with a role name of your choice. + +It is also possible to define custom role definitions. + +``` +az role definition create --role-definition role-definition.json +``` + +* Check [custom roles](https://docs.microsoft.com/en-us/azure/active-directory/role-based-access-control-custom-roles) for more details regarding the content of `role-definition.json` file. + + +### Acquire Access Token + +The common configuration used by all flows: + +```Go +const activeDirectoryEndpoint = "https://login.microsoftonline.com/" +tenantID := "TENANT_ID" +oauthConfig, err := adal.NewOAuthConfig(activeDirectoryEndpoint, tenantID) + +applicationID := "APPLICATION_ID" + +callback := func(token adal.Token) error { + // This is called after the token is acquired +} + +// The resource for which the token is acquired +resource := "https://management.core.windows.net/" +``` + +* Replace the `TENANT_ID` with your tenant ID. +* Replace the `APPLICATION_ID` with the value from previous section. + +#### Client Credentials + +```Go +applicationSecret := "APPLICATION_SECRET" + +spt, err := adal.NewServicePrincipalToken( + oauthConfig, + appliationID, + applicationSecret, + resource, + callbacks...) +if err != nil { + return nil, err +} + +// Acquire a new access token +err = spt.Refresh() +if (err == nil) { + token := spt.Token +} +``` + +* Replace the `APPLICATION_SECRET` with the `password` value from previous section. + +#### Client Certificate + +```Go +certificatePath := "./example-app.pfx" + +certData, err := ioutil.ReadFile(certificatePath) +if err != nil { + return nil, fmt.Errorf("failed to read the certificate file (%s): %v", certificatePath, err) +} + +// Get the certificate and private key from pfx file +certificate, rsaPrivateKey, err := decodePkcs12(certData, "") +if err != nil { + return nil, fmt.Errorf("failed to decode pkcs12 certificate while creating spt: %v", err) +} + +spt, err := adal.NewServicePrincipalTokenFromCertificate( + oauthConfig, + applicationID, + certificate, + rsaPrivateKey, + resource, + callbacks...) + +// Acquire a new access token +err = spt.Refresh() +if (err == nil) { + token := spt.Token +} +``` + +* Update the certificate path to point to the example-app.pfx file which was created in previous section. + + +#### Device Code + +```Go +oauthClient := &http.Client{} + +// Acquire the device code +deviceCode, err := adal.InitiateDeviceAuth( + oauthClient, + oauthConfig, + applicationID, + resource) +if err != nil { + return nil, fmt.Errorf("Failed to start device auth flow: %s", err) +} + +// Display the authentication message +fmt.Println(*deviceCode.Message) + +// Wait here until the user is authenticated +token, err := adal.WaitForUserCompletion(oauthClient, deviceCode) +if err != nil { + return nil, fmt.Errorf("Failed to finish device auth flow: %s", err) +} + +spt, err := adal.NewServicePrincipalTokenFromManualToken( + oauthConfig, + applicationID, + resource, + *token, + callbacks...) + +if (err == nil) { + token := spt.Token +} +``` + +#### Username password authenticate + +```Go +spt, err := adal.NewServicePrincipalTokenFromUsernamePassword( + oauthConfig, + applicationID, + username, + password, + resource, + callbacks...) + +if (err == nil) { + token := spt.Token +} +``` + +#### Authorization code authenticate + +``` Go +spt, err := adal.NewServicePrincipalTokenFromAuthorizationCode( + oauthConfig, + applicationID, + clientSecret, + authorizationCode, + redirectURI, + resource, + callbacks...) + +err = spt.Refresh() +if (err == nil) { + token := spt.Token +} +``` + +### Command Line Tool + +A command line tool is available in `cmd/adal.go` that can acquire a token for a given resource. It supports all flows mentioned above. + +``` +adal -h + +Usage of ./adal: + -applicationId string + application id + -certificatePath string + path to pk12/PFC application certificate + -mode string + authentication mode (device, secret, cert, refresh) (default "device") + -resource string + resource for which the token is requested + -secret string + application secret + -tenantId string + tenant id + -tokenCachePath string + location of oath token cache (default "/home/cgc/.adal/accessToken.json") +``` + +Example acquire a token for `https://management.core.windows.net/` using device code flow: + +``` +adal -mode device \ + -applicationId "APPLICATION_ID" \ + -tenantId "TENANT_ID" \ + -resource https://management.core.windows.net/ + +``` diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/config.go b/vendor/github.com/Azure/go-autorest/autorest/adal/config.go new file mode 100644 index 000000000000..8c83a917ff7e --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/config.go @@ -0,0 +1,91 @@ +package adal + +// 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 ( + "fmt" + "net/url" +) + +// OAuthConfig represents the endpoints needed +// in OAuth operations +type OAuthConfig struct { + AuthorityEndpoint url.URL `json:"authorityEndpoint"` + AuthorizeEndpoint url.URL `json:"authorizeEndpoint"` + TokenEndpoint url.URL `json:"tokenEndpoint"` + DeviceCodeEndpoint url.URL `json:"deviceCodeEndpoint"` +} + +// IsZero returns true if the OAuthConfig object is zero-initialized. +func (oac OAuthConfig) IsZero() bool { + return oac == OAuthConfig{} +} + +func validateStringParam(param, name string) error { + if len(param) == 0 { + return fmt.Errorf("parameter '" + name + "' cannot be empty") + } + return nil +} + +// 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 + 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 + } + authorityURL, err := u.Parse(tenantID) + if err != nil { + return nil, err + } + 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", api)) + if err != nil { + return nil, err + } + deviceCodeURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "devicecode", api)) + if err != nil { + return nil, err + } + + return &OAuthConfig{ + AuthorityEndpoint: *authorityURL, + AuthorizeEndpoint: *authorizeURL, + TokenEndpoint: *tokenURL, + DeviceCodeEndpoint: *deviceCodeURL, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go b/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go similarity index 83% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go rename to vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go index 914f8af5e4ea..b38f4c245897 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go @@ -24,7 +24,6 @@ package adal */ import ( - "context" "encoding/json" "fmt" "io/ioutil" @@ -102,14 +101,7 @@ type deviceToken struct { // InitiateDeviceAuth initiates a device auth flow. It returns a DeviceCode // that can be used with CheckForUserCompletion or WaitForUserCompletion. -// Deprecated: use InitiateDeviceAuthWithContext() instead. func InitiateDeviceAuth(sender Sender, oauthConfig OAuthConfig, clientID, resource string) (*DeviceCode, error) { - return InitiateDeviceAuthWithContext(context.Background(), sender, oauthConfig, clientID, resource) -} - -// InitiateDeviceAuthWithContext initiates a device auth flow. It returns a DeviceCode -// that can be used with CheckForUserCompletion or WaitForUserCompletion. -func InitiateDeviceAuthWithContext(ctx context.Context, sender Sender, oauthConfig OAuthConfig, clientID, resource string) (*DeviceCode, error) { v := url.Values{ "client_id": []string{clientID}, "resource": []string{resource}, @@ -125,7 +117,7 @@ func InitiateDeviceAuthWithContext(ctx context.Context, sender Sender, oauthConf req.ContentLength = int64(len(s)) req.Header.Set(contentType, mimeTypeFormPost) - resp, err := sender.Do(req.WithContext(ctx)) + resp, err := sender.Do(req) if err != nil { return nil, fmt.Errorf("%s %s: %s", logPrefix, errCodeSendingFails, err.Error()) } @@ -159,14 +151,7 @@ func InitiateDeviceAuthWithContext(ctx context.Context, sender Sender, oauthConf // CheckForUserCompletion takes a DeviceCode and checks with the Azure AD OAuth endpoint // to see if the device flow has: been completed, timed out, or otherwise failed -// Deprecated: use CheckForUserCompletionWithContext() instead. func CheckForUserCompletion(sender Sender, code *DeviceCode) (*Token, error) { - return CheckForUserCompletionWithContext(context.Background(), sender, code) -} - -// CheckForUserCompletionWithContext takes a DeviceCode and checks with the Azure AD OAuth endpoint -// to see if the device flow has: been completed, timed out, or otherwise failed -func CheckForUserCompletionWithContext(ctx context.Context, sender Sender, code *DeviceCode) (*Token, error) { v := url.Values{ "client_id": []string{code.ClientID}, "code": []string{*code.DeviceCode}, @@ -184,7 +169,7 @@ func CheckForUserCompletionWithContext(ctx context.Context, sender Sender, code req.ContentLength = int64(len(s)) req.Header.Set(contentType, mimeTypeFormPost) - resp, err := sender.Do(req.WithContext(ctx)) + resp, err := sender.Do(req) if err != nil { return nil, fmt.Errorf("%s %s: %s", logPrefix, errTokenSendingFails, err.Error()) } @@ -228,19 +213,12 @@ func CheckForUserCompletionWithContext(ctx context.Context, sender Sender, code // WaitForUserCompletion calls CheckForUserCompletion repeatedly until a token is granted or an error state occurs. // This prevents the user from looping and checking against 'ErrDeviceAuthorizationPending'. -// Deprecated: use WaitForUserCompletionWithContext() instead. func WaitForUserCompletion(sender Sender, code *DeviceCode) (*Token, error) { - return WaitForUserCompletionWithContext(context.Background(), sender, code) -} - -// WaitForUserCompletionWithContext calls CheckForUserCompletion repeatedly until a token is granted or an error -// state occurs. This prevents the user from looping and checking against 'ErrDeviceAuthorizationPending'. -func WaitForUserCompletionWithContext(ctx context.Context, sender Sender, code *DeviceCode) (*Token, error) { intervalDuration := time.Duration(*code.Interval) * time.Second waitDuration := intervalDuration for { - token, err := CheckForUserCompletionWithContext(ctx, sender, code) + token, err := CheckForUserCompletion(sender, code) if err == nil { return token, nil @@ -259,11 +237,6 @@ func WaitForUserCompletionWithContext(ctx context.Context, sender Sender, code * return nil, fmt.Errorf("%s Error waiting for user to complete device flow. Server told us to slow_down too much", logPrefix) } - select { - case <-time.After(waitDuration): - // noop - case <-ctx.Done(): - return nil, ctx.Err() - } + time.Sleep(waitDuration) } } diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go b/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go rename to vendor/github.com/Azure/go-autorest/autorest/adal/persist.go diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go b/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go new file mode 100644 index 000000000000..834401e00dec --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go @@ -0,0 +1,60 @@ +package adal + +// 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 ( + "net/http" +) + +const ( + contentType = "Content-Type" + mimeTypeFormPost = "application/x-www-form-urlencoded" +) + +// Sender is the interface that wraps the Do method to send HTTP requests. +// +// The standard http.Client conforms to this interface. +type Sender interface { + Do(*http.Request) (*http.Response, error) +} + +// SenderFunc is a method that implements the Sender interface. +type SenderFunc func(*http.Request) (*http.Response, error) + +// Do implements the Sender interface on SenderFunc. +func (sf SenderFunc) Do(r *http.Request) (*http.Response, error) { + return sf(r) +} + +// 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 + +// CreateSender creates, decorates, and returns, as a Sender, the default http.Client. +func CreateSender(decorators ...SendDecorator) Sender { + return DecorateSender(&http.Client{}, decorators...) +} + +// DecorateSender accepts a Sender and a, possibly empty, set of SendDecorators, which is applies to +// the Sender. Decorators are applied in the order received, but their affect upon the request +// depends on whether they are a pre-decorator (change the http.Request and then pass it along) or a +// post-decorator (pass the http.Request along and react to the results in http.Response). +func DecorateSender(s Sender, decorators ...SendDecorator) Sender { + for _, decorate := range decorators { + s = decorate(s) + } + return s +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/token.go b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go new file mode 100644 index 000000000000..effa87ab2fae --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go @@ -0,0 +1,985 @@ +package adal + +// 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 ( + "context" + "crypto/rand" + "crypto/rsa" + "crypto/sha1" + "crypto/x509" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "math" + "net" + "net/http" + "net/url" + "strings" + "sync" + "time" + + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/tracing" + "github.com/dgrijalva/jwt-go" +) + +const ( + defaultRefresh = 5 * time.Minute + + // OAuthGrantTypeDeviceCode is the "grant_type" identifier used in device flow + OAuthGrantTypeDeviceCode = "device_code" + + // OAuthGrantTypeClientCredentials is the "grant_type" identifier used in credential flows + OAuthGrantTypeClientCredentials = "client_credentials" + + // OAuthGrantTypeUserPass is the "grant_type" identifier used in username and password auth flows + OAuthGrantTypeUserPass = "password" + + // OAuthGrantTypeRefreshToken is the "grant_type" identifier used in refresh token flows + OAuthGrantTypeRefreshToken = "refresh_token" + + // OAuthGrantTypeAuthorizationCode is the "grant_type" identifier used in authorization code flows + OAuthGrantTypeAuthorizationCode = "authorization_code" + + // metadataHeader is the header required by MSI extension + metadataHeader = "Metadata" + + // msiEndpoint is the well known endpoint for getting MSI authentications tokens + msiEndpoint = "http://169.254.169.254/metadata/identity/oauth2/token" + + // the default number of attempts to refresh an MSI authentication token + defaultMaxMSIRefreshAttempts = 5 +) + +// OAuthTokenProvider is an interface which should be implemented by an access token retriever +type OAuthTokenProvider interface { + OAuthToken() string +} + +// TokenRefreshError is an interface used by errors returned during token refresh. +type TokenRefreshError interface { + error + Response() *http.Response +} + +// Refresher is an interface for token refresh functionality +type Refresher interface { + Refresh() error + RefreshExchange(resource string) error + EnsureFresh() error +} + +// RefresherWithContext is an interface for token refresh functionality +type RefresherWithContext interface { + RefreshWithContext(ctx context.Context) error + RefreshExchangeWithContext(ctx context.Context, resource string) error + EnsureFreshWithContext(ctx context.Context) error +} + +// TokenRefreshCallback is the type representing callbacks that will be called after +// a successful token refresh +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 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{} +} + +// Expires returns the time.Time when the Token expires. +func (t Token) Expires() time.Time { + s, err := t.ExpiresOn.Float64() + if err != nil { + s = -3600 + } + + expiration := date.NewUnixTimeFromSeconds(s) + + return time.Time(expiration).UTC() +} + +// IsExpired returns true if the Token is expired, false otherwise. +func (t Token) IsExpired() bool { + return t.WillExpireIn(0) +} + +// WillExpireIn returns true if the Token will expire after the passed time.Duration interval +// from now, false otherwise. +func (t Token) WillExpireIn(d time.Duration) bool { + return !t.Expires().After(time.Now().Add(d)) +} + +//OAuthToken return the current access token +func (t *Token) OAuthToken() string { + return t.AccessToken +} + +// ServicePrincipalSecret is an interface that allows various secret mechanism to fill the form +// that is submitted when acquiring an oAuth token. +type ServicePrincipalSecret interface { + SetAuthenticationValues(spt *ServicePrincipalToken, values *url.Values) error +} + +// ServicePrincipalNoSecret represents a secret type that contains no secret +// meaning it is not valid for fetching a fresh token. This is used by Manual +type ServicePrincipalNoSecret struct { +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret +// It only returns an error for the ServicePrincipalNoSecret type +func (noSecret *ServicePrincipalNoSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + return fmt.Errorf("Manually created ServicePrincipalToken does not contain secret material to retrieve a new access token") +} + +// MarshalJSON implements the json.Marshaler interface. +func (noSecret ServicePrincipalNoSecret) MarshalJSON() ([]byte, error) { + type tokenType struct { + Type string `json:"type"` + } + return json.Marshal(tokenType{ + Type: "ServicePrincipalNoSecret", + }) +} + +// ServicePrincipalTokenSecret implements ServicePrincipalSecret for client_secret type authorization. +type ServicePrincipalTokenSecret struct { + ClientSecret string `json:"value"` +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. +// It will populate the form submitted during oAuth Token Acquisition using the client_secret. +func (tokenSecret *ServicePrincipalTokenSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + v.Set("client_secret", tokenSecret.ClientSecret) + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (tokenSecret ServicePrincipalTokenSecret) MarshalJSON() ([]byte, error) { + type tokenType struct { + Type string `json:"type"` + Value string `json:"value"` + } + return json.Marshal(tokenType{ + Type: "ServicePrincipalTokenSecret", + Value: tokenSecret.ClientSecret, + }) +} + +// ServicePrincipalCertificateSecret implements ServicePrincipalSecret for generic RSA cert auth with signed JWTs. +type ServicePrincipalCertificateSecret struct { + Certificate *x509.Certificate + PrivateKey *rsa.PrivateKey +} + +// SignJwt returns the JWT signed with the certificate's private key. +func (secret *ServicePrincipalCertificateSecret) SignJwt(spt *ServicePrincipalToken) (string, error) { + hasher := sha1.New() + _, err := hasher.Write(secret.Certificate.Raw) + if err != nil { + return "", err + } + + thumbprint := base64.URLEncoding.EncodeToString(hasher.Sum(nil)) + + // The jti (JWT ID) claim provides a unique identifier for the JWT. + jti := make([]byte, 20) + _, err = rand.Read(jti) + if err != nil { + return "", err + } + + 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, + "sub": spt.inner.ClientID, + "jti": base64.URLEncoding.EncodeToString(jti), + "nbf": time.Now().Unix(), + "exp": time.Now().Add(time.Hour * 24).Unix(), + } + + signedString, err := token.SignedString(secret.PrivateKey) + return signedString, err +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. +// It will populate the form submitted during oAuth Token Acquisition using a JWT signed with a certificate. +func (secret *ServicePrincipalCertificateSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + jwt, err := secret.SignJwt(spt) + if err != nil { + return err + } + + v.Set("client_assertion", jwt) + v.Set("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer") + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (secret ServicePrincipalCertificateSecret) MarshalJSON() ([]byte, error) { + return nil, errors.New("marshalling ServicePrincipalCertificateSecret is not supported") +} + +// ServicePrincipalMSISecret implements ServicePrincipalSecret for machines running the MSI Extension. +type ServicePrincipalMSISecret struct { +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. +func (msiSecret *ServicePrincipalMSISecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (msiSecret ServicePrincipalMSISecret) MarshalJSON() ([]byte, error) { + return nil, errors.New("marshalling ServicePrincipalMSISecret is not supported") +} + +// ServicePrincipalUsernamePasswordSecret implements ServicePrincipalSecret for username and password auth. +type ServicePrincipalUsernamePasswordSecret struct { + Username string `json:"username"` + Password string `json:"password"` +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. +func (secret *ServicePrincipalUsernamePasswordSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + v.Set("username", secret.Username) + v.Set("password", secret.Password) + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (secret ServicePrincipalUsernamePasswordSecret) MarshalJSON() ([]byte, error) { + type tokenType struct { + Type string `json:"type"` + Username string `json:"username"` + Password string `json:"password"` + } + return json.Marshal(tokenType{ + Type: "ServicePrincipalUsernamePasswordSecret", + Username: secret.Username, + Password: secret.Password, + }) +} + +// ServicePrincipalAuthorizationCodeSecret implements ServicePrincipalSecret for authorization code auth. +type ServicePrincipalAuthorizationCodeSecret struct { + ClientSecret string `json:"value"` + AuthorizationCode string `json:"authCode"` + RedirectURI string `json:"redirect"` +} + +// SetAuthenticationValues is a method of the interface ServicePrincipalSecret. +func (secret *ServicePrincipalAuthorizationCodeSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error { + v.Set("code", secret.AuthorizationCode) + v.Set("client_secret", secret.ClientSecret) + v.Set("redirect_uri", secret.RedirectURI) + return nil +} + +// MarshalJSON implements the json.Marshaler interface. +func (secret ServicePrincipalAuthorizationCodeSecret) MarshalJSON() ([]byte, error) { + type tokenType struct { + Type string `json:"type"` + Value string `json:"value"` + AuthCode string `json:"authCode"` + Redirect string `json:"redirect"` + } + return json.Marshal(tokenType{ + Type: "ServicePrincipalAuthorizationCodeSecret", + Value: secret.ClientSecret, + AuthCode: secret.AuthorizationCode, + Redirect: secret.RedirectURI, + }) +} + +// ServicePrincipalToken encapsulates a Token created for a Service Principal. +type ServicePrincipalToken struct { + inner servicePrincipalToken + refreshLock *sync.RWMutex + sender Sender + refreshCallbacks []TokenRefreshCallback + // MaxMSIRefreshAttempts is the maximum number of attempts to refresh an MSI token. + MaxMSIRefreshAttempts int +} + +// MarshalTokenJSON returns the marshalled inner token. +func (spt ServicePrincipalToken) MarshalTokenJSON() ([]byte, error) { + return json.Marshal(spt.inner.Token) +} + +// SetRefreshCallbacks replaces any existing refresh callbacks with the specified callbacks. +func (spt *ServicePrincipalToken) SetRefreshCallbacks(callbacks []TokenRefreshCallback) { + spt.refreshCallbacks = callbacks +} + +// MarshalJSON implements the json.Marshaler interface. +func (spt ServicePrincipalToken) MarshalJSON() ([]byte, error) { + return json.Marshal(spt.inner) +} + +// UnmarshalJSON implements the json.Unmarshaler interface. +func (spt *ServicePrincipalToken) UnmarshalJSON(data []byte) error { + // need to determine the token type + raw := map[string]interface{}{} + err := json.Unmarshal(data, &raw) + if err != nil { + return err + } + secret := raw["secret"].(map[string]interface{}) + switch secret["type"] { + case "ServicePrincipalNoSecret": + spt.inner.Secret = &ServicePrincipalNoSecret{} + case "ServicePrincipalTokenSecret": + spt.inner.Secret = &ServicePrincipalTokenSecret{} + case "ServicePrincipalCertificateSecret": + return errors.New("unmarshalling ServicePrincipalCertificateSecret is not supported") + case "ServicePrincipalMSISecret": + return errors.New("unmarshalling ServicePrincipalMSISecret is not supported") + case "ServicePrincipalUsernamePasswordSecret": + spt.inner.Secret = &ServicePrincipalUsernamePasswordSecret{} + case "ServicePrincipalAuthorizationCodeSecret": + spt.inner.Secret = &ServicePrincipalAuthorizationCodeSecret{} + default: + return fmt.Errorf("unrecognized token type '%s'", secret["type"]) + } + err = json.Unmarshal(data, &spt.inner) + if err != nil { + return err + } + // 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 +} + +// internal type used for marshalling/unmarshalling +type servicePrincipalToken struct { + Token Token `json:"token"` + Secret ServicePrincipalSecret `json:"secret"` + OauthConfig OAuthConfig `json:"oauth"` + ClientID string `json:"clientID"` + Resource string `json:"resource"` + AutoRefresh bool `json:"autoRefresh"` + RefreshWithin time.Duration `json:"refreshWithin"` +} + +func validateOAuthConfig(oac OAuthConfig) error { + if oac.IsZero() { + return fmt.Errorf("parameter 'oauthConfig' cannot be zero-initialized") + } + return nil +} + +// NewServicePrincipalTokenWithSecret create a ServicePrincipalToken using the supplied ServicePrincipalSecret implementation. +func NewServicePrincipalTokenWithSecret(oauthConfig OAuthConfig, id string, resource string, secret ServicePrincipalSecret, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + if err := validateOAuthConfig(oauthConfig); err != nil { + return nil, err + } + if err := validateStringParam(id, "id"); err != nil { + return nil, err + } + if err := validateStringParam(resource, "resource"); err != nil { + return nil, err + } + if secret == nil { + return nil, fmt.Errorf("parameter 'secret' cannot be nil") + } + spt := &ServicePrincipalToken{ + inner: servicePrincipalToken{ + Token: newToken(), + OauthConfig: oauthConfig, + Secret: secret, + ClientID: id, + Resource: resource, + AutoRefresh: true, + RefreshWithin: defaultRefresh, + }, + refreshLock: &sync.RWMutex{}, + sender: &http.Client{Transport: tracing.Transport}, + refreshCallbacks: callbacks, + } + return spt, nil +} + +// NewServicePrincipalTokenFromManualToken creates a ServicePrincipalToken using the supplied token +func NewServicePrincipalTokenFromManualToken(oauthConfig OAuthConfig, clientID string, resource string, token Token, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + if err := validateOAuthConfig(oauthConfig); err != nil { + return nil, err + } + if err := validateStringParam(clientID, "clientID"); err != nil { + return nil, err + } + if err := validateStringParam(resource, "resource"); err != nil { + return nil, err + } + if token.IsZero() { + return nil, fmt.Errorf("parameter 'token' cannot be zero-initialized") + } + spt, err := NewServicePrincipalTokenWithSecret( + oauthConfig, + clientID, + resource, + &ServicePrincipalNoSecret{}, + callbacks...) + if err != nil { + return nil, err + } + + spt.inner.Token = token + + return spt, nil +} + +// NewServicePrincipalTokenFromManualTokenSecret creates a ServicePrincipalToken using the supplied token and secret +func NewServicePrincipalTokenFromManualTokenSecret(oauthConfig OAuthConfig, clientID string, resource string, token Token, secret ServicePrincipalSecret, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + if err := validateOAuthConfig(oauthConfig); err != nil { + return nil, err + } + if err := validateStringParam(clientID, "clientID"); err != nil { + return nil, err + } + if err := validateStringParam(resource, "resource"); err != nil { + return nil, err + } + if secret == nil { + return nil, fmt.Errorf("parameter 'secret' cannot be nil") + } + if token.IsZero() { + return nil, fmt.Errorf("parameter 'token' cannot be zero-initialized") + } + spt, err := NewServicePrincipalTokenWithSecret( + oauthConfig, + clientID, + resource, + secret, + callbacks...) + if err != nil { + return nil, err + } + + spt.inner.Token = token + + return spt, nil +} + +// NewServicePrincipalToken creates a ServicePrincipalToken from the supplied Service Principal +// credentials scoped to the named resource. +func NewServicePrincipalToken(oauthConfig OAuthConfig, clientID string, secret string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + if err := validateOAuthConfig(oauthConfig); err != nil { + return nil, err + } + if err := validateStringParam(clientID, "clientID"); err != nil { + return nil, err + } + if err := validateStringParam(secret, "secret"); err != nil { + return nil, err + } + if err := validateStringParam(resource, "resource"); err != nil { + return nil, err + } + return NewServicePrincipalTokenWithSecret( + oauthConfig, + clientID, + resource, + &ServicePrincipalTokenSecret{ + ClientSecret: secret, + }, + callbacks..., + ) +} + +// NewServicePrincipalTokenFromCertificate creates a ServicePrincipalToken from the supplied pkcs12 bytes. +func NewServicePrincipalTokenFromCertificate(oauthConfig OAuthConfig, clientID string, certificate *x509.Certificate, privateKey *rsa.PrivateKey, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + if err := validateOAuthConfig(oauthConfig); err != nil { + return nil, err + } + if err := validateStringParam(clientID, "clientID"); err != nil { + return nil, err + } + if err := validateStringParam(resource, "resource"); err != nil { + return nil, err + } + if certificate == nil { + return nil, fmt.Errorf("parameter 'certificate' cannot be nil") + } + if privateKey == nil { + return nil, fmt.Errorf("parameter 'privateKey' cannot be nil") + } + return NewServicePrincipalTokenWithSecret( + oauthConfig, + clientID, + resource, + &ServicePrincipalCertificateSecret{ + PrivateKey: privateKey, + Certificate: certificate, + }, + callbacks..., + ) +} + +// NewServicePrincipalTokenFromUsernamePassword creates a ServicePrincipalToken from the username and password. +func NewServicePrincipalTokenFromUsernamePassword(oauthConfig OAuthConfig, clientID string, username string, password string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + if err := validateOAuthConfig(oauthConfig); err != nil { + return nil, err + } + if err := validateStringParam(clientID, "clientID"); err != nil { + return nil, err + } + if err := validateStringParam(username, "username"); err != nil { + return nil, err + } + if err := validateStringParam(password, "password"); err != nil { + return nil, err + } + if err := validateStringParam(resource, "resource"); err != nil { + return nil, err + } + return NewServicePrincipalTokenWithSecret( + oauthConfig, + clientID, + resource, + &ServicePrincipalUsernamePasswordSecret{ + Username: username, + Password: password, + }, + callbacks..., + ) +} + +// NewServicePrincipalTokenFromAuthorizationCode creates a ServicePrincipalToken from the +func NewServicePrincipalTokenFromAuthorizationCode(oauthConfig OAuthConfig, clientID string, clientSecret string, authorizationCode string, redirectURI string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + + if err := validateOAuthConfig(oauthConfig); err != nil { + return nil, err + } + if err := validateStringParam(clientID, "clientID"); err != nil { + return nil, err + } + if err := validateStringParam(clientSecret, "clientSecret"); err != nil { + return nil, err + } + if err := validateStringParam(authorizationCode, "authorizationCode"); err != nil { + return nil, err + } + if err := validateStringParam(redirectURI, "redirectURI"); err != nil { + return nil, err + } + if err := validateStringParam(resource, "resource"); err != nil { + return nil, err + } + + return NewServicePrincipalTokenWithSecret( + oauthConfig, + clientID, + resource, + &ServicePrincipalAuthorizationCodeSecret{ + ClientSecret: clientSecret, + AuthorizationCode: authorizationCode, + RedirectURI: redirectURI, + }, + callbacks..., + ) +} + +// GetMSIVMEndpoint gets the MSI endpoint on Virtual Machines. +func GetMSIVMEndpoint() (string, error) { + return msiEndpoint, nil +} + +// NewServicePrincipalTokenFromMSI creates a ServicePrincipalToken via the MSI VM Extension. +// It will use the system assigned identity when creating the token. +func NewServicePrincipalTokenFromMSI(msiEndpoint, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + return newServicePrincipalTokenFromMSI(msiEndpoint, resource, nil, callbacks...) +} + +// NewServicePrincipalTokenFromMSIWithUserAssignedID creates a ServicePrincipalToken via the MSI VM Extension. +// It will use the specified user assigned identity when creating the token. +func NewServicePrincipalTokenFromMSIWithUserAssignedID(msiEndpoint, resource string, userAssignedID string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + return newServicePrincipalTokenFromMSI(msiEndpoint, resource, &userAssignedID, callbacks...) +} + +func newServicePrincipalTokenFromMSI(msiEndpoint, resource string, userAssignedID *string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) { + if err := validateStringParam(msiEndpoint, "msiEndpoint"); err != nil { + return nil, err + } + if err := validateStringParam(resource, "resource"); err != nil { + return nil, err + } + if userAssignedID != nil { + if err := validateStringParam(*userAssignedID, "userAssignedID"); err != nil { + return nil, err + } + } + // We set the oauth config token endpoint to be MSI's endpoint + msiEndpointURL, err := url.Parse(msiEndpoint) + if err != nil { + return nil, err + } + + v := url.Values{} + v.Set("resource", resource) + v.Set("api-version", "2018-02-01") + if userAssignedID != nil { + v.Set("client_id", *userAssignedID) + } + msiEndpointURL.RawQuery = v.Encode() + + spt := &ServicePrincipalToken{ + inner: servicePrincipalToken{ + Token: newToken(), + OauthConfig: OAuthConfig{ + TokenEndpoint: *msiEndpointURL, + }, + Secret: &ServicePrincipalMSISecret{}, + Resource: resource, + AutoRefresh: true, + RefreshWithin: defaultRefresh, + }, + refreshLock: &sync.RWMutex{}, + sender: &http.Client{Transport: tracing.Transport}, + refreshCallbacks: callbacks, + MaxMSIRefreshAttempts: defaultMaxMSIRefreshAttempts, + } + + if userAssignedID != nil { + spt.inner.ClientID = *userAssignedID + } + + return spt, nil +} + +// internal type that implements TokenRefreshError +type tokenRefreshError struct { + message string + resp *http.Response +} + +// Error implements the error interface which is part of the TokenRefreshError interface. +func (tre tokenRefreshError) Error() string { + return tre.message +} + +// Response implements the TokenRefreshError interface, it returns the raw HTTP response from the refresh operation. +func (tre tokenRefreshError) Response() *http.Response { + return tre.resp +} + +func newTokenRefreshError(message string, resp *http.Response) TokenRefreshError { + return tokenRefreshError{message: message, resp: resp} +} + +// EnsureFresh will refresh the token if it will expire within the refresh window (as set by +// RefreshWithin) and autoRefresh flag is on. This method is safe for concurrent use. +func (spt *ServicePrincipalToken) EnsureFresh() error { + return spt.EnsureFreshWithContext(context.Background()) +} + +// EnsureFreshWithContext will refresh the token if it will expire within the refresh window (as set by +// RefreshWithin) and autoRefresh flag is on. This method is safe for concurrent use. +func (spt *ServicePrincipalToken) EnsureFreshWithContext(ctx context.Context) error { + if spt.inner.AutoRefresh && spt.inner.Token.WillExpireIn(spt.inner.RefreshWithin) { + // take the write lock then check to see if the token was already refreshed + spt.refreshLock.Lock() + defer spt.refreshLock.Unlock() + if spt.inner.Token.WillExpireIn(spt.inner.RefreshWithin) { + return spt.refreshInternal(ctx, spt.inner.Resource) + } + } + return nil +} + +// InvokeRefreshCallbacks calls any TokenRefreshCallbacks that were added to the SPT during initialization +func (spt *ServicePrincipalToken) InvokeRefreshCallbacks(token Token) error { + if spt.refreshCallbacks != nil { + for _, callback := range spt.refreshCallbacks { + err := callback(spt.inner.Token) + if err != nil { + return fmt.Errorf("adal: TokenRefreshCallback handler failed. Error = '%v'", err) + } + } + } + return nil +} + +// Refresh obtains a fresh token for the Service Principal. +// This method is not safe for concurrent use and should be syncrhonized. +func (spt *ServicePrincipalToken) Refresh() error { + return spt.RefreshWithContext(context.Background()) +} + +// RefreshWithContext obtains a fresh token for the Service Principal. +// This method is not safe for concurrent use and should be syncrhonized. +func (spt *ServicePrincipalToken) RefreshWithContext(ctx context.Context) error { + spt.refreshLock.Lock() + defer spt.refreshLock.Unlock() + return spt.refreshInternal(ctx, spt.inner.Resource) +} + +// RefreshExchange refreshes the token, but for a different resource. +// This method is not safe for concurrent use and should be syncrhonized. +func (spt *ServicePrincipalToken) RefreshExchange(resource string) error { + return spt.RefreshExchangeWithContext(context.Background(), resource) +} + +// RefreshExchangeWithContext refreshes the token, but for a different resource. +// This method is not safe for concurrent use and should be syncrhonized. +func (spt *ServicePrincipalToken) RefreshExchangeWithContext(ctx context.Context, resource string) error { + spt.refreshLock.Lock() + defer spt.refreshLock.Unlock() + return spt.refreshInternal(ctx, resource) +} + +func (spt *ServicePrincipalToken) getGrantType() string { + switch spt.inner.Secret.(type) { + case *ServicePrincipalUsernamePasswordSecret: + return OAuthGrantTypeUserPass + case *ServicePrincipalAuthorizationCodeSecret: + return OAuthGrantTypeAuthorizationCode + default: + return OAuthGrantTypeClientCredentials + } +} + +func isIMDS(u url.URL) bool { + imds, err := url.Parse(msiEndpoint) + if err != nil { + return false + } + return u.Host == imds.Host && u.Path == imds.Path +} + +func (spt *ServicePrincipalToken) refreshInternal(ctx context.Context, resource string) error { + req, err := http.NewRequest(http.MethodPost, spt.inner.OauthConfig.TokenEndpoint.String(), nil) + if err != nil { + return fmt.Errorf("adal: Failed to build the refresh request. Error = '%v'", err) + } + req.Header.Add("User-Agent", UserAgent()) + req = req.WithContext(ctx) + if !isIMDS(spt.inner.OauthConfig.TokenEndpoint) { + v := url.Values{} + v.Set("client_id", spt.inner.ClientID) + v.Set("resource", resource) + + if spt.inner.Token.RefreshToken != "" { + v.Set("grant_type", OAuthGrantTypeRefreshToken) + v.Set("refresh_token", spt.inner.Token.RefreshToken) + // web apps must specify client_secret when refreshing tokens + // see https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-oauth-code#refreshing-the-access-tokens + if spt.getGrantType() == OAuthGrantTypeAuthorizationCode { + err := spt.inner.Secret.SetAuthenticationValues(spt, &v) + if err != nil { + return err + } + } + } else { + v.Set("grant_type", spt.getGrantType()) + err := spt.inner.Secret.SetAuthenticationValues(spt, &v) + if err != nil { + return err + } + } + + s := v.Encode() + body := ioutil.NopCloser(strings.NewReader(s)) + req.ContentLength = int64(len(s)) + req.Header.Set(contentType, mimeTypeFormPost) + req.Body = body + } + + if _, ok := spt.inner.Secret.(*ServicePrincipalMSISecret); ok { + req.Method = http.MethodGet + req.Header.Set(metadataHeader, "true") + } + + var resp *http.Response + if isIMDS(spt.inner.OauthConfig.TokenEndpoint) { + resp, err = retryForIMDS(spt.sender, req, spt.MaxMSIRefreshAttempts) + } else { + resp, err = spt.sender.Do(req) + } + if err != nil { + return newTokenRefreshError(fmt.Sprintf("adal: Failed to execute the refresh request. Error = '%v'", err), nil) + } + + defer resp.Body.Close() + rb, err := ioutil.ReadAll(resp.Body) + + if resp.StatusCode != http.StatusOK { + if err != nil { + return newTokenRefreshError(fmt.Sprintf("adal: Refresh request failed. Status Code = '%d'. Failed reading response body: %v", resp.StatusCode, err), resp) + } + return newTokenRefreshError(fmt.Sprintf("adal: Refresh request failed. Status Code = '%d'. Response body: %s", resp.StatusCode, string(rb)), resp) + } + + // for the following error cases don't return a TokenRefreshError. the operation succeeded + // but some transient failure happened during deserialization. by returning a generic error + // the retry logic will kick in (we don't retry on TokenRefreshError). + + if err != nil { + return fmt.Errorf("adal: Failed to read a new service principal token during refresh. Error = '%v'", err) + } + if len(strings.Trim(string(rb), " ")) == 0 { + return fmt.Errorf("adal: Empty service principal token received during refresh") + } + var token Token + err = json.Unmarshal(rb, &token) + if err != nil { + return fmt.Errorf("adal: Failed to unmarshal the service principal token during refresh. Error = '%v' JSON = '%s'", err, string(rb)) + } + + spt.inner.Token = token + + return spt.InvokeRefreshCallbacks(token) +} + +// retry logic specific to retrieving a token from the IMDS endpoint +func retryForIMDS(sender Sender, req *http.Request, maxAttempts int) (resp *http.Response, err error) { + // copied from client.go due to circular dependency + retries := []int{ + http.StatusRequestTimeout, // 408 + http.StatusTooManyRequests, // 429 + http.StatusInternalServerError, // 500 + http.StatusBadGateway, // 502 + http.StatusServiceUnavailable, // 503 + http.StatusGatewayTimeout, // 504 + } + // extra retry status codes specific to IMDS + retries = append(retries, + http.StatusNotFound, + http.StatusGone, + // all remaining 5xx + http.StatusNotImplemented, + http.StatusHTTPVersionNotSupported, + http.StatusVariantAlsoNegotiates, + http.StatusInsufficientStorage, + http.StatusLoopDetected, + http.StatusNotExtended, + http.StatusNetworkAuthenticationRequired) + + // see https://docs.microsoft.com/en-us/azure/active-directory/managed-service-identity/how-to-use-vm-token#retry-guidance + + const maxDelay time.Duration = 60 * time.Second + + attempt := 0 + delay := time.Duration(0) + + for attempt < maxAttempts { + resp, err = sender.Do(req) + // retry on temporary network errors, e.g. transient network failures. + // if we don't receive a response then assume we can't connect to the + // endpoint so we're likely not running on an Azure VM so don't retry. + if (err != nil && !isTemporaryNetworkError(err)) || resp == nil || resp.StatusCode == http.StatusOK || !containsInt(retries, resp.StatusCode) { + return + } + + // perform exponential backoff with a cap. + // must increment attempt before calculating delay. + attempt++ + // the base value of 2 is the "delta backoff" as specified in the guidance doc + delay += (time.Duration(math.Pow(2, float64(attempt))) * time.Second) + if delay > maxDelay { + delay = maxDelay + } + + select { + case <-time.After(delay): + // intentionally left blank + case <-req.Context().Done(): + err = req.Context().Err() + return + } + } + return +} + +// returns true if the specified error is a temporary network error or false if it's not. +// if the error doesn't implement the net.Error interface the return value is true. +func isTemporaryNetworkError(err error) bool { + if netErr, ok := err.(net.Error); !ok || (ok && netErr.Temporary()) { + return true + } + return false +} + +// returns true if slice ints contains the value n +func containsInt(ints []int, n int) bool { + for _, i := range ints { + if i == n { + return true + } + } + return false +} + +// SetAutoRefresh enables or disables automatic refreshing of stale tokens. +func (spt *ServicePrincipalToken) SetAutoRefresh(autoRefresh bool) { + spt.inner.AutoRefresh = autoRefresh +} + +// SetRefreshWithin sets the interval within which if the token will expire, EnsureFresh will +// refresh the token. +func (spt *ServicePrincipalToken) SetRefreshWithin(d time.Duration) { + spt.inner.RefreshWithin = d + return +} + +// SetSender sets the http.Client used when obtaining the Service Principal token. An +// undecorated http.Client is used by default. +func (spt *ServicePrincipalToken) SetSender(s Sender) { spt.sender = s } + +// OAuthToken implements the OAuthTokenProvider interface. It returns the current access token. +func (spt *ServicePrincipalToken) OAuthToken() string { + spt.refreshLock.RLock() + defer spt.refreshLock.RUnlock() + return spt.inner.Token.OAuthToken() +} + +// Token returns a copy of the current token. +func (spt *ServicePrincipalToken) Token() Token { + spt.refreshLock.RLock() + defer spt.refreshLock.RUnlock() + return spt.inner.Token +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/adal/version.go b/vendor/github.com/Azure/go-autorest/autorest/adal/version.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/adal/version.go rename to vendor/github.com/Azure/go-autorest/autorest/adal/version.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/authorization.go b/vendor/github.com/Azure/go-autorest/autorest/authorization.go similarity index 81% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/authorization.go rename to vendor/github.com/Azure/go-autorest/autorest/authorization.go index 54e87b5b648c..2e24b4b3971e 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/authorization.go +++ b/vendor/github.com/Azure/go-autorest/autorest/authorization.go @@ -15,7 +15,6 @@ package autorest // limitations under the License. import ( - "crypto/tls" "encoding/base64" "fmt" "net/http" @@ -23,6 +22,7 @@ import ( "strings" "github.com/Azure/go-autorest/autorest/adal" + "github.com/Azure/go-autorest/tracing" ) const ( @@ -149,11 +149,11 @@ type BearerAuthorizerCallback struct { // NewBearerAuthorizerCallback creates a bearer authorization callback. The callback // is invoked when the HTTP request is submitted. -func NewBearerAuthorizerCallback(s Sender, callback BearerAuthorizerCallbackFunc) *BearerAuthorizerCallback { - if s == nil { - s = sender(tls.RenegotiateNever) +func NewBearerAuthorizerCallback(sender Sender, callback BearerAuthorizerCallbackFunc) *BearerAuthorizerCallback { + if sender == nil { + sender = &http.Client{Transport: tracing.Transport} } - return &BearerAuthorizerCallback{sender: s, callback: callback} + return &BearerAuthorizerCallback{sender: sender, callback: callback} } // WithAuthorization returns a PrepareDecorator that adds an HTTP Authorization header whose value @@ -285,52 +285,3 @@ func (ba *BasicAuthorizer) WithAuthorization() PrepareDecorator { return NewAPIKeyAuthorizerWithHeaders(headers).WithAuthorization() } - -// MultiTenantServicePrincipalTokenAuthorizer provides authentication across tenants. -type MultiTenantServicePrincipalTokenAuthorizer interface { - WithAuthorization() PrepareDecorator -} - -// NewMultiTenantServicePrincipalTokenAuthorizer crates a BearerAuthorizer using the given token provider -func NewMultiTenantServicePrincipalTokenAuthorizer(tp adal.MultitenantOAuthTokenProvider) MultiTenantServicePrincipalTokenAuthorizer { - return &multiTenantSPTAuthorizer{tp: tp} -} - -type multiTenantSPTAuthorizer struct { - tp adal.MultitenantOAuthTokenProvider -} - -// WithAuthorization returns a PrepareDecorator that adds an HTTP Authorization header using the -// primary token along with the auxiliary authorization header using the auxiliary tokens. -// -// By default, the token will be automatically refreshed through the Refresher interface. -func (mt multiTenantSPTAuthorizer) WithAuthorization() PrepareDecorator { - return func(p Preparer) Preparer { - return PreparerFunc(func(r *http.Request) (*http.Request, error) { - r, err := p.Prepare(r) - if err != nil { - return r, err - } - if refresher, ok := mt.tp.(adal.RefresherWithContext); ok { - err = refresher.EnsureFreshWithContext(r.Context()) - if err != nil { - var resp *http.Response - if tokError, ok := err.(adal.TokenRefreshError); ok { - resp = tokError.Response() - } - return r, NewErrorWithError(err, "azure.multiTenantSPTAuthorizer", "WithAuthorization", resp, - "Failed to refresh one or more Tokens for request to %s", r.URL) - } - } - r, err = Prepare(r, WithHeader(headerAuthorization, fmt.Sprintf("Bearer %s", mt.tp.PrimaryOAuthToken()))) - if err != nil { - return r, err - } - auxTokens := mt.tp.AuxiliaryOAuthTokens() - for i := range auxTokens { - auxTokens[i] = fmt.Sprintf("Bearer %s", auxTokens[i]) - } - return Prepare(r, WithHeader(headerAuxAuthorization, strings.Join(auxTokens, "; "))) - }) - } -} diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/autorest.go b/vendor/github.com/Azure/go-autorest/autorest/autorest.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/autorest.go rename to vendor/github.com/Azure/go-autorest/autorest/autorest.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/async.go b/vendor/github.com/Azure/go-autorest/autorest/azure/async.go similarity index 90% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/async.go rename to vendor/github.com/Azure/go-autorest/autorest/azure/async.go index 1cb41cbeb1b8..0041eacf759e 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/async.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/async.go @@ -45,7 +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 { - pt pollingTracker + 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} } // NewFutureFromResponse returns a new Future object initialized @@ -79,6 +86,12 @@ func (f Future) PollingMethod() PollingMethodType { return f.pt.pollingMethod() } +// Done queries the service to see if the operation has completed. +// Deprecated: Use DoneWithContext() +func (f *Future) Done(sender autorest.Sender) (bool, error) { + return f.DoneWithContext(context.Background(), sender) +} + // 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") @@ -91,6 +104,20 @@ func (f *Future) DoneWithContext(ctx context.Context, sender autorest.Sender) (d tracing.EndSpan(ctx, sc, err) }() + // support for legacy Future implementation + if f.req != nil { + resp, err := sender.Do(f.req) + if err != nil { + return false, err + } + pt, err := createPollingTracker(resp) + if err != nil { + return false, err + } + f.pt = pt + f.req = nil + } + // end legacy if f.pt == nil { return false, autorest.NewError("Future", "Done", "future is not initialized") } @@ -141,6 +168,15 @@ 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 @@ -417,11 +453,6 @@ func (pt *pollingTrackerBase) pollForStatus(ctx context.Context, sender autorest } req = req.WithContext(ctx) - preparer := autorest.CreatePreparer(autorest.GetPrepareDecorators(ctx)...) - req, err = preparer.Prepare(req) - if err != nil { - return autorest.NewErrorWithError(err, "pollingTrackerBase", "pollForStatus", nil, "failed preparing HTTP request") - } pt.resp, err = sender.Do(req) if err != nil { return autorest.NewErrorWithError(err, "pollingTrackerBase", "pollForStatus", nil, "failed to send HTTP request") @@ -888,6 +919,43 @@ 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/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go b/vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go similarity index 95% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go rename to vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go index 5f02026b391c..20855d4ab368 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go @@ -40,7 +40,6 @@ import ( const ( SubscriptionID = "AZURE_SUBSCRIPTION_ID" TenantID = "AZURE_TENANT_ID" - AuxiliaryTenantIDs = "AZURE_AUXILIARY_TENANT_IDS" ClientID = "AZURE_CLIENT_ID" ClientSecret = "AZURE_CLIENT_SECRET" CertificatePath = "AZURE_CERTIFICATE_PATH" @@ -97,7 +96,6 @@ func GetSettingsFromEnvironment() (s EnvironmentSettings, err error) { } s.setValue(SubscriptionID) s.setValue(TenantID) - s.setValue(AuxiliaryTenantIDs) s.setValue(ClientID) s.setValue(ClientSecret) s.setValue(CertificatePath) @@ -147,12 +145,6 @@ func (settings EnvironmentSettings) GetClientCredentials() (ClientCredentialsCon config := NewClientCredentialsConfig(clientID, secret, tenantID) config.AADEndpoint = settings.Environment.ActiveDirectoryEndpoint config.Resource = settings.Values[Resource] - if auxTenants, ok := settings.Values[AuxiliaryTenantIDs]; ok { - config.AuxTenants = strings.Split(auxTenants, ";") - for i := range config.AuxTenants { - config.AuxTenants[i] = strings.TrimSpace(config.AuxTenants[i]) - } - } return config, nil } @@ -554,7 +546,6 @@ type ClientCredentialsConfig struct { ClientID string ClientSecret string TenantID string - AuxTenants []string AADEndpoint string Resource string } @@ -568,29 +559,13 @@ func (ccc ClientCredentialsConfig) ServicePrincipalToken() (*adal.ServicePrincip return adal.NewServicePrincipalToken(*oauthConfig, ccc.ClientID, ccc.ClientSecret, ccc.Resource) } -// MultiTenantServicePrincipalToken creates a MultiTenantServicePrincipalToken from client credentials. -func (ccc ClientCredentialsConfig) MultiTenantServicePrincipalToken() (*adal.MultiTenantServicePrincipalToken, error) { - oauthConfig, err := adal.NewMultiTenantOAuthConfig(ccc.AADEndpoint, ccc.TenantID, ccc.AuxTenants, adal.OAuthOptions{}) - if err != nil { - return nil, err - } - return adal.NewMultiTenantServicePrincipalToken(oauthConfig, ccc.ClientID, ccc.ClientSecret, ccc.Resource) -} - // Authorizer gets the authorizer from client credentials. func (ccc ClientCredentialsConfig) Authorizer() (autorest.Authorizer, error) { - if len(ccc.AuxTenants) == 0 { - spToken, err := ccc.ServicePrincipalToken() - if err != nil { - return nil, fmt.Errorf("failed to get SPT from client credentials: %v", err) - } - return autorest.NewBearerAuthorizer(spToken), nil - } - mtSPT, err := ccc.MultiTenantServicePrincipalToken() + spToken, err := ccc.ServicePrincipalToken() if err != nil { - return nil, fmt.Errorf("failed to get multitenant SPT from client credentials: %v", err) + return nil, fmt.Errorf("failed to get oauth token from client credentials: %v", err) } - return autorest.NewMultiTenantServicePrincipalTokenAuthorizer(mtSPT), nil + return autorest.NewBearerAuthorizer(spToken), nil } // ClientCertificateConfig provides the options to get a bearer authorizer from a client certificate. @@ -715,7 +690,7 @@ type MSIConfig struct { // Authorizer gets the authorizer from MSI. func (mc MSIConfig) Authorizer() (autorest.Authorizer, error) { - msiEndpoint, err := adal.GetMSIEndpoint() + msiEndpoint, err := adal.GetMSIVMEndpoint() if err != nil { return nil, err } diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go b/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go similarity index 94% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go rename to vendor/github.com/Azure/go-autorest/autorest/azure/azure.go index 26be936b7e5f..3a0a439ff930 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go @@ -17,7 +17,6 @@ package azure // limitations under the License. import ( - "bytes" "encoding/json" "fmt" "io/ioutil" @@ -144,7 +143,7 @@ type RequestError struct { autorest.DetailedError // The error returned by the Azure service. - ServiceError *ServiceError `json:"error" xml:"Error"` + ServiceError *ServiceError `json:"error"` // The request id (from the x-ms-request-id-header) of the request. RequestID string @@ -286,34 +285,26 @@ func WithErrorUnlessStatusCode(codes ...int) autorest.RespondDecorator { var e RequestError defer resp.Body.Close() - encodedAs := autorest.EncodedAsJSON - if strings.Contains(resp.Header.Get("Content-Type"), "xml") { - encodedAs = autorest.EncodedAsXML - } - // Copy and replace the Body in case it does not contain an error object. // This will leave the Body available to the caller. - b, decodeErr := autorest.CopyAndDecode(encodedAs, resp.Body, &e) + b, decodeErr := autorest.CopyAndDecode(autorest.EncodedAsJSON, resp.Body, &e) resp.Body = ioutil.NopCloser(&b) if decodeErr != nil { return fmt.Errorf("autorest/azure: error response cannot be parsed: %q error: %v", b.String(), decodeErr) } if e.ServiceError == nil { // Check if error is unwrapped ServiceError - decoder := autorest.NewDecoder(encodedAs, bytes.NewReader(b.Bytes())) - if err := decoder.Decode(&e.ServiceError); err != nil { + if err := json.Unmarshal(b.Bytes(), &e.ServiceError); err != nil { return err } } if e.ServiceError.Message == "" { // if we're here it means the returned error wasn't OData v4 compliant. - // try to unmarshal the body in hopes of getting something. + // try to unmarshal the body as raw JSON in hopes of getting something. rawBody := map[string]interface{}{} - decoder := autorest.NewDecoder(encodedAs, bytes.NewReader(b.Bytes())) - if err := decoder.Decode(&rawBody); err != nil { + if err := json.Unmarshal(b.Bytes(), &rawBody); err != nil { return err } - e.ServiceError = &ServiceError{ Code: "Unknown", Message: "Unknown service error", diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/cli/profile.go b/vendor/github.com/Azure/go-autorest/autorest/azure/cli/profile.go similarity index 95% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/cli/profile.go rename to vendor/github.com/Azure/go-autorest/autorest/azure/cli/profile.go index f45c3a516d9f..a336b958d463 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/cli/profile.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/cli/profile.go @@ -51,13 +51,9 @@ type User struct { const azureProfileJSON = "azureProfile.json" -func configDir() string { - return os.Getenv("AZURE_CONFIG_DIR") -} - // ProfilePath returns the path where the Azure Profile is stored from the Azure CLI func ProfilePath() (string, error) { - if cfgDir := configDir(); cfgDir != "" { + if cfgDir := os.Getenv("AZURE_CONFIG_DIR"); cfgDir != "" { return filepath.Join(cfgDir, azureProfileJSON), nil } return homedir.Expand("~/.azure/" + azureProfileJSON) 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 000000000000..810075ba61f8 --- /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 new file mode 100644 index 000000000000..85d3202afece --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go @@ -0,0 +1,196 @@ +package azure + +// 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 ( + "encoding/json" + "fmt" + "io/ioutil" + "os" + "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" + +var environments = map[string]Environment{ + "AZURECHINACLOUD": ChinaCloud, + "AZUREGERMANCLOUD": GermanCloud, + "AZUREPUBLICCLOUD": PublicCloud, + "AZUREUSGOVERNMENTCLOUD": USGovernmentCloud, +} + +// 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"` + CosmosDBDNSSuffix string `json:"cosmosDBDNSSuffix"` + TokenAudience string `json:"tokenAudience"` +} + +var ( + // PublicCloud is the default public Azure cloud environment + PublicCloud = Environment{ + Name: "AzurePublicCloud", + ManagementPortalURL: "https://manage.windowsazure.com/", + PublishSettingsURL: "https://manage.windowsazure.com/publishsettings/index", + ServiceManagementEndpoint: "https://management.core.windows.net/", + ResourceManagerEndpoint: "https://management.azure.com/", + ActiveDirectoryEndpoint: "https://login.microsoftonline.com/", + GalleryEndpoint: "https://gallery.azure.com/", + KeyVaultEndpoint: "https://vault.azure.net/", + GraphEndpoint: "https://graph.windows.net/", + ServiceBusEndpoint: "https://servicebus.windows.net/", + BatchManagementEndpoint: "https://batch.core.windows.net/", + StorageEndpointSuffix: "core.windows.net", + SQLDatabaseDNSSuffix: "database.windows.net", + TrafficManagerDNSSuffix: "trafficmanager.net", + KeyVaultDNSSuffix: "vault.azure.net", + ServiceBusEndpointSuffix: "servicebus.windows.net", + ServiceManagementVMDNSSuffix: "cloudapp.net", + ResourceManagerVMDNSSuffix: "cloudapp.azure.com", + ContainerRegistryDNSSuffix: "azurecr.io", + CosmosDBDNSSuffix: "documents.azure.com", + TokenAudience: "https://management.azure.com/", + } + + // USGovernmentCloud is the cloud environment for the US Government + USGovernmentCloud = Environment{ + Name: "AzureUSGovernmentCloud", + ManagementPortalURL: "https://manage.windowsazure.us/", + PublishSettingsURL: "https://manage.windowsazure.us/publishsettings/index", + ServiceManagementEndpoint: "https://management.core.usgovcloudapi.net/", + ResourceManagerEndpoint: "https://management.usgovcloudapi.net/", + ActiveDirectoryEndpoint: "https://login.microsoftonline.us/", + GalleryEndpoint: "https://gallery.usgovcloudapi.net/", + KeyVaultEndpoint: "https://vault.usgovcloudapi.net/", + GraphEndpoint: "https://graph.windows.net/", + ServiceBusEndpoint: "https://servicebus.usgovcloudapi.net/", + BatchManagementEndpoint: "https://batch.core.usgovcloudapi.net/", + StorageEndpointSuffix: "core.usgovcloudapi.net", + SQLDatabaseDNSSuffix: "database.usgovcloudapi.net", + TrafficManagerDNSSuffix: "usgovtrafficmanager.net", + KeyVaultDNSSuffix: "vault.usgovcloudapi.net", + ServiceBusEndpointSuffix: "servicebus.usgovcloudapi.net", + ServiceManagementVMDNSSuffix: "usgovcloudapp.net", + ResourceManagerVMDNSSuffix: "cloudapp.windowsazure.us", + ContainerRegistryDNSSuffix: "azurecr.us", + CosmosDBDNSSuffix: "documents.azure.us", + TokenAudience: "https://management.usgovcloudapi.net/", + } + + // ChinaCloud is the cloud environment operated in China + ChinaCloud = Environment{ + Name: "AzureChinaCloud", + ManagementPortalURL: "https://manage.chinacloudapi.com/", + PublishSettingsURL: "https://manage.chinacloudapi.com/publishsettings/index", + ServiceManagementEndpoint: "https://management.core.chinacloudapi.cn/", + ResourceManagerEndpoint: "https://management.chinacloudapi.cn/", + ActiveDirectoryEndpoint: "https://login.chinacloudapi.cn/", + GalleryEndpoint: "https://gallery.chinacloudapi.cn/", + KeyVaultEndpoint: "https://vault.azure.cn/", + GraphEndpoint: "https://graph.chinacloudapi.cn/", + ServiceBusEndpoint: "https://servicebus.chinacloudapi.cn/", + BatchManagementEndpoint: "https://batch.chinacloudapi.cn/", + StorageEndpointSuffix: "core.chinacloudapi.cn", + SQLDatabaseDNSSuffix: "database.chinacloudapi.cn", + TrafficManagerDNSSuffix: "trafficmanager.cn", + KeyVaultDNSSuffix: "vault.azure.cn", + ServiceBusEndpointSuffix: "servicebus.chinacloudapi.cn", + ServiceManagementVMDNSSuffix: "chinacloudapp.cn", + ResourceManagerVMDNSSuffix: "cloudapp.azure.cn", + ContainerRegistryDNSSuffix: "azurecr.cn", + CosmosDBDNSSuffix: "documents.azure.cn", + TokenAudience: "https://management.chinacloudapi.cn/", + } + + // GermanCloud is the cloud environment operated in Germany + GermanCloud = Environment{ + Name: "AzureGermanCloud", + ManagementPortalURL: "http://portal.microsoftazure.de/", + PublishSettingsURL: "https://manage.microsoftazure.de/publishsettings/index", + ServiceManagementEndpoint: "https://management.core.cloudapi.de/", + ResourceManagerEndpoint: "https://management.microsoftazure.de/", + ActiveDirectoryEndpoint: "https://login.microsoftonline.de/", + GalleryEndpoint: "https://gallery.cloudapi.de/", + KeyVaultEndpoint: "https://vault.microsoftazure.de/", + GraphEndpoint: "https://graph.cloudapi.de/", + ServiceBusEndpoint: "https://servicebus.cloudapi.de/", + BatchManagementEndpoint: "https://batch.cloudapi.de/", + StorageEndpointSuffix: "core.cloudapi.de", + SQLDatabaseDNSSuffix: "database.cloudapi.de", + TrafficManagerDNSSuffix: "azuretrafficmanager.de", + KeyVaultDNSSuffix: "vault.microsoftazure.de", + ServiceBusEndpointSuffix: "servicebus.cloudapi.de", + ServiceManagementVMDNSSuffix: "azurecloudapp.de", + ResourceManagerVMDNSSuffix: "cloudapp.microsoftazure.de", + // ContainerRegistryDNSSuffix: "", ACR not present yet in the German Cloud + CosmosDBDNSSuffix: "documents.microsoftazure.de", + TokenAudience: "https://management.microsoftazure.de/", + } +) + +// EnvironmentFromName returns an Environment based on the common name specified. +func EnvironmentFromName(name string) (Environment, error) { + // IMPORTANT + // As per @radhikagupta5: + // This is technical debt, fundamentally here because Kubernetes is not currently accepting + // contributions to the providers. Once that is an option, the provider should be updated to + // directly call `EnvironmentFromFile`. Until then, we rely on dispatching Azure Stack environment creation + // from this method based on the name that is provided to us. + if strings.EqualFold(name, "AZURESTACKCLOUD") { + return EnvironmentFromFile(os.Getenv(EnvironmentFilepathName)) + } + + name = strings.ToUpper(name) + env, ok := environments[name] + if !ok { + return env, fmt.Errorf("autorest/azure: There is no cloud environment matching the name %q", name) + } + + return env, nil +} + +// EnvironmentFromFile loads an Environment from a configuration file available on disk. +// This function is particularly useful in the Hybrid Cloud model, where one must define their own +// endpoints. +func EnvironmentFromFile(location string) (unmarshaled Environment, err error) { + fileContents, err := ioutil.ReadFile(location) + if err != nil { + return + } + + err = json.Unmarshal(fileContents, &unmarshaled) + + return +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/metadata_environment.go b/vendor/github.com/Azure/go-autorest/autorest/azure/metadata_environment.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/metadata_environment.go rename to vendor/github.com/Azure/go-autorest/autorest/azure/metadata_environment.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go b/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go similarity index 95% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go rename to vendor/github.com/Azure/go-autorest/autorest/azure/rp.go index c6d39f686655..86ce9f2b5b1e 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go @@ -47,15 +47,11 @@ func DoRetryWithRegistration(client autorest.Client) autorest.SendDecorator { if resp.StatusCode != http.StatusConflict || client.SkipResourceProviderRegistration { return resp, err } - var re RequestError - if strings.Contains(r.Header.Get("Content-Type"), "xml") { - // XML errors (e.g. Storage Data Plane) only return the inner object - err = autorest.Respond(resp, autorest.ByUnmarshallingXML(&re.ServiceError)) - } else { - err = autorest.Respond(resp, autorest.ByUnmarshallingJSON(&re)) - } - + err = autorest.Respond( + resp, + autorest.ByUnmarshallingJSON(&re), + ) if err != nil { return resp, err } diff --git a/vendor/github.com/Azure/go-autorest/autorest/client.go b/vendor/github.com/Azure/go-autorest/autorest/client.go new file mode 100644 index 000000000000..9520001fc575 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/client.go @@ -0,0 +1,285 @@ +package autorest + +// 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" + "crypto/tls" + "fmt" + "io" + "io/ioutil" + "log" + "net/http" + "net/http/cookiejar" + "strings" + "time" + + "github.com/Azure/go-autorest/logger" + "github.com/Azure/go-autorest/tracing" +) + +const ( + // DefaultPollingDelay is a reasonable delay between polling requests. + DefaultPollingDelay = 60 * time.Second + + // DefaultPollingDuration is a reasonable total polling duration. + DefaultPollingDuration = 15 * time.Minute + + // DefaultRetryAttempts is number of attempts for retry status codes (5xx). + DefaultRetryAttempts = 3 + + // DefaultRetryDuration is the duration to wait between retries. + DefaultRetryDuration = 30 * time.Second +) + +var ( + // StatusCodesForRetry are a defined group of status code for which the client will retry + StatusCodesForRetry = []int{ + http.StatusRequestTimeout, // 408 + http.StatusTooManyRequests, // 429 + http.StatusInternalServerError, // 500 + http.StatusBadGateway, // 502 + http.StatusServiceUnavailable, // 503 + http.StatusGatewayTimeout, // 504 + } +) + +const ( + requestFormat = `HTTP Request Begin =================================================== +%s +===================================================== HTTP Request End +` + responseFormat = `HTTP Response Begin =================================================== +%s +===================================================== HTTP Response End +` +) + +// Response serves as the base for all responses from generated clients. It provides access to the +// last http.Response. +type Response struct { + *http.Response `json:"-"` +} + +// LoggingInspector implements request and response inspectors that log the full request and +// response to a supplied log. +type LoggingInspector struct { + Logger *log.Logger +} + +// WithInspection returns a PrepareDecorator that emits the http.Request to the supplied logger. The +// body is restored after being emitted. +// +// Note: Since it reads the entire Body, this decorator should not be used where body streaming is +// important. It is best used to trace JSON or similar body values. +func (li LoggingInspector) WithInspection() PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + var body, b bytes.Buffer + + defer r.Body.Close() + + r.Body = ioutil.NopCloser(io.TeeReader(r.Body, &body)) + if err := r.Write(&b); err != nil { + return nil, fmt.Errorf("Failed to write response: %v", err) + } + + li.Logger.Printf(requestFormat, b.String()) + + r.Body = ioutil.NopCloser(&body) + return p.Prepare(r) + }) + } +} + +// ByInspecting returns a RespondDecorator that emits the http.Response to the supplied logger. The +// body is restored after being emitted. +// +// Note: Since it reads the entire Body, this decorator should not be used where body streaming is +// important. It is best used to trace JSON or similar body values. +func (li LoggingInspector) ByInspecting() RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + var body, b bytes.Buffer + defer resp.Body.Close() + resp.Body = ioutil.NopCloser(io.TeeReader(resp.Body, &body)) + if err := resp.Write(&b); err != nil { + return fmt.Errorf("Failed to write response: %v", err) + } + + li.Logger.Printf(responseFormat, b.String()) + + resp.Body = ioutil.NopCloser(&body) + return r.Respond(resp) + }) + } +} + +// Client is the base for autorest generated clients. It provides default, "do nothing" +// implementations of an Authorizer, RequestInspector, and ResponseInspector. It also returns the +// standard, undecorated http.Client as a default Sender. +// +// Generated clients should also use Error (see NewError and NewErrorWithError) for errors and +// return responses that compose with Response. +// +// Most customization of generated clients is best achieved by supplying a custom Authorizer, custom +// RequestInspector, and / or custom ResponseInspector. Users may log requests, implement circuit +// breakers (see https://msdn.microsoft.com/en-us/library/dn589784.aspx) or otherwise influence +// sending the request by providing a decorated Sender. +type Client struct { + Authorizer Authorizer + Sender Sender + RequestInspector PrepareDecorator + ResponseInspector RespondDecorator + + // PollingDelay sets the polling frequency used in absence of a Retry-After HTTP header + 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. + RetryAttempts int + + // RetryDuration sets the delay duration for retries. + RetryDuration time.Duration + + // UserAgent, if not empty, will be set as the HTTP User-Agent header on all requests sent + // through the Do method. + UserAgent string + + Jar http.CookieJar + + // Set to true to skip attempted registration of resource providers (false by default). + SkipResourceProviderRegistration bool +} + +// NewClientWithUserAgent returns an instance of a Client with the UserAgent set to the passed +// string. +func NewClientWithUserAgent(ua string) Client { + c := Client{ + PollingDelay: DefaultPollingDelay, + PollingDuration: DefaultPollingDuration, + RetryAttempts: DefaultRetryAttempts, + RetryDuration: DefaultRetryDuration, + UserAgent: UserAgent(), + } + c.Sender = c.sender() + c.AddToUserAgent(ua) + return c +} + +// AddToUserAgent adds an extension to the current user agent +func (c *Client) AddToUserAgent(extension string) error { + if extension != "" { + c.UserAgent = fmt.Sprintf("%s %s", c.UserAgent, extension) + return nil + } + return fmt.Errorf("Extension was empty, User Agent stayed as %s", c.UserAgent) +} + +// Do implements the Sender interface by invoking the active Sender after applying authorization. +// If Sender is not set, it uses a new instance of http.Client. In both cases it will, if UserAgent +// is set, apply set the User-Agent header. +func (c Client) Do(r *http.Request) (*http.Response, error) { + if r.UserAgent() == "" { + r, _ = Prepare(r, + WithUserAgent(c.UserAgent)) + } + // NOTE: c.WithInspection() must be last in the list so that it can inspect all preceding operations + r, err := Prepare(r, + c.WithAuthorization(), + c.WithInspection()) + if err != nil { + var resp *http.Response + if detErr, ok := err.(DetailedError); ok { + // if the authorization failed (e.g. invalid credentials) there will + // be a response associated with the error, be sure to return it. + resp = detErr.Response + } + return resp, NewErrorWithError(err, "autorest/Client", "Do", nil, "Preparing request failed") + } + logger.Instance.WriteRequest(r, logger.Filter{ + Header: func(k string, v []string) (bool, []string) { + // remove the auth token from the log + if strings.EqualFold(k, "Authorization") || strings.EqualFold(k, "Ocp-Apim-Subscription-Key") { + v = []string{"**REDACTED**"} + } + return true, v + }, + }) + resp, err := SendWithSender(c.sender(), 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 { + if c.Sender == nil { + // Use behaviour compatible with DefaultTransport, but require TLS minimum version. + var defaultTransport = http.DefaultTransport.(*http.Transport) + + tracing.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, + }, + } + + j, _ := cookiejar.New(nil) + return &http.Client{Jar: j, Transport: tracing.Transport} + } + + return c.Sender +} + +// WithAuthorization is a convenience method that returns the WithAuthorization PrepareDecorator +// from the current Authorizer. If not Authorizer is set, it uses the NullAuthorizer. +func (c Client) WithAuthorization() PrepareDecorator { + return c.authorizer().WithAuthorization() +} + +// authorizer returns the Authorizer to use. +func (c Client) authorizer() Authorizer { + if c.Authorizer == nil { + return NullAuthorizer{} + } + return c.Authorizer +} + +// WithInspection is a convenience method that passes the request to the supplied RequestInspector, +// if present, or returns the WithNothing PrepareDecorator otherwise. +func (c Client) WithInspection() PrepareDecorator { + if c.RequestInspector == nil { + return WithNothing() + } + return c.RequestInspector +} + +// ByInspecting is a convenience method that passes the response to the supplied ResponseInspector, +// if present, or returns the ByIgnoring RespondDecorator otherwise. +func (c Client) ByInspecting() RespondDecorator { + if c.ResponseInspector == nil { + return ByIgnoring() + } + return c.ResponseInspector +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/date/date.go b/vendor/github.com/Azure/go-autorest/autorest/date/date.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/date/date.go rename to vendor/github.com/Azure/go-autorest/autorest/date/date.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/date/time.go b/vendor/github.com/Azure/go-autorest/autorest/date/time.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/date/time.go rename to vendor/github.com/Azure/go-autorest/autorest/date/time.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go b/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go rename to vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go b/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go rename to vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/date/utility.go b/vendor/github.com/Azure/go-autorest/autorest/date/utility.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/date/utility.go rename to vendor/github.com/Azure/go-autorest/autorest/date/utility.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/error.go b/vendor/github.com/Azure/go-autorest/autorest/error.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/error.go rename to vendor/github.com/Azure/go-autorest/autorest/error.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/preparer.go b/vendor/github.com/Azure/go-autorest/autorest/preparer.go similarity index 86% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/preparer.go rename to vendor/github.com/Azure/go-autorest/autorest/preparer.go index 6e8ed64eba1c..6d67bd7337b7 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/preparer.go +++ b/vendor/github.com/Azure/go-autorest/autorest/preparer.go @@ -16,9 +16,7 @@ package autorest import ( "bytes" - "context" "encoding/json" - "encoding/xml" "fmt" "io" "io/ioutil" @@ -33,33 +31,11 @@ const ( mimeTypeOctetStream = "application/octet-stream" mimeTypeFormPost = "application/x-www-form-urlencoded" - headerAuthorization = "Authorization" - headerAuxAuthorization = "x-ms-authorization-auxiliary" - headerContentType = "Content-Type" - headerUserAgent = "User-Agent" + headerAuthorization = "Authorization" + headerContentType = "Content-Type" + headerUserAgent = "User-Agent" ) -// used as a key type in context.WithValue() -type ctxPrepareDecorators struct{} - -// WithPrepareDecorators adds the specified PrepareDecorators to the provided context. -// If no PrepareDecorators are provided the context is unchanged. -func WithPrepareDecorators(ctx context.Context, prepareDecorator []PrepareDecorator) context.Context { - if len(prepareDecorator) == 0 { - return ctx - } - return context.WithValue(ctx, ctxPrepareDecorators{}, prepareDecorator) -} - -// GetPrepareDecorators returns the PrepareDecorators in the provided context or the provided default PrepareDecorators. -func GetPrepareDecorators(ctx context.Context, defaultPrepareDecorators ...PrepareDecorator) []PrepareDecorator { - inCtx := ctx.Value(ctxPrepareDecorators{}) - if pd, ok := inCtx.([]PrepareDecorator); ok { - return pd - } - return defaultPrepareDecorators -} - // Preparer is the interface that wraps the Prepare method. // // Prepare accepts and possibly modifies an http.Request (e.g., adding Headers). Implementations @@ -214,9 +190,6 @@ 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") } @@ -252,25 +225,6 @@ 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 { @@ -423,28 +377,6 @@ 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 { @@ -523,7 +455,7 @@ func parseURL(u *url.URL, path string) (*url.URL, error) { // WithQueryParameters returns a PrepareDecorators that encodes and applies the query parameters // given in the supplied map (i.e., key=value). func WithQueryParameters(queryParameters map[string]interface{}) PrepareDecorator { - parameters := MapToValues(queryParameters) + parameters := ensureValueStrings(queryParameters) return func(p Preparer) Preparer { return PreparerFunc(func(r *http.Request) (*http.Request, error) { r, err := p.Prepare(r) @@ -531,16 +463,14 @@ func WithQueryParameters(queryParameters map[string]interface{}) PrepareDecorato if r.URL == nil { return r, NewError("autorest", "WithQueryParameters", "Invoked with a nil URL") } + v := r.URL.Query() for key, value := range parameters { - for i := range value { - d, err := url.QueryUnescape(value[i]) - if err != nil { - return r, err - } - value[i] = d + d, err := url.QueryUnescape(value) + if err != nil { + return r, err } - v[key] = value + v.Add(key, d) } r.URL.RawQuery = v.Encode() } diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/responder.go b/vendor/github.com/Azure/go-autorest/autorest/responder.go similarity index 94% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/responder.go rename to vendor/github.com/Azure/go-autorest/autorest/responder.go index 349e1963a2cf..a908a0adb708 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/responder.go +++ b/vendor/github.com/Azure/go-autorest/autorest/responder.go @@ -153,25 +153,6 @@ 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/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go b/vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go rename to vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.7.go b/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.7.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.7.go rename to vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.7.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.8.go b/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.8.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.8.go rename to vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.8.go diff --git a/vendor/github.com/Azure/go-autorest/autorest/sender.go b/vendor/github.com/Azure/go-autorest/autorest/sender.go new file mode 100644 index 000000000000..6665d7c00697 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/sender.go @@ -0,0 +1,326 @@ +package autorest + +// 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 ( + "fmt" + "log" + "math" + "net/http" + "strconv" + "time" + + "github.com/Azure/go-autorest/tracing" +) + +// Sender is the interface that wraps the Do method to send HTTP requests. +// +// The standard http.Client conforms to this interface. +type Sender interface { + Do(*http.Request) (*http.Response, error) +} + +// SenderFunc is a method that implements the Sender interface. +type SenderFunc func(*http.Request) (*http.Response, error) + +// Do implements the Sender interface on SenderFunc. +func (sf SenderFunc) Do(r *http.Request) (*http.Response, error) { + return sf(r) +} + +// 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 + +// CreateSender creates, decorates, and returns, as a Sender, the default http.Client. +func CreateSender(decorators ...SendDecorator) Sender { + return DecorateSender(&http.Client{}, decorators...) +} + +// DecorateSender accepts a Sender and a, possibly empty, set of SendDecorators, which is applies to +// the Sender. Decorators are applied in the order received, but their affect upon the request +// depends on whether they are a pre-decorator (change the http.Request and then pass it along) or a +// post-decorator (pass the http.Request along and react to the results in http.Response). +func DecorateSender(s Sender, decorators ...SendDecorator) Sender { + for _, decorate := range decorators { + s = decorate(s) + } + return s +} + +// Send sends, by means of the default http.Client, the passed http.Request, returning the +// http.Response and possible error. It also accepts a, possibly empty, set of SendDecorators which +// it will apply the http.Client before invoking the Do method. +// +// Send is a convenience method and not recommended for production. Advanced users should use +// SendWithSender, passing and sharing their own Sender (e.g., instance of http.Client). +// +// Send will not poll or retry requests. +func Send(r *http.Request, decorators ...SendDecorator) (*http.Response, error) { + return SendWithSender(&http.Client{Transport: tracing.Transport}, r, decorators...) +} + +// SendWithSender sends the passed http.Request, through the provided Sender, returning the +// http.Response and possible error. It also accepts a, possibly empty, set of SendDecorators which +// it will apply the http.Client before invoking the Do method. +// +// SendWithSender will not poll or retry requests. +func SendWithSender(s Sender, r *http.Request, decorators ...SendDecorator) (*http.Response, error) { + return DecorateSender(s, decorators...).Do(r) +} + +// AfterDelay returns a SendDecorator that delays for the passed time.Duration before +// invoking the Sender. The delay may be terminated by closing the optional channel on the +// http.Request. If canceled, no further Senders are invoked. +func AfterDelay(d time.Duration) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + if !DelayForBackoff(d, 0, r.Context().Done()) { + return nil, fmt.Errorf("autorest: AfterDelay canceled before full delay") + } + return s.Do(r) + }) + } +} + +// AsIs returns a SendDecorator that invokes the passed Sender without modifying the http.Request. +func AsIs() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + return s.Do(r) + }) + } +} + +// DoCloseIfError returns a SendDecorator that first invokes the passed Sender after which +// it closes the response if the passed Sender returns an error and the response body exists. +func DoCloseIfError() SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + resp, err := s.Do(r) + if err != nil { + Respond(resp, ByDiscardingBody(), ByClosing()) + } + return resp, err + }) + } +} + +// DoErrorIfStatusCode returns a SendDecorator that emits an error if the response StatusCode is +// among the set passed. Since these are artificial errors, the response body may still require +// closing. +func DoErrorIfStatusCode(codes ...int) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + resp, err := s.Do(r) + if err == nil && ResponseHasStatusCode(resp, codes...) { + err = NewErrorWithResponse("autorest", "DoErrorIfStatusCode", resp, "%v %v failed with %s", + resp.Request.Method, + resp.Request.URL, + resp.Status) + } + return resp, err + }) + } +} + +// DoErrorUnlessStatusCode returns a SendDecorator that emits an error unless the response +// StatusCode is among the set passed. Since these are artificial errors, the response body +// may still require closing. +func DoErrorUnlessStatusCode(codes ...int) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + resp, err := s.Do(r) + if err == nil && !ResponseHasStatusCode(resp, codes...) { + err = NewErrorWithResponse("autorest", "DoErrorUnlessStatusCode", resp, "%v %v failed with %s", + resp.Request.Method, + resp.Request.URL, + resp.Status) + } + return resp, err + }) + } +} + +// DoPollForStatusCodes returns a SendDecorator that polls if the http.Response contains one of the +// passed status codes. It expects the http.Response to contain a Location header providing the +// URL at which to poll (using GET) and will poll until the time passed is equal to or greater than +// the supplied duration. 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 by +// closing the optional channel on the http.Request. +func DoPollForStatusCodes(duration time.Duration, delay time.Duration, codes ...int) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (resp *http.Response, err error) { + resp, err = s.Do(r) + + if err == nil && ResponseHasStatusCode(resp, codes...) { + r, err = NewPollingRequestWithContext(r.Context(), resp) + + for err == nil && ResponseHasStatusCode(resp, codes...) { + Respond(resp, + ByDiscardingBody(), + ByClosing()) + resp, err = SendWithSender(s, r, + AfterDelay(GetRetryAfter(resp, delay))) + } + } + + return resp, err + }) + } +} + +// DoRetryForAttempts returns a SendDecorator that retries a failed request for up to the specified +// number of attempts, exponentially backing off between requests using the supplied backoff +// time.Duration (which may be zero). Retrying may be canceled by closing the optional channel on +// the http.Request. +func DoRetryForAttempts(attempts int, backoff time.Duration) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (resp *http.Response, err error) { + rr := NewRetriableRequest(r) + for attempt := 0; attempt < attempts; attempt++ { + err = rr.Prepare() + if err != nil { + return resp, err + } + resp, err = s.Do(rr.Request()) + if err == nil { + return resp, err + } + if !DelayForBackoff(backoff, attempt, r.Context().Done()) { + return nil, r.Context().Err() + } + } + return resp, err + }) + } +} + +// DoRetryForStatusCodes returns a SendDecorator that retries for specified statusCodes for up to the specified +// number of attempts, exponentially backing off between requests using the supplied backoff +// time.Duration (which may be zero). Retrying may be canceled by closing the optional channel on +// the http.Request. +func DoRetryForStatusCodes(attempts int, backoff time.Duration, codes ...int) SendDecorator { + return func(s Sender) Sender { + 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) + for attempt := 0; attempt < attempts+1; { + err = rr.Prepare() + if err != nil { + return resp, err + } + resp, err = s.Do(rr.Request()) + // if the error isn't temporary don't bother retrying + if err != nil && !IsTemporaryNetworkError(err) { + return nil, err + } + // we want to retry if err is not nil (e.g. transient network failure). note that for failed authentication + // resp and err will both have a value, so in this case we don't want to retry as it will never succeed. + if err == nil && !ResponseHasStatusCode(resp, codes...) || IsTokenRefreshError(err) { + return resp, err + } + delayed := DelayWithRetryAfter(resp, r.Context().Done()) + if !delayed && !DelayForBackoff(backoff, attempt, r.Context().Done()) { + return resp, r.Context().Err() + } + // don't count a 429 against the number of attempts + // so that we continue to retry until it succeeds + if resp == nil || resp.StatusCode != http.StatusTooManyRequests { + attempt++ + } + } + return resp, err + }) + } +} + +// DelayWithRetryAfter invokes time.After for the duration specified in the "Retry-After" header in +// responses with status code 429 +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 { + select { + case <-time.After(time.Duration(retryAfter) * time.Second): + return true + case <-cancel: + return false + } + } + return false +} + +// DoRetryForDuration returns a SendDecorator that retries the request until the total time is equal +// to or greater than the specified duration, exponentially backing off between requests using the +// supplied backoff time.Duration (which may be zero). Retrying may be canceled by closing the +// optional channel on the http.Request. +func DoRetryForDuration(d time.Duration, backoff time.Duration) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (resp *http.Response, err error) { + rr := NewRetriableRequest(r) + end := time.Now().Add(d) + for attempt := 0; time.Now().Before(end); attempt++ { + err = rr.Prepare() + if err != nil { + return resp, err + } + resp, err = s.Do(rr.Request()) + if err == nil { + return resp, err + } + if !DelayForBackoff(backoff, attempt, r.Context().Done()) { + return nil, r.Context().Err() + } + } + return resp, err + }) + } +} + +// WithLogging returns a SendDecorator that implements simple before and after logging of the +// request. +func WithLogging(logger *log.Logger) SendDecorator { + return func(s Sender) Sender { + return SenderFunc(func(r *http.Request) (*http.Response, error) { + logger.Printf("Sending %s %s", r.Method, r.URL) + resp, err := s.Do(r) + if err != nil { + logger.Printf("%s %s received error '%v'", r.Method, r.URL, err) + } else { + logger.Printf("%s %s received %s", r.Method, r.URL, resp.Status) + } + return resp, err + }) + } +} + +// DelayForBackoff invokes time.After for the supplied backoff duration raised to the power of +// passed attempt (i.e., an exponential backoff delay). Backoff duration is in seconds and can set +// to zero for no delay. The delay may be canceled by closing the passed channel. If terminated early, +// returns false. +// Note: Passing attempt 1 will result in doubling "backoff" duration. Treat this as a zero-based attempt +// count. +func DelayForBackoff(backoff time.Duration, attempt int, cancel <-chan struct{}) bool { + select { + case <-time.After(time.Duration(backoff.Seconds()*math.Pow(2, float64(attempt))) * time.Second): + 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 new file mode 100644 index 000000000000..fdda2ce1aa8e --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/to/convert.go @@ -0,0 +1,147 @@ +/* +Package to provides helpers to ease working with pointer values of marshalled structures. +*/ +package to + +// 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. + +// String returns a string value for the passed string pointer. It returns the empty string if the +// pointer is nil. +func String(s *string) string { + if s != nil { + return *s + } + return "" +} + +// StringPtr returns a pointer to the passed string. +func StringPtr(s string) *string { + return &s +} + +// StringSlice returns a string slice value for the passed string slice pointer. It returns a nil +// slice if the pointer is nil. +func StringSlice(s *[]string) []string { + if s != nil { + return *s + } + return nil +} + +// StringSlicePtr returns a pointer to the passed string slice. +func StringSlicePtr(s []string) *[]string { + return &s +} + +// StringMap returns a map of strings built from the map of string pointers. The empty string is +// used for nil pointers. +func StringMap(msp map[string]*string) map[string]string { + ms := make(map[string]string, len(msp)) + for k, sp := range msp { + if sp != nil { + ms[k] = *sp + } else { + ms[k] = "" + } + } + return ms +} + +// StringMapPtr returns a pointer to a map of string pointers built from the passed map of strings. +func StringMapPtr(ms map[string]string) *map[string]*string { + msp := make(map[string]*string, len(ms)) + for k, s := range ms { + msp[k] = StringPtr(s) + } + return &msp +} + +// Bool returns a bool value for the passed bool pointer. It returns false if the pointer is nil. +func Bool(b *bool) bool { + if b != nil { + return *b + } + return false +} + +// BoolPtr returns a pointer to the passed bool. +func BoolPtr(b bool) *bool { + return &b +} + +// Int returns an int value for the passed int pointer. It returns 0 if the pointer is nil. +func Int(i *int) int { + if i != nil { + return *i + } + return 0 +} + +// IntPtr returns a pointer to the passed int. +func IntPtr(i int) *int { + return &i +} + +// Int32 returns an int value for the passed int pointer. It returns 0 if the pointer is nil. +func Int32(i *int32) int32 { + if i != nil { + return *i + } + return 0 +} + +// Int32Ptr returns a pointer to the passed int32. +func Int32Ptr(i int32) *int32 { + return &i +} + +// Int64 returns an int value for the passed int pointer. It returns 0 if the pointer is nil. +func Int64(i *int64) int64 { + if i != nil { + return *i + } + return 0 +} + +// Int64Ptr returns a pointer to the passed int64. +func Int64Ptr(i int64) *int64 { + return &i +} + +// Float32 returns an int value for the passed int pointer. It returns 0.0 if the pointer is nil. +func Float32(i *float32) float32 { + if i != nil { + return *i + } + return 0.0 +} + +// Float32Ptr returns a pointer to the passed float32. +func Float32Ptr(i float32) *float32 { + return &i +} + +// Float64 returns an int value for the passed int pointer. It returns 0.0 if the pointer is nil. +func Float64(i *float64) float64 { + if i != nil { + return *i + } + return 0.0 +} + +// Float64Ptr returns a pointer to the passed float64. +func Float64Ptr(i float64) *float64 { + return &i +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/utility.go b/vendor/github.com/Azure/go-autorest/autorest/utility.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/utility.go rename to vendor/github.com/Azure/go-autorest/autorest/utility.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/validation/error.go b/vendor/github.com/Azure/go-autorest/autorest/validation/error.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/autorest/validation/error.go rename to vendor/github.com/Azure/go-autorest/autorest/validation/error.go diff --git a/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go b/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go new file mode 100644 index 000000000000..ae987f8fae60 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go @@ -0,0 +1,408 @@ +/* +Package validation provides methods for validating parameter value using reflection. +*/ +package validation + +// 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 ( + "fmt" + "reflect" + "regexp" + "strings" +) + +// Constraint stores constraint name, target field name +// Rule and chain validations. +type Constraint struct { + + // Target field name for validation. + Target string + + // Constraint name e.g. minLength, MaxLength, Pattern, etc. + Name string + + // Rule for constraint e.g. greater than 10, less than 5 etc. + Rule interface{} + + // Chain Validations for struct type + Chain []Constraint +} + +// Validation stores parameter-wise validation. +type Validation struct { + TargetValue interface{} + Constraints []Constraint +} + +// Constraint list +const ( + Empty = "Empty" + Null = "Null" + ReadOnly = "ReadOnly" + Pattern = "Pattern" + MaxLength = "MaxLength" + MinLength = "MinLength" + MaxItems = "MaxItems" + MinItems = "MinItems" + MultipleOf = "MultipleOf" + UniqueItems = "UniqueItems" + InclusiveMaximum = "InclusiveMaximum" + ExclusiveMaximum = "ExclusiveMaximum" + ExclusiveMinimum = "ExclusiveMinimum" + InclusiveMinimum = "InclusiveMinimum" +) + +// Validate method validates constraints on parameter +// passed in validation array. +func Validate(m []Validation) error { + for _, item := range m { + v := reflect.ValueOf(item.TargetValue) + for _, constraint := range item.Constraints { + var err error + switch v.Kind() { + case reflect.Ptr: + err = validatePtr(v, constraint) + case reflect.String: + err = validateString(v, constraint) + case reflect.Struct: + err = validateStruct(v, constraint) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + err = validateInt(v, constraint) + case reflect.Float32, reflect.Float64: + err = validateFloat(v, constraint) + case reflect.Array, reflect.Slice, reflect.Map: + err = validateArrayMap(v, constraint) + default: + err = createError(v, constraint, fmt.Sprintf("unknown type %v", v.Kind())) + } + + if err != nil { + return err + } + } + } + return nil +} + +func validateStruct(x reflect.Value, v Constraint, name ...string) error { + //Get field name from target name which is in format a.b.c + s := strings.Split(v.Target, ".") + f := x.FieldByName(s[len(s)-1]) + if isZero(f) { + return createError(x, v, fmt.Sprintf("field %q doesn't exist", v.Target)) + } + + return Validate([]Validation{ + { + TargetValue: getInterfaceValue(f), + Constraints: []Constraint{v}, + }, + }) +} + +func validatePtr(x reflect.Value, v Constraint) error { + if v.Name == ReadOnly { + if !x.IsNil() { + return createError(x.Elem(), v, "readonly parameter; must send as nil or empty in request") + } + return nil + } + if x.IsNil() { + return checkNil(x, v) + } + if v.Chain != nil { + return Validate([]Validation{ + { + TargetValue: getInterfaceValue(x.Elem()), + Constraints: v.Chain, + }, + }) + } + return nil +} + +func validateInt(x reflect.Value, v Constraint) error { + i := x.Int() + r, ok := toInt64(v.Rule) + if !ok { + return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.Name, v.Rule)) + } + switch v.Name { + case MultipleOf: + if i%r != 0 { + return createError(x, v, fmt.Sprintf("value must be a multiple of %v", r)) + } + case ExclusiveMinimum: + if i <= r { + return createError(x, v, fmt.Sprintf("value must be greater than %v", r)) + } + case ExclusiveMaximum: + if i >= r { + return createError(x, v, fmt.Sprintf("value must be less than %v", r)) + } + case InclusiveMinimum: + if i < r { + return createError(x, v, fmt.Sprintf("value must be greater than or equal to %v", r)) + } + case InclusiveMaximum: + if i > r { + return createError(x, v, fmt.Sprintf("value must be less than or equal to %v", r)) + } + default: + return createError(x, v, fmt.Sprintf("constraint %v is not applicable for type integer", v.Name)) + } + return nil +} + +func validateFloat(x reflect.Value, v Constraint) error { + f := x.Float() + r, ok := v.Rule.(float64) + if !ok { + return createError(x, v, fmt.Sprintf("rule must be float value for %v constraint; got: %v", v.Name, v.Rule)) + } + switch v.Name { + case ExclusiveMinimum: + if f <= r { + return createError(x, v, fmt.Sprintf("value must be greater than %v", r)) + } + case ExclusiveMaximum: + if f >= r { + return createError(x, v, fmt.Sprintf("value must be less than %v", r)) + } + case InclusiveMinimum: + if f < r { + return createError(x, v, fmt.Sprintf("value must be greater than or equal to %v", r)) + } + case InclusiveMaximum: + if f > r { + return createError(x, v, fmt.Sprintf("value must be less than or equal to %v", r)) + } + default: + return createError(x, v, fmt.Sprintf("constraint %s is not applicable for type float", v.Name)) + } + return nil +} + +func validateString(x reflect.Value, v Constraint) error { + s := x.String() + switch v.Name { + case Empty: + if len(s) == 0 { + return checkEmpty(x, v) + } + case Pattern: + reg, err := regexp.Compile(v.Rule.(string)) + if err != nil { + return createError(x, v, err.Error()) + } + if !reg.MatchString(s) { + return createError(x, v, fmt.Sprintf("value doesn't match pattern %v", v.Rule)) + } + case MaxLength: + if _, ok := v.Rule.(int); !ok { + return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.Name, v.Rule)) + } + if len(s) > v.Rule.(int) { + return createError(x, v, fmt.Sprintf("value length must be less than or equal to %v", v.Rule)) + } + case MinLength: + if _, ok := v.Rule.(int); !ok { + return createError(x, v, fmt.Sprintf("rule must be integer value for %v constraint; got: %v", v.Name, v.Rule)) + } + if len(s) < v.Rule.(int) { + return createError(x, v, fmt.Sprintf("value length must be greater than or equal to %v", v.Rule)) + } + case ReadOnly: + if len(s) > 0 { + return createError(reflect.ValueOf(s), v, "readonly parameter; must send as nil or empty in request") + } + default: + return createError(x, v, fmt.Sprintf("constraint %s is not applicable to string type", v.Name)) + } + + if v.Chain != nil { + return Validate([]Validation{ + { + TargetValue: getInterfaceValue(x), + Constraints: v.Chain, + }, + }) + } + return nil +} + +func validateArrayMap(x reflect.Value, v Constraint) error { + switch v.Name { + case Null: + if x.IsNil() { + return checkNil(x, v) + } + case Empty: + if x.IsNil() || x.Len() == 0 { + return checkEmpty(x, v) + } + case MaxItems: + if _, ok := v.Rule.(int); !ok { + return createError(x, v, fmt.Sprintf("rule must be integer for %v constraint; got: %v", v.Name, v.Rule)) + } + if x.Len() > v.Rule.(int) { + return createError(x, v, fmt.Sprintf("maximum item limit is %v; got: %v", v.Rule, x.Len())) + } + case MinItems: + if _, ok := v.Rule.(int); !ok { + return createError(x, v, fmt.Sprintf("rule must be integer for %v constraint; got: %v", v.Name, v.Rule)) + } + if x.Len() < v.Rule.(int) { + return createError(x, v, fmt.Sprintf("minimum item limit is %v; got: %v", v.Rule, x.Len())) + } + case UniqueItems: + if x.Kind() == reflect.Array || x.Kind() == reflect.Slice { + if !checkForUniqueInArray(x) { + return createError(x, v, fmt.Sprintf("all items in parameter %q must be unique; got:%v", v.Target, x)) + } + } else if x.Kind() == reflect.Map { + if !checkForUniqueInMap(x) { + return createError(x, v, fmt.Sprintf("all items in parameter %q must be unique; got:%v", v.Target, x)) + } + } else { + return createError(x, v, fmt.Sprintf("type must be array, slice or map for constraint %v; got: %v", v.Name, x.Kind())) + } + case ReadOnly: + if x.Len() != 0 { + return createError(x, v, "readonly parameter; must send as nil or empty in request") + } + case Pattern: + reg, err := regexp.Compile(v.Rule.(string)) + if err != nil { + return createError(x, v, err.Error()) + } + keys := x.MapKeys() + for _, k := range keys { + if !reg.MatchString(k.String()) { + return createError(k, v, fmt.Sprintf("map key doesn't match pattern %v", v.Rule)) + } + } + default: + return createError(x, v, fmt.Sprintf("constraint %v is not applicable to array, slice and map type", v.Name)) + } + + if v.Chain != nil { + return Validate([]Validation{ + { + TargetValue: getInterfaceValue(x), + Constraints: v.Chain, + }, + }) + } + return nil +} + +func checkNil(x reflect.Value, v Constraint) error { + if _, ok := v.Rule.(bool); !ok { + return createError(x, v, fmt.Sprintf("rule must be bool value for %v constraint; got: %v", v.Name, v.Rule)) + } + if v.Rule.(bool) { + return createError(x, v, "value can not be null; required parameter") + } + return nil +} + +func checkEmpty(x reflect.Value, v Constraint) error { + if _, ok := v.Rule.(bool); !ok { + return createError(x, v, fmt.Sprintf("rule must be bool value for %v constraint; got: %v", v.Name, v.Rule)) + } + + if v.Rule.(bool) { + return createError(x, v, "value can not be null or empty; required parameter") + } + return nil +} + +func checkForUniqueInArray(x reflect.Value) bool { + if x == reflect.Zero(reflect.TypeOf(x)) || x.Len() == 0 { + return false + } + arrOfInterface := make([]interface{}, x.Len()) + + for i := 0; i < x.Len(); i++ { + arrOfInterface[i] = x.Index(i).Interface() + } + + m := make(map[interface{}]bool) + for _, val := range arrOfInterface { + if m[val] { + return false + } + m[val] = true + } + return true +} + +func checkForUniqueInMap(x reflect.Value) bool { + if x == reflect.Zero(reflect.TypeOf(x)) || x.Len() == 0 { + return false + } + mapOfInterface := make(map[interface{}]interface{}, x.Len()) + + keys := x.MapKeys() + for _, k := range keys { + mapOfInterface[k.Interface()] = x.MapIndex(k).Interface() + } + + m := make(map[interface{}]bool) + for _, val := range mapOfInterface { + if m[val] { + return false + } + m[val] = true + } + return true +} + +func getInterfaceValue(x reflect.Value) interface{} { + if x.Kind() == reflect.Invalid { + return nil + } + return x.Interface() +} + +func isZero(x interface{}) bool { + return x == reflect.Zero(reflect.TypeOf(x)).Interface() +} + +func createError(x reflect.Value, v Constraint, err string) error { + return fmt.Errorf("autorest/validation: validation failed: parameter=%s constraint=%s value=%#v details: %s", + v.Target, v.Name, getInterfaceValue(x), err) +} + +func toInt64(v interface{}) (int64, bool) { + if i64, ok := v.(int64); ok { + return i64, true + } + // older generators emit max constants as int, so if int64 fails fall back to int + if i32, ok := v.(int); ok { + return int64(i32), true + } + 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 new file mode 100644 index 000000000000..773fb9612574 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/version.go @@ -0,0 +1,41 @@ +package autorest + +// 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 ( + "fmt" + "runtime" +) + +const number = "v11.7.1" + +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 number +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/logger/logger.go b/vendor/github.com/Azure/go-autorest/logger/logger.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/Azure/go-autorest/logger/logger.go rename to vendor/github.com/Azure/go-autorest/logger/logger.go 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 000000000000..cd61cb18b696 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/tracing/tracing.go @@ -0,0 +1,190 @@ +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 = &ochttp.Transport{ + Propagation: &tracecontext.HTTPFormat{}, + GetStartOptions: getStartOptions, + } + + // 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() + } + } +} + +// 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/BurntSushi/toml/.gitignore b/vendor/github.com/BurntSushi/toml/.gitignore new file mode 100644 index 000000000000..0cd3800377d4 --- /dev/null +++ b/vendor/github.com/BurntSushi/toml/.gitignore @@ -0,0 +1,5 @@ +TAGS +tags +.*.swp +tomlcheck/tomlcheck +toml.test diff --git a/vendor/github.com/BurntSushi/toml/.travis.yml b/vendor/github.com/BurntSushi/toml/.travis.yml new file mode 100644 index 000000000000..8b8afc4f0e00 --- /dev/null +++ b/vendor/github.com/BurntSushi/toml/.travis.yml @@ -0,0 +1,15 @@ +language: go +go: + - 1.1 + - 1.2 + - 1.3 + - 1.4 + - 1.5 + - 1.6 + - tip +install: + - go install ./... + - go get github.com/BurntSushi/toml-test +script: + - export PATH="$PATH:$HOME/gopath/bin" + - make test diff --git a/vendor/github.com/DataDog/datadog-go/statsd/README.md b/vendor/github.com/DataDog/datadog-go/statsd/README.md index f68df54be9f6..2fc899687eae 100644 --- a/vendor/github.com/DataDog/datadog-go/statsd/README.md +++ b/vendor/github.com/DataDog/datadog-go/statsd/README.md @@ -2,63 +2,3 @@ Package `statsd` provides a Go [dogstatsd](http://docs.datadoghq.com/guides/dogstatsd/) client. Dogstatsd extends Statsd, adding tags and histograms. - -## Get the code - - $ go get github.com/DataDog/datadog-go/statsd - -## Usage - -```go -// Create the client -c, err := statsd.New("127.0.0.1:8125") -if err != nil { - log.Fatal(err) -} -// Prefix every metric with the app name -c.Namespace = "flubber." -// Send the EC2 availability zone as a tag with every metric -c.Tags = append(c.Tags, "us-east-1a") - -// Do some metrics! -err = c.Gauge("request.queue_depth", 12, nil, 1) -err = c.Timing("request.duration", duration, nil, 1) // Uses a time.Duration! -err = c.TimeInMilliseconds("request", 12, nil, 1) -err = c.Incr("request.count_total", nil, 1) -err = c.Decr("request.count_total", nil, 1) -err = c.Count("request.count_total", 2, nil, 1) -``` - -## Buffering Client - -DogStatsD accepts packets with multiple statsd payloads in them. Using the BufferingClient via `NewBufferingClient` will buffer up commands and send them when the buffer is reached or after 100msec. - -## Unix Domain Sockets Client - -DogStatsD version 6 accepts packets through a Unix Socket datagram connection. You can use this protocol by giving a -`unix:///path/to/dsd.socket` addr argument to the `New` or `NewBufferingClient`. - -With this protocol, writes can become blocking if the server's receiving buffer is full. Our default behaviour is to -timeout and drop the packet after 1 ms. You can set a custom timeout duration via the `SetWriteTimeout` method. - -The default mode is to pass write errors from the socket to the caller. This includes write errors the library will -automatically recover from (DogStatsD server not ready yet or is restarting). You can drop these errors and emulate -the UDP behaviour by setting the `SkipErrors` property to `true`. Please note that packets will be dropped in both modes. - -## Development - -Run the tests with: - - $ go test - -## Documentation - -Please see: http://godoc.org/github.com/DataDog/datadog-go/statsd - -## License - -go-dogstatsd is released under the [MIT license](http://www.opensource.org/licenses/mit-license.php). - -## Credits - -Original code by [ooyala](https://github.com/ooyala/go-dogstatsd). diff --git a/vendor/github.com/DataDog/datadog-go/statsd/buffer.go b/vendor/github.com/DataDog/datadog-go/statsd/buffer.go new file mode 100644 index 000000000000..c38e229ab6d3 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-go/statsd/buffer.go @@ -0,0 +1,130 @@ +package statsd + +type bufferFullError string + +func (e bufferFullError) Error() string { return string(e) } + +const errBufferFull = bufferFullError("statsd buffer is full") + +const metricOverhead = 512 + +// statsdBuffer is a buffer containing statsd messages +// this struct methods are NOT safe for concurent use +type statsdBuffer struct { + buffer []byte + maxSize int + maxElements int + elementCount int +} + +func newStatsdBuffer(maxSize, maxElements int) *statsdBuffer { + return &statsdBuffer{ + buffer: make([]byte, 0, maxSize+metricOverhead), // pre-allocate the needed size + metricOverhead to avoid having Go re-allocate on it's own if an element does not fit + maxSize: maxSize, + maxElements: maxElements, + } +} + +func (b *statsdBuffer) writeGauge(namespace string, globalTags []string, name string, value float64, tags []string, rate float64) error { + if b.elementCount >= b.maxElements { + return errBufferFull + } + originalBuffer := b.buffer + b.writeSeparator() + b.buffer = appendGauge(b.buffer, namespace, globalTags, name, value, tags, rate) + return b.validateNewElement(originalBuffer) +} + +func (b *statsdBuffer) writeCount(namespace string, globalTags []string, name string, value int64, tags []string, rate float64) error { + if b.elementCount >= b.maxElements { + return errBufferFull + } + originalBuffer := b.buffer + b.writeSeparator() + b.buffer = appendCount(b.buffer, namespace, globalTags, name, value, tags, rate) + return b.validateNewElement(originalBuffer) +} + +func (b *statsdBuffer) writeHistogram(namespace string, globalTags []string, name string, value float64, tags []string, rate float64) error { + if b.elementCount >= b.maxElements { + return errBufferFull + } + originalBuffer := b.buffer + b.writeSeparator() + b.buffer = appendHistogram(b.buffer, namespace, globalTags, name, value, tags, rate) + return b.validateNewElement(originalBuffer) +} + +func (b *statsdBuffer) writeDistribution(namespace string, globalTags []string, name string, value float64, tags []string, rate float64) error { + if b.elementCount >= b.maxElements { + return errBufferFull + } + originalBuffer := b.buffer + b.writeSeparator() + b.buffer = appendDistribution(b.buffer, namespace, globalTags, name, value, tags, rate) + return b.validateNewElement(originalBuffer) +} + +func (b *statsdBuffer) writeSet(namespace string, globalTags []string, name string, value string, tags []string, rate float64) error { + if b.elementCount >= b.maxElements { + return errBufferFull + } + originalBuffer := b.buffer + b.writeSeparator() + b.buffer = appendSet(b.buffer, namespace, globalTags, name, value, tags, rate) + return b.validateNewElement(originalBuffer) +} + +func (b *statsdBuffer) writeTiming(namespace string, globalTags []string, name string, value float64, tags []string, rate float64) error { + if b.elementCount >= b.maxElements { + return errBufferFull + } + originalBuffer := b.buffer + b.writeSeparator() + b.buffer = appendTiming(b.buffer, namespace, globalTags, name, value, tags, rate) + return b.validateNewElement(originalBuffer) +} + +func (b *statsdBuffer) writeEvent(event Event, globalTags []string) error { + if b.elementCount >= b.maxElements { + return errBufferFull + } + originalBuffer := b.buffer + b.writeSeparator() + b.buffer = appendEvent(b.buffer, event, globalTags) + return b.validateNewElement(originalBuffer) +} + +func (b *statsdBuffer) writeServiceCheck(serviceCheck ServiceCheck, globalTags []string) error { + if b.elementCount >= b.maxElements { + return errBufferFull + } + originalBuffer := b.buffer + b.writeSeparator() + b.buffer = appendServiceCheck(b.buffer, serviceCheck, globalTags) + return b.validateNewElement(originalBuffer) +} + +func (b *statsdBuffer) validateNewElement(originalBuffer []byte) error { + if len(b.buffer) > b.maxSize { + b.buffer = originalBuffer + return errBufferFull + } + b.elementCount++ + return nil +} + +func (b *statsdBuffer) writeSeparator() { + if b.elementCount != 0 { + b.buffer = appendSeparator(b.buffer) + } +} + +func (b *statsdBuffer) reset() { + b.buffer = b.buffer[:0] + b.elementCount = 0 +} + +func (b *statsdBuffer) bytes() []byte { + return b.buffer +} diff --git a/vendor/github.com/DataDog/datadog-go/statsd/buffer_pool.go b/vendor/github.com/DataDog/datadog-go/statsd/buffer_pool.go new file mode 100644 index 000000000000..7a3e3c9d2231 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-go/statsd/buffer_pool.go @@ -0,0 +1,40 @@ +package statsd + +type bufferPool struct { + pool chan *statsdBuffer + bufferMaxSize int + bufferMaxElements int +} + +func newBufferPool(poolSize, bufferMaxSize, bufferMaxElements int) *bufferPool { + p := &bufferPool{ + pool: make(chan *statsdBuffer, poolSize), + bufferMaxSize: bufferMaxSize, + bufferMaxElements: bufferMaxElements, + } + for i := 0; i < poolSize; i++ { + p.addNewBuffer() + } + return p +} + +func (p *bufferPool) addNewBuffer() { + p.pool <- newStatsdBuffer(p.bufferMaxSize, p.bufferMaxElements) +} + +func (p *bufferPool) borrowBuffer() *statsdBuffer { + select { + case b := <-p.pool: + return b + default: + return newStatsdBuffer(p.bufferMaxSize, p.bufferMaxElements) + } +} + +func (p *bufferPool) returnBuffer(buffer *statsdBuffer) { + buffer.reset() + select { + case p.pool <- buffer: + default: + } +} diff --git a/vendor/github.com/DataDog/datadog-go/statsd/event.go b/vendor/github.com/DataDog/datadog-go/statsd/event.go new file mode 100644 index 000000000000..cf966d1a8219 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-go/statsd/event.go @@ -0,0 +1,91 @@ +package statsd + +import ( + "fmt" + "time" +) + +// Events support +// EventAlertType and EventAlertPriority became exported types after this issue was submitted: https://github.com/DataDog/datadog-go/issues/41 +// The reason why they got exported is so that client code can directly use the types. + +// EventAlertType is the alert type for events +type EventAlertType string + +const ( + // Info is the "info" AlertType for events + Info EventAlertType = "info" + // Error is the "error" AlertType for events + Error EventAlertType = "error" + // Warning is the "warning" AlertType for events + Warning EventAlertType = "warning" + // Success is the "success" AlertType for events + Success EventAlertType = "success" +) + +// EventPriority is the event priority for events +type EventPriority string + +const ( + // Normal is the "normal" Priority for events + Normal EventPriority = "normal" + // Low is the "low" Priority for events + Low EventPriority = "low" +) + +// An Event is an object that can be posted to your DataDog event stream. +type Event struct { + // Title of the event. Required. + Title string + // Text is the description of the event. Required. + Text string + // Timestamp is a timestamp for the event. If not provided, the dogstatsd + // server will set this to the current time. + Timestamp time.Time + // Hostname for the event. + Hostname string + // AggregationKey groups this event with others of the same key. + AggregationKey string + // Priority of the event. Can be statsd.Low or statsd.Normal. + Priority EventPriority + // SourceTypeName is a source type for the event. + SourceTypeName string + // AlertType can be statsd.Info, statsd.Error, statsd.Warning, or statsd.Success. + // If absent, the default value applied by the dogstatsd server is Info. + AlertType EventAlertType + // Tags for the event. + Tags []string +} + +// NewEvent creates a new event with the given title and text. Error checking +// against these values is done at send-time, or upon running e.Check. +func NewEvent(title, text string) *Event { + return &Event{ + Title: title, + Text: text, + } +} + +// Check verifies that an event is valid. +func (e Event) Check() error { + if len(e.Title) == 0 { + return fmt.Errorf("statsd.Event title is required") + } + if len(e.Text) == 0 { + return fmt.Errorf("statsd.Event text is required") + } + return nil +} + +// Encode returns the dogstatsd wire protocol representation for an event. +// Tags may be passed which will be added to the encoded output but not to +// the Event's list of tags, eg. for default tags. +func (e Event) Encode(tags ...string) (string, error) { + err := e.Check() + if err != nil { + return "", err + } + var buffer []byte + buffer = appendEvent(buffer, e, tags) + return string(buffer), nil +} diff --git a/vendor/github.com/DataDog/datadog-go/statsd/format.go b/vendor/github.com/DataDog/datadog-go/statsd/format.go new file mode 100644 index 000000000000..bd856a0489cd --- /dev/null +++ b/vendor/github.com/DataDog/datadog-go/statsd/format.go @@ -0,0 +1,232 @@ +package statsd + +import ( + "strconv" + "strings" +) + +var ( + gaugeSymbol = []byte("g") + countSymbol = []byte("c") + histogramSymbol = []byte("h") + distributionSymbol = []byte("d") + setSymbol = []byte("s") + timingSymbol = []byte("ms") +) + +func appendHeader(buffer []byte, namespace string, name string) []byte { + if namespace != "" { + buffer = append(buffer, namespace...) + } + buffer = append(buffer, name...) + buffer = append(buffer, ':') + return buffer +} + +func appendRate(buffer []byte, rate float64) []byte { + if rate < 1 { + buffer = append(buffer, "|@"...) + buffer = strconv.AppendFloat(buffer, rate, 'f', -1, 64) + } + return buffer +} + +func appendWithoutNewlines(buffer []byte, s string) []byte { + // fastpath for strings without newlines + if strings.IndexByte(s, '\n') == -1 { + return append(buffer, s...) + } + + for _, b := range []byte(s) { + if b != '\n' { + buffer = append(buffer, b) + } + } + return buffer +} + +func appendTags(buffer []byte, globalTags []string, tags []string) []byte { + if len(globalTags) == 0 && len(tags) == 0 { + return buffer + } + buffer = append(buffer, "|#"...) + firstTag := true + + for _, tag := range globalTags { + if !firstTag { + buffer = append(buffer, ',') + } + buffer = appendWithoutNewlines(buffer, tag) + firstTag = false + } + for _, tag := range tags { + if !firstTag { + buffer = append(buffer, ',') + } + buffer = appendWithoutNewlines(buffer, tag) + firstTag = false + } + return buffer +} + +func appendFloatMetric(buffer []byte, typeSymbol []byte, namespace string, globalTags []string, name string, value float64, tags []string, rate float64, precision int) []byte { + buffer = appendHeader(buffer, namespace, name) + buffer = strconv.AppendFloat(buffer, value, 'f', precision, 64) + buffer = append(buffer, '|') + buffer = append(buffer, typeSymbol...) + buffer = appendRate(buffer, rate) + buffer = appendTags(buffer, globalTags, tags) + return buffer +} + +func appendIntegerMetric(buffer []byte, typeSymbol []byte, namespace string, globalTags []string, name string, value int64, tags []string, rate float64) []byte { + buffer = appendHeader(buffer, namespace, name) + buffer = strconv.AppendInt(buffer, value, 10) + buffer = append(buffer, '|') + buffer = append(buffer, typeSymbol...) + buffer = appendRate(buffer, rate) + buffer = appendTags(buffer, globalTags, tags) + return buffer +} + +func appendStringMetric(buffer []byte, typeSymbol []byte, namespace string, globalTags []string, name string, value string, tags []string, rate float64) []byte { + buffer = appendHeader(buffer, namespace, name) + buffer = append(buffer, value...) + buffer = append(buffer, '|') + buffer = append(buffer, typeSymbol...) + buffer = appendRate(buffer, rate) + buffer = appendTags(buffer, globalTags, tags) + return buffer +} + +func appendGauge(buffer []byte, namespace string, globalTags []string, name string, value float64, tags []string, rate float64) []byte { + return appendFloatMetric(buffer, gaugeSymbol, namespace, globalTags, name, value, tags, rate, -1) +} + +func appendCount(buffer []byte, namespace string, globalTags []string, name string, value int64, tags []string, rate float64) []byte { + return appendIntegerMetric(buffer, countSymbol, namespace, globalTags, name, value, tags, rate) +} + +func appendHistogram(buffer []byte, namespace string, globalTags []string, name string, value float64, tags []string, rate float64) []byte { + return appendFloatMetric(buffer, histogramSymbol, namespace, globalTags, name, value, tags, rate, -1) +} + +func appendDistribution(buffer []byte, namespace string, globalTags []string, name string, value float64, tags []string, rate float64) []byte { + return appendFloatMetric(buffer, distributionSymbol, namespace, globalTags, name, value, tags, rate, -1) +} + +func appendSet(buffer []byte, namespace string, globalTags []string, name string, value string, tags []string, rate float64) []byte { + return appendStringMetric(buffer, setSymbol, namespace, globalTags, name, value, tags, rate) +} + +func appendTiming(buffer []byte, namespace string, globalTags []string, name string, value float64, tags []string, rate float64) []byte { + return appendFloatMetric(buffer, timingSymbol, namespace, globalTags, name, value, tags, rate, 6) +} + +func escapedEventTextLen(text string) int { + return len(text) + strings.Count(text, "\n") +} + +func appendEscapedEventText(buffer []byte, text string) []byte { + for _, b := range []byte(text) { + if b != '\n' { + buffer = append(buffer, b) + } else { + buffer = append(buffer, "\\n"...) + } + } + return buffer +} + +func appendEvent(buffer []byte, event Event, globalTags []string) []byte { + escapedTextLen := escapedEventTextLen(event.Text) + + buffer = append(buffer, "_e{"...) + buffer = strconv.AppendInt(buffer, int64(len(event.Title)), 10) + buffer = append(buffer, ',') + buffer = strconv.AppendInt(buffer, int64(escapedTextLen), 10) + buffer = append(buffer, "}:"...) + buffer = append(buffer, event.Title...) + buffer = append(buffer, '|') + if escapedTextLen != len(event.Text) { + buffer = appendEscapedEventText(buffer, event.Text) + } else { + buffer = append(buffer, event.Text...) + } + + if !event.Timestamp.IsZero() { + buffer = append(buffer, "|d:"...) + buffer = strconv.AppendInt(buffer, int64(event.Timestamp.Unix()), 10) + } + + if len(event.Hostname) != 0 { + buffer = append(buffer, "|h:"...) + buffer = append(buffer, event.Hostname...) + } + + if len(event.AggregationKey) != 0 { + buffer = append(buffer, "|k:"...) + buffer = append(buffer, event.AggregationKey...) + } + + if len(event.Priority) != 0 { + buffer = append(buffer, "|p:"...) + buffer = append(buffer, event.Priority...) + } + + if len(event.SourceTypeName) != 0 { + buffer = append(buffer, "|s:"...) + buffer = append(buffer, event.SourceTypeName...) + } + + if len(event.AlertType) != 0 { + buffer = append(buffer, "|t:"...) + buffer = append(buffer, string(event.AlertType)...) + } + + buffer = appendTags(buffer, globalTags, event.Tags) + return buffer +} + +func appendEscapedServiceCheckText(buffer []byte, text string) []byte { + for i := 0; i < len(text); i++ { + if text[i] == '\n' { + buffer = append(buffer, "\\n"...) + } else if text[i] == 'm' && i+1 < len(text) && text[i+1] == ':' { + buffer = append(buffer, "m\\:"...) + i++ + } else { + buffer = append(buffer, text[i]) + } + } + return buffer +} + +func appendServiceCheck(buffer []byte, serviceCheck ServiceCheck, globalTags []string) []byte { + buffer = append(buffer, "_sc|"...) + buffer = append(buffer, serviceCheck.Name...) + buffer = append(buffer, '|') + buffer = strconv.AppendInt(buffer, int64(serviceCheck.Status), 10) + + if !serviceCheck.Timestamp.IsZero() { + buffer = append(buffer, "|d:"...) + buffer = strconv.AppendInt(buffer, int64(serviceCheck.Timestamp.Unix()), 10) + } + + if len(serviceCheck.Hostname) != 0 { + buffer = append(buffer, "|h:"...) + buffer = append(buffer, serviceCheck.Hostname...) + } + + buffer = appendTags(buffer, globalTags, serviceCheck.Tags) + + if len(serviceCheck.Message) != 0 { + buffer = append(buffer, "|m:"...) + buffer = appendEscapedServiceCheckText(buffer, serviceCheck.Message) + } + return buffer +} + +func appendSeparator(buffer []byte) []byte { + return append(buffer, '\n') +} diff --git a/vendor/github.com/DataDog/datadog-go/statsd/noop.go b/vendor/github.com/DataDog/datadog-go/statsd/noop.go new file mode 100644 index 000000000000..010783333cac --- /dev/null +++ b/vendor/github.com/DataDog/datadog-go/statsd/noop.go @@ -0,0 +1,91 @@ +package statsd + +import "time" + +// NoOpClient is a statsd client that does nothing. Can be useful in testing +// situations for library users. +type NoOpClient struct{} + +// Gauge does nothing and returns nil +func (n *NoOpClient) Gauge(name string, value float64, tags []string, rate float64) error { + return nil +} + +// Count does nothing and returns nil +func (n *NoOpClient) Count(name string, value int64, tags []string, rate float64) error { + return nil +} + +// Histogram does nothing and returns nil +func (n *NoOpClient) Histogram(name string, value float64, tags []string, rate float64) error { + return nil +} + +// Distribution does nothing and returns nil +func (n *NoOpClient) Distribution(name string, value float64, tags []string, rate float64) error { + return nil +} + +// Decr does nothing and returns nil +func (n *NoOpClient) Decr(name string, tags []string, rate float64) error { + return nil +} + +// Incr does nothing and returns nil +func (n *NoOpClient) Incr(name string, tags []string, rate float64) error { + return nil +} + +// Set does nothing and returns nil +func (n *NoOpClient) Set(name string, value string, tags []string, rate float64) error { + return nil +} + +// Timing does nothing and returns nil +func (n *NoOpClient) Timing(name string, value time.Duration, tags []string, rate float64) error { + return nil +} + +// TimeInMilliseconds does nothing and returns nil +func (n *NoOpClient) TimeInMilliseconds(name string, value float64, tags []string, rate float64) error { + return nil +} + +// Event does nothing and returns nil +func (n *NoOpClient) Event(e *Event) error { + return nil +} + +// SimpleEvent does nothing and returns nil +func (n *NoOpClient) SimpleEvent(title, text string) error { + return nil +} + +// ServiceCheck does nothing and returns nil +func (n *NoOpClient) ServiceCheck(sc *ServiceCheck) error { + return nil +} + +// SimpleServiceCheck does nothing and returns nil +func (n *NoOpClient) SimpleServiceCheck(name string, status ServiceCheckStatus) error { + return nil +} + +// Close does nothing and returns nil +func (n *NoOpClient) Close() error { + return nil +} + +// Flush does nothing and returns nil +func (n *NoOpClient) Flush() error { + return nil +} + +// SetWriteTimeout does nothing and returns nil +func (n *NoOpClient) SetWriteTimeout(d time.Duration) error { + return nil +} + +// Verify that NoOpClient implements the ClientInterface. +// https://golang.org/doc/faq#guarantee_satisfies_interface +var _ ClientInterface = &NoOpClient{} diff --git a/vendor/github.com/DataDog/datadog-go/statsd/options.go b/vendor/github.com/DataDog/datadog-go/statsd/options.go new file mode 100644 index 000000000000..3f48b58e40a6 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-go/statsd/options.go @@ -0,0 +1,141 @@ +package statsd + +import ( + "math" + "time" +) + +var ( + // DefaultNamespace is the default value for the Namespace option + DefaultNamespace = "" + // DefaultTags is the default value for the Tags option + DefaultTags = []string{} + // DefaultMaxBytesPerPayload is the default value for the MaxBytesPerPayload option + DefaultMaxBytesPerPayload = 0 + // DefaultMaxMessagesPerPayload is the default value for the MaxMessagesPerPayload option + DefaultMaxMessagesPerPayload = math.MaxInt32 + // DefaultBufferPoolSize is the default value for the DefaultBufferPoolSize option + DefaultBufferPoolSize = 0 + // DefaultBufferFlushInterval is the default value for the BufferFlushInterval option + DefaultBufferFlushInterval = 100 * time.Millisecond + // DefaultSenderQueueSize is the default value for the DefaultSenderQueueSize option + DefaultSenderQueueSize = 0 + // DefaultWriteTimeoutUDS is the default value for the WriteTimeoutUDS option + DefaultWriteTimeoutUDS = 1 * time.Millisecond +) + +// Options contains the configuration options for a client. +type Options struct { + // Namespace to prepend to all metrics, events and service checks name. + Namespace string + // Tags are global tags to be applied to every metrics, events and service checks. + Tags []string + // MaxBytesPerPayload is the maximum number of bytes a single payload will contain. + // The magic value 0 will set the option to the optimal size for the transport + // protocol used when creating the client: 1432 for UDP and 8192 for UDS. + MaxBytesPerPayload int + // MaxMessagesPerPayload is the maximum number of metrics, events and/or service checks a single payload will contain. + // This option can be set to `1` to create an unbuffered client. + MaxMessagesPerPayload int + // BufferPoolSize is the size of the pool of buffers in number of buffers. + // The magic value 0 will set the option to the optimal size for the transport + // protocol used when creating the client: 2048 for UDP and 512 for UDS. + BufferPoolSize int + // BufferFlushInterval is the interval after which the current buffer will get flushed. + BufferFlushInterval time.Duration + // SenderQueueSize is the size of the sender queue in number of buffers. + // The magic value 0 will set the option to the optimal size for the transport + // protocol used when creating the client: 2048 for UDP and 512 for UDS. + SenderQueueSize int + // WriteTimeoutUDS is the timeout after which a UDS packet is dropped. + WriteTimeoutUDS time.Duration +} + +func resolveOptions(options []Option) (*Options, error) { + o := &Options{ + Namespace: DefaultNamespace, + Tags: DefaultTags, + MaxBytesPerPayload: DefaultMaxBytesPerPayload, + MaxMessagesPerPayload: DefaultMaxMessagesPerPayload, + BufferPoolSize: DefaultBufferPoolSize, + BufferFlushInterval: DefaultBufferFlushInterval, + SenderQueueSize: DefaultSenderQueueSize, + WriteTimeoutUDS: DefaultWriteTimeoutUDS, + } + + for _, option := range options { + err := option(o) + if err != nil { + return nil, err + } + } + + return o, nil +} + +// Option is a client option. Can return an error if validation fails. +type Option func(*Options) error + +// WithNamespace sets the Namespace option. +func WithNamespace(namespace string) Option { + return func(o *Options) error { + o.Namespace = namespace + return nil + } +} + +// WithTags sets the Tags option. +func WithTags(tags []string) Option { + return func(o *Options) error { + o.Tags = tags + return nil + } +} + +// WithMaxMessagesPerPayload sets the MaxMessagesPerPayload option. +func WithMaxMessagesPerPayload(maxMessagesPerPayload int) Option { + return func(o *Options) error { + o.MaxMessagesPerPayload = maxMessagesPerPayload + return nil + } +} + +// WithMaxBytesPerPayload sets the MaxBytesPerPayload option. +func WithMaxBytesPerPayload(MaxBytesPerPayload int) Option { + return func(o *Options) error { + o.MaxBytesPerPayload = MaxBytesPerPayload + return nil + } +} + +// WithBufferPoolSize sets the BufferPoolSize option. +func WithBufferPoolSize(bufferPoolSize int) Option { + return func(o *Options) error { + o.BufferPoolSize = bufferPoolSize + return nil + } +} + +// WithBufferFlushInterval sets the BufferFlushInterval option. +func WithBufferFlushInterval(bufferFlushInterval time.Duration) Option { + return func(o *Options) error { + o.BufferFlushInterval = bufferFlushInterval + return nil + } +} + +// WithSenderQueueSize sets the SenderQueueSize option. +func WithSenderQueueSize(senderQueueSize int) Option { + return func(o *Options) error { + o.SenderQueueSize = senderQueueSize + return nil + } +} + +// WithWriteTimeoutUDS sets the WriteTimeoutUDS option. +func WithWriteTimeoutUDS(writeTimeoutUDS time.Duration) Option { + return func(o *Options) error { + o.WriteTimeoutUDS = writeTimeoutUDS + return nil + } +} diff --git a/vendor/github.com/DataDog/datadog-go/statsd/sender.go b/vendor/github.com/DataDog/datadog-go/statsd/sender.go new file mode 100644 index 000000000000..3ab5abb64d3d --- /dev/null +++ b/vendor/github.com/DataDog/datadog-go/statsd/sender.go @@ -0,0 +1,116 @@ +package statsd + +import ( + "sync/atomic" + "time" +) + +// A statsdWriter offers a standard interface regardless of the underlying +// protocol. For now UDS and UPD writers are available. +// Attention: the underlying buffer of `data` is reused after a `statsdWriter.Write` call. +// `statsdWriter.Write` must be synchronous. +type statsdWriter interface { + Write(data []byte) (n int, err error) + SetWriteTimeout(time.Duration) error + Close() error +} + +// SenderMetrics contains metrics about the health of the sender +type SenderMetrics struct { + TotalSentBytes uint64 + TotalSentPayloads uint64 + TotalDroppedPayloads uint64 + TotalDroppedBytes uint64 + TotalDroppedPayloadsQueueFull uint64 + TotalDroppedBytesQueueFull uint64 + TotalDroppedPayloadsWriter uint64 + TotalDroppedBytesWriter uint64 +} + +type sender struct { + transport statsdWriter + pool *bufferPool + queue chan *statsdBuffer + metrics SenderMetrics + stop chan struct{} +} + +func newSender(transport statsdWriter, queueSize int, pool *bufferPool) *sender { + sender := &sender{ + transport: transport, + pool: pool, + queue: make(chan *statsdBuffer, queueSize), + stop: make(chan struct{}), + } + + go sender.sendLoop() + return sender +} + +func (s *sender) send(buffer *statsdBuffer) { + select { + case s.queue <- buffer: + default: + atomic.AddUint64(&s.metrics.TotalDroppedPayloads, 1) + atomic.AddUint64(&s.metrics.TotalDroppedBytes, uint64(len(buffer.bytes()))) + atomic.AddUint64(&s.metrics.TotalDroppedPayloadsQueueFull, 1) + atomic.AddUint64(&s.metrics.TotalDroppedBytesQueueFull, uint64(len(buffer.bytes()))) + s.pool.returnBuffer(buffer) + } +} + +func (s *sender) write(buffer *statsdBuffer) { + _, err := s.transport.Write(buffer.bytes()) + if err != nil { + atomic.AddUint64(&s.metrics.TotalDroppedPayloads, 1) + atomic.AddUint64(&s.metrics.TotalDroppedBytes, uint64(len(buffer.bytes()))) + atomic.AddUint64(&s.metrics.TotalDroppedPayloadsWriter, 1) + atomic.AddUint64(&s.metrics.TotalDroppedBytesWriter, uint64(len(buffer.bytes()))) + } else { + atomic.AddUint64(&s.metrics.TotalSentPayloads, 1) + atomic.AddUint64(&s.metrics.TotalSentBytes, uint64(len(buffer.bytes()))) + } + s.pool.returnBuffer(buffer) +} + +func (s *sender) flushMetrics() SenderMetrics { + return SenderMetrics{ + TotalSentBytes: atomic.SwapUint64(&s.metrics.TotalSentBytes, 0), + TotalSentPayloads: atomic.SwapUint64(&s.metrics.TotalSentPayloads, 0), + TotalDroppedPayloads: atomic.SwapUint64(&s.metrics.TotalDroppedPayloads, 0), + TotalDroppedBytes: atomic.SwapUint64(&s.metrics.TotalDroppedBytes, 0), + TotalDroppedPayloadsQueueFull: atomic.SwapUint64(&s.metrics.TotalDroppedPayloadsQueueFull, 0), + TotalDroppedBytesQueueFull: atomic.SwapUint64(&s.metrics.TotalDroppedBytesQueueFull, 0), + TotalDroppedPayloadsWriter: atomic.SwapUint64(&s.metrics.TotalDroppedPayloadsWriter, 0), + TotalDroppedBytesWriter: atomic.SwapUint64(&s.metrics.TotalDroppedBytesWriter, 0), + } +} + +func (s *sender) sendLoop() { + for { + select { + case buffer := <-s.queue: + s.write(buffer) + case <-s.stop: + return + } + } +} + +func (s *sender) flush() { + for { + select { + case buffer := <-s.queue: + s.write(buffer) + default: + return + } + } +} + +func (s *sender) close() error { + s.flush() + err := s.transport.Close() + close(s.stop) + return err +} diff --git a/vendor/github.com/DataDog/datadog-go/statsd/service_check.go b/vendor/github.com/DataDog/datadog-go/statsd/service_check.go new file mode 100644 index 000000000000..fce86755fb79 --- /dev/null +++ b/vendor/github.com/DataDog/datadog-go/statsd/service_check.go @@ -0,0 +1,70 @@ +package statsd + +import ( + "fmt" + "time" +) + +// ServiceCheckStatus support +type ServiceCheckStatus byte + +const ( + // Ok is the "ok" ServiceCheck status + Ok ServiceCheckStatus = 0 + // Warn is the "warning" ServiceCheck status + Warn ServiceCheckStatus = 1 + // Critical is the "critical" ServiceCheck status + Critical ServiceCheckStatus = 2 + // Unknown is the "unknown" ServiceCheck status + Unknown ServiceCheckStatus = 3 +) + +// A ServiceCheck is an object that contains status of DataDog service check. +type ServiceCheck struct { + // Name of the service check. Required. + Name string + // Status of service check. Required. + Status ServiceCheckStatus + // Timestamp is a timestamp for the serviceCheck. If not provided, the dogstatsd + // server will set this to the current time. + Timestamp time.Time + // Hostname for the serviceCheck. + Hostname string + // A message describing the current state of the serviceCheck. + Message string + // Tags for the serviceCheck. + Tags []string +} + +// NewServiceCheck creates a new serviceCheck with the given name and status. Error checking +// against these values is done at send-time, or upon running sc.Check. +func NewServiceCheck(name string, status ServiceCheckStatus) *ServiceCheck { + return &ServiceCheck{ + Name: name, + Status: status, + } +} + +// Check verifies that a service check is valid. +func (sc ServiceCheck) Check() error { + if len(sc.Name) == 0 { + return fmt.Errorf("statsd.ServiceCheck name is required") + } + if byte(sc.Status) < 0 || byte(sc.Status) > 3 { + return fmt.Errorf("statsd.ServiceCheck status has invalid value") + } + return nil +} + +// Encode returns the dogstatsd wire protocol representation for a service check. +// Tags may be passed which will be added to the encoded output but not to +// the Service Check's list of tags, eg. for default tags. +func (sc ServiceCheck) Encode(tags ...string) (string, error) { + err := sc.Check() + if err != nil { + return "", err + } + var buffer []byte + buffer = appendServiceCheck(buffer, sc, tags) + return string(buffer), nil +} diff --git a/vendor/github.com/DataDog/datadog-go/statsd/statsd.go b/vendor/github.com/DataDog/datadog-go/statsd/statsd.go index 9c5773c96d72..11c0e6934ae5 100644 --- a/vendor/github.com/DataDog/datadog-go/statsd/statsd.go +++ b/vendor/github.com/DataDog/datadog-go/statsd/statsd.go @@ -24,27 +24,21 @@ statsd is based on go-statsd-client. package statsd import ( - "bytes" - "errors" "fmt" - "io" "math/rand" - "strconv" + "os" "strings" "sync" "time" ) /* -OptimalPayloadSize defines the optimal payload size for a UDP datagram, 1432 bytes +OptimalUDPPayloadSize defines the optimal payload size for a UDP datagram, 1432 bytes is optimal for regular networks with an MTU of 1500 so datagrams don't get fragmented. It's generally recommended not to fragment UDP datagrams as losing a single fragment will cause the entire datagram to be lost. - -This can be increased if your network has a greater MTU or you don't mind UDP -datagrams getting fragmented. The practical limit is MaxUDPPayloadSize */ -const OptimalPayloadSize = 1432 +const OptimalUDPPayloadSize = 1432 /* MaxUDPPayloadSize defines the maximum payload size for a UDP datagram. @@ -54,126 +48,251 @@ any number greater than that will see frames being cut out. */ const MaxUDPPayloadSize = 65467 +// DefaultUDPBufferPoolSize is the default size of the buffer pool for UDP clients. +const DefaultUDPBufferPoolSize = 2048 + +// DefaultUDSBufferPoolSize is the default size of the buffer pool for UDS clients. +const DefaultUDSBufferPoolSize = 512 + +/* +DefaultMaxAgentPayloadSize is the default maximum payload size the agent +can receive. This can be adjusted by changing dogstatsd_buffer_size in the +agent configuration file datadog.yaml. +*/ +const DefaultMaxAgentPayloadSize = 8192 + +/* +TelemetryInterval is the interval at which telemetry will be sent by the client. +*/ +const TelemetryInterval = 10 * time.Second + +/* +clientTelemetryTag is a tag identifying this specific client. +*/ +var clientTelemetryTag = "client:go" + /* UnixAddressPrefix holds the prefix to use to enable Unix Domain Socket traffic instead of UDP. */ const UnixAddressPrefix = "unix://" -/* -Stat suffixes -*/ -var ( - gaugeSuffix = []byte("|g") - countSuffix = []byte("|c") - histogramSuffix = []byte("|h") - decrSuffix = []byte("-1|c") - incrSuffix = []byte("1|c") - setSuffix = []byte("|s") - timingSuffix = []byte("|ms") +// Client-side entity ID injection for container tagging +const ( + entityIDEnvName = "DD_ENTITY_ID" + entityIDTagName = "dd.internal.entity_id" +) + +type metricType int + +const ( + gauge metricType = iota + count + histogram + distribution + set + timing + event + serviceCheck ) -// A statsdWriter offers a standard interface regardless of the underlying -// protocol. For now UDS and UPD writers are available. -type statsdWriter interface { - Write(data []byte) error - SetWriteTimeout(time.Duration) error +type metric struct { + metricType metricType + namespace string + globalTags []string + name string + fvalue float64 + ivalue int64 + svalue string + evalue *Event + scvalue *ServiceCheck + tags []string + rate float64 +} + +type noClientErr string + +// ErrNoClient is returned if statsd reporting methods are invoked on +// a nil client. +const ErrNoClient = noClientErr("statsd client is nil") + +func (e noClientErr) Error() string { + return string(e) +} + +// ClientInterface is an interface that exposes the common client functions for the +// purpose of being able to provide a no-op client or even mocking. This can aid +// downstream users' with their testing. +type ClientInterface interface { + // Gauge measures the value of a metric at a particular time. + Gauge(name string, value float64, tags []string, rate float64) error + + // Count tracks how many times something happened per second. + Count(name string, value int64, tags []string, rate float64) error + + // Histogram tracks the statistical distribution of a set of values on each host. + Histogram(name string, value float64, tags []string, rate float64) error + + // Distribution tracks the statistical distribution of a set of values across your infrastructure. + Distribution(name string, value float64, tags []string, rate float64) error + + // Decr is just Count of -1 + Decr(name string, tags []string, rate float64) error + + // Incr is just Count of 1 + Incr(name string, tags []string, rate float64) error + + // Set counts the number of unique elements in a group. + Set(name string, value string, tags []string, rate float64) error + + // Timing sends timing information, it is an alias for TimeInMilliseconds + Timing(name string, value time.Duration, tags []string, rate float64) error + + // TimeInMilliseconds sends timing information in milliseconds. + // It is flushed by statsd with percentiles, mean and other info (https://github.com/etsy/statsd/blob/master/docs/metric_types.md#timing) + TimeInMilliseconds(name string, value float64, tags []string, rate float64) error + + // Event sends the provided Event. + Event(e *Event) error + + // SimpleEvent sends an event with the provided title and text. + SimpleEvent(title, text string) error + + // ServiceCheck sends the provided ServiceCheck. + ServiceCheck(sc *ServiceCheck) error + + // SimpleServiceCheck sends an serviceCheck with the provided name and status. + SimpleServiceCheck(name string, status ServiceCheckStatus) error + + // Close the client connection. Close() error + + // Flush forces a flush of all the queued dogstatsd payloads. + Flush() error + + // SetWriteTimeout allows the user to set a custom write timeout. + SetWriteTimeout(d time.Duration) error } // A Client is a handle for sending messages to dogstatsd. It is safe to // use one Client from multiple goroutines simultaneously. type Client struct { - // Writer handles the underlying networking protocol - writer statsdWriter + // Sender handles the underlying networking protocol + sender *sender // Namespace to prepend to all statsd calls Namespace string // Tags are global tags to be added to every statsd call Tags []string // skipErrors turns off error passing and allows UDS to emulate UDP behaviour - SkipErrors bool - // BufferLength is the length of the buffer in commands. - bufferLength int - flushTime time.Duration - commands []string - buffer bytes.Buffer - stop chan struct{} + SkipErrors bool + flushTime time.Duration + bufferPool *bufferPool + buffer *statsdBuffer + telemetryTags []string + stop chan struct{} sync.Mutex } +// Verify that Client implements the ClientInterface. +// https://golang.org/doc/faq#guarantee_satisfies_interface +var _ ClientInterface = &Client{} + // New returns a pointer to a new Client given an addr in the format "hostname:port" or // "unix:///path/to/socket". -func New(addr string) (*Client, error) { - if strings.HasPrefix(addr, UnixAddressPrefix) { - w, err := newUdsWriter(addr[len(UnixAddressPrefix)-1:]) - if err != nil { - return nil, err - } - client := &Client{writer: w} - return client, nil +func New(addr string, options ...Option) (*Client, error) { + var w statsdWriter + o, err := resolveOptions(options) + if err != nil { + return nil, err + } + + var writerType string + optimalPayloadSize := OptimalUDPPayloadSize + defaultBufferPoolSize := DefaultUDPBufferPoolSize + if !strings.HasPrefix(addr, UnixAddressPrefix) { + w, err = newUDPWriter(addr) + writerType = "udp" } else { - w, err := newUdpWriter(addr) - if err != nil { - return nil, err - } - client := &Client{writer: w, SkipErrors: false} - return client, nil + // FIXME: The agent has a performance pitfall preventing us from using better defaults here. + // Once it's fixed, use `DefaultMaxAgentPayloadSize` and `DefaultUDSBufferPoolSize` instead. + optimalPayloadSize = OptimalUDPPayloadSize + defaultBufferPoolSize = DefaultUDPBufferPoolSize + w, err = newUDSWriter(addr[len(UnixAddressPrefix)-1:]) + writerType = "uds" + } + if err != nil { + return nil, err } + + if o.MaxBytesPerPayload == 0 { + o.MaxBytesPerPayload = optimalPayloadSize + } + if o.BufferPoolSize == 0 { + o.BufferPoolSize = defaultBufferPoolSize + } + if o.SenderQueueSize == 0 { + o.SenderQueueSize = defaultBufferPoolSize + } + return newWithWriter(w, o, writerType) } -// NewBuffered returns a Client that buffers its output and sends it in chunks. -// Buflen is the length of the buffer in number of commands. -func NewBuffered(addr string, buflen int) (*Client, error) { - client, err := New(addr) +// NewWithWriter creates a new Client with given writer. Writer is a +// io.WriteCloser + SetWriteTimeout(time.Duration) error +func NewWithWriter(w statsdWriter, options ...Option) (*Client, error) { + o, err := resolveOptions(options) if err != nil { return nil, err } - client.bufferLength = buflen - client.commands = make([]string, 0, buflen) - client.flushTime = time.Millisecond * 100 - client.stop = make(chan struct{}, 1) - go client.watch() - return client, nil -} - -// format a message from its name, value, tags and rate. Also adds global -// namespace and tags. -func (c *Client) format(name string, value interface{}, suffix []byte, tags []string, rate float64) string { - var buf bytes.Buffer - if c.Namespace != "" { - buf.WriteString(c.Namespace) - } - buf.WriteString(name) - buf.WriteString(":") + return newWithWriter(w, o, "custom") +} - switch val := value.(type) { - case float64: - buf.Write(strconv.AppendFloat([]byte{}, val, 'f', 6, 64)) +func newWithWriter(w statsdWriter, o *Options, writerName string) (*Client, error) { - case int64: - buf.Write(strconv.AppendInt([]byte{}, val, 10)) + w.SetWriteTimeout(o.WriteTimeoutUDS) - case string: - buf.WriteString(val) + c := Client{ + Namespace: o.Namespace, + Tags: o.Tags, + telemetryTags: []string{clientTelemetryTag, "transport:" + writerName}, + } - default: - // do nothing + // Inject DD_ENTITY_ID as a constant tag if found + entityID := os.Getenv(entityIDEnvName) + if entityID != "" { + entityTag := fmt.Sprintf("%s:%s", entityIDTagName, entityID) + c.Tags = append(c.Tags, entityTag) } - buf.Write(suffix) - if rate < 1 { - buf.WriteString(`|@`) - buf.WriteString(strconv.FormatFloat(rate, 'f', -1, 64)) + if o.MaxBytesPerPayload == 0 { + o.MaxBytesPerPayload = OptimalUDPPayloadSize } - writeTagString(&buf, c.Tags, tags) + c.bufferPool = newBufferPool(o.BufferPoolSize, o.MaxBytesPerPayload, o.MaxMessagesPerPayload) + c.buffer = c.bufferPool.borrowBuffer() + c.sender = newSender(w, o.SenderQueueSize, c.bufferPool) + c.flushTime = o.BufferFlushInterval + c.stop = make(chan struct{}, 1) + go c.watch() + go c.telemetry() - return buf.String() + return &c, nil +} + +// NewBuffered returns a Client that buffers its output and sends it in chunks. +// Buflen is the length of the buffer in number of commands. +// +// When addr is empty, the client will default to a UDP client and use the DD_AGENT_HOST +// and (optionally) the DD_DOGSTATSD_PORT environment variables to build the target address. +func NewBuffered(addr string, buflen int) (*Client, error) { + return New(addr, WithMaxMessagesPerPayload(buflen)) } // SetWriteTimeout allows the user to set a custom UDS write timeout. Not supported for UDP. func (c *Client) SetWriteTimeout(d time.Duration) error { - return c.writer.SetWriteTimeout(d) + if c == nil { + return ErrNoClient + } + return c.sender.transport.SetWriteTimeout(d) } func (c *Client) watch() { @@ -183,10 +302,7 @@ func (c *Client) watch() { select { case <-ticker.C: c.Lock() - if len(c.commands) > 0 { - // FIXME: eating error here - c.flush() - } + c.flushUnsafe() c.Unlock() case <-c.stop: ticker.Stop() @@ -195,151 +311,149 @@ func (c *Client) watch() { } } -func (c *Client) append(cmd string) error { - c.Lock() - defer c.Unlock() - c.commands = append(c.commands, cmd) - // if we should flush, lets do it - if len(c.commands) == c.bufferLength { - if err := c.flush(); err != nil { - return err - } - } - return nil -} - -func (c *Client) joinMaxSize(cmds []string, sep string, maxSize int) ([][]byte, []int) { - c.buffer.Reset() //clear buffer - - var frames [][]byte - var ncmds []int - sepBytes := []byte(sep) - sepLen := len(sep) - - elem := 0 - for _, cmd := range cmds { - needed := len(cmd) - - if elem != 0 { - needed = needed + sepLen - } - - if c.buffer.Len()+needed <= maxSize { - if elem != 0 { - c.buffer.Write(sepBytes) - } - c.buffer.WriteString(cmd) - elem++ - } else { - frames = append(frames, copyAndResetBuffer(&c.buffer)) - ncmds = append(ncmds, elem) - // if cmd is bigger than maxSize it will get flushed on next loop - c.buffer.WriteString(cmd) - elem = 1 +func (c *Client) telemetry() { + ticker := time.NewTicker(TelemetryInterval) + for { + select { + case <-ticker.C: + metrics := c.sender.flushMetrics() + c.telemetryCount("datadog.dogstatsd.client.packets_sent", int64(metrics.TotalSentPayloads), c.telemetryTags, 1) + c.telemetryCount("datadog.dogstatsd.client.bytes_sent", int64(metrics.TotalSentBytes), c.telemetryTags, 1) + c.telemetryCount("datadog.dogstatsd.client.packets_dropped", int64(metrics.TotalDroppedPayloads), c.telemetryTags, 1) + c.telemetryCount("datadog.dogstatsd.client.bytes_dropped", int64(metrics.TotalDroppedBytes), c.telemetryTags, 1) + c.telemetryCount("datadog.dogstatsd.client.packets_dropped_queue", int64(metrics.TotalDroppedPayloadsQueueFull), c.telemetryTags, 1) + c.telemetryCount("datadog.dogstatsd.client.bytes_dropped_queue", int64(metrics.TotalDroppedBytesQueueFull), c.telemetryTags, 1) + c.telemetryCount("datadog.dogstatsd.client.packets_dropped_writer", int64(metrics.TotalDroppedPayloadsWriter), c.telemetryTags, 1) + c.telemetryCount("datadog.dogstatsd.client.bytes_dropped_writer", int64(metrics.TotalDroppedBytesWriter), c.telemetryTags, 1) + case <-c.stop: + ticker.Stop() + return } } - - //add whatever is left! if there's actually something - if c.buffer.Len() > 0 { - frames = append(frames, copyAndResetBuffer(&c.buffer)) - ncmds = append(ncmds, elem) - } - - return frames, ncmds } -func copyAndResetBuffer(buf *bytes.Buffer) []byte { - tmpBuf := make([]byte, buf.Len()) - copy(tmpBuf, buf.Bytes()) - buf.Reset() - return tmpBuf +// same as Count but without global namespace / tags +func (c *Client) telemetryCount(name string, value int64, tags []string, rate float64) { + c.addMetric(metric{metricType: count, name: name, ivalue: value, tags: tags, rate: rate}) } -// flush the commands in the buffer. Lock must be held by caller. -func (c *Client) flush() error { - frames, flushable := c.joinMaxSize(c.commands, "\n", OptimalPayloadSize) - var err error - cmdsFlushed := 0 - for i, data := range frames { - e := c.writer.Write(data) - if e != nil { - err = e - break - } - cmdsFlushed += flushable[i] +// Flush forces a flush of all the queued dogstatsd payloads +// This method is blocking and will not return until everything is sent +// through the network +func (c *Client) Flush() error { + if c == nil { + return ErrNoClient } + c.Lock() + defer c.Unlock() + c.flushUnsafe() + c.sender.flush() + return nil +} - // clear the slice with a slice op, doesn't realloc - if cmdsFlushed == len(c.commands) { - c.commands = c.commands[:0] - } else { - //this case will cause a future realloc... - // drop problematic command though (sorry). - c.commands = c.commands[cmdsFlushed+1:] +// flush the current buffer. Lock must be held by caller. +// flushed buffer written to the network asynchronously. +func (c *Client) flushUnsafe() { + if len(c.buffer.bytes()) > 0 { + c.sender.send(c.buffer) + c.buffer = c.bufferPool.borrowBuffer() } - return err } -func (c *Client) sendMsg(msg string) error { - // return an error if message is bigger than MaxUDPPayloadSize - if len(msg) > MaxUDPPayloadSize { - return errors.New("message size exceeds MaxUDPPayloadSize") +func (c *Client) shouldSample(rate float64) bool { + if rate < 1 && rand.Float64() > rate { + return true } + return false +} - // if this client is buffered, then we'll just append this - if c.bufferLength > 0 { - return c.append(msg) +func (c *Client) globalTags() []string { + if c != nil { + return c.Tags } + return nil +} - err := c.writer.Write([]byte(msg)) - - if c.SkipErrors { +func (c *Client) namespace() string { + if c != nil { + return c.Namespace + } + return "" +} + +func (c *Client) writeMetricUnsafe(m metric) error { + switch m.metricType { + case gauge: + return c.buffer.writeGauge(m.namespace, m.globalTags, m.name, m.fvalue, m.tags, m.rate) + case count: + return c.buffer.writeCount(m.namespace, m.globalTags, m.name, m.ivalue, m.tags, m.rate) + case histogram: + return c.buffer.writeHistogram(m.namespace, m.globalTags, m.name, m.fvalue, m.tags, m.rate) + case distribution: + return c.buffer.writeDistribution(m.namespace, m.globalTags, m.name, m.fvalue, m.tags, m.rate) + case set: + return c.buffer.writeSet(m.namespace, m.globalTags, m.name, m.svalue, m.tags, m.rate) + case timing: + return c.buffer.writeTiming(m.namespace, m.globalTags, m.name, m.fvalue, m.tags, m.rate) + case event: + return c.buffer.writeEvent(*m.evalue, m.globalTags) + case serviceCheck: + return c.buffer.writeServiceCheck(*m.scvalue, m.globalTags) + default: return nil - } else { - return err } } -// send handles sampling and sends the message over UDP. It also adds global namespace prefixes and tags. -func (c *Client) send(name string, value interface{}, suffix []byte, tags []string, rate float64) error { +func (c *Client) addMetric(m metric) error { if c == nil { - return nil + return ErrNoClient } - if rate < 1 && rand.Float64() > rate { + if c.shouldSample(m.rate) { return nil } - data := c.format(name, value, suffix, tags, rate) - return c.sendMsg(data) + c.Lock() + var err error + if err = c.writeMetricUnsafe(m); err == errBufferFull { + c.flushUnsafe() + err = c.writeMetricUnsafe(m) + } + c.Unlock() + return err } // Gauge measures the value of a metric at a particular time. func (c *Client) Gauge(name string, value float64, tags []string, rate float64) error { - return c.send(name, value, gaugeSuffix, tags, rate) + return c.addMetric(metric{namespace: c.namespace(), globalTags: c.globalTags(), metricType: gauge, name: name, fvalue: value, tags: tags, rate: rate}) } // Count tracks how many times something happened per second. func (c *Client) Count(name string, value int64, tags []string, rate float64) error { - return c.send(name, value, countSuffix, tags, rate) + return c.addMetric(metric{namespace: c.namespace(), globalTags: c.globalTags(), metricType: count, name: name, ivalue: value, tags: tags, rate: rate}) } -// Histogram tracks the statistical distribution of a set of values. +// Histogram tracks the statistical distribution of a set of values on each host. func (c *Client) Histogram(name string, value float64, tags []string, rate float64) error { - return c.send(name, value, histogramSuffix, tags, rate) + return c.addMetric(metric{namespace: c.namespace(), globalTags: c.globalTags(), metricType: histogram, name: name, fvalue: value, tags: tags, rate: rate}) +} + +// Distribution tracks the statistical distribution of a set of values across your infrastructure. +func (c *Client) Distribution(name string, value float64, tags []string, rate float64) error { + return c.addMetric(metric{namespace: c.namespace(), globalTags: c.globalTags(), metricType: distribution, name: name, fvalue: value, tags: tags, rate: rate}) } // Decr is just Count of -1 func (c *Client) Decr(name string, tags []string, rate float64) error { - return c.send(name, nil, decrSuffix, tags, rate) + return c.Count(name, -1, tags, rate) } // Incr is just Count of 1 func (c *Client) Incr(name string, tags []string, rate float64) error { - return c.send(name, nil, incrSuffix, tags, rate) + return c.Count(name, 1, tags, rate) } // Set counts the number of unique elements in a group. func (c *Client) Set(name string, value string, tags []string, rate float64) error { - return c.send(name, value, setSuffix, tags, rate) + return c.addMetric(metric{namespace: c.namespace(), globalTags: c.globalTags(), metricType: set, name: name, svalue: value, tags: tags, rate: rate}) } // Timing sends timing information, it is an alias for TimeInMilliseconds @@ -350,19 +464,12 @@ func (c *Client) Timing(name string, value time.Duration, tags []string, rate fl // TimeInMilliseconds sends timing information in milliseconds. // It is flushed by statsd with percentiles, mean and other info (https://github.com/etsy/statsd/blob/master/docs/metric_types.md#timing) func (c *Client) TimeInMilliseconds(name string, value float64, tags []string, rate float64) error { - return c.send(name, value, timingSuffix, tags, rate) + return c.addMetric(metric{namespace: c.namespace(), globalTags: c.globalTags(), metricType: timing, name: name, fvalue: value, tags: tags, rate: rate}) } // Event sends the provided Event. func (c *Client) Event(e *Event) error { - if c == nil { - return nil - } - stat, err := e.Encode(c.Tags...) - if err != nil { - return err - } - return c.sendMsg(stat) + return c.addMetric(metric{globalTags: c.globalTags(), metricType: event, evalue: e, rate: 1}) } // SimpleEvent sends an event with the provided title and text. @@ -373,11 +480,7 @@ func (c *Client) SimpleEvent(title, text string) error { // ServiceCheck sends the provided ServiceCheck. func (c *Client) ServiceCheck(sc *ServiceCheck) error { - stat, err := sc.Encode(c.Tags...) - if err != nil { - return err - } - return c.sendMsg(stat) + return c.addMetric(metric{globalTags: c.globalTags(), metricType: serviceCheck, scvalue: sc, rate: 1}) } // SimpleServiceCheck sends an serviceCheck with the provided name and status. @@ -389,256 +492,12 @@ func (c *Client) SimpleServiceCheck(name string, status ServiceCheckStatus) erro // Close the client connection. func (c *Client) Close() error { if c == nil { - return nil + return ErrNoClient } select { case c.stop <- struct{}{}: default: } - return c.writer.Close() -} - -// Events support - -type eventAlertType string - -const ( - // Info is the "info" AlertType for events - Info eventAlertType = "info" - // Error is the "error" AlertType for events - Error eventAlertType = "error" - // Warning is the "warning" AlertType for events - Warning eventAlertType = "warning" - // Success is the "success" AlertType for events - Success eventAlertType = "success" -) - -type eventPriority string - -const ( - // Normal is the "normal" Priority for events - Normal eventPriority = "normal" - // Low is the "low" Priority for events - Low eventPriority = "low" -) - -// An Event is an object that can be posted to your DataDog event stream. -type Event struct { - // Title of the event. Required. - Title string - // Text is the description of the event. Required. - Text string - // Timestamp is a timestamp for the event. If not provided, the dogstatsd - // server will set this to the current time. - Timestamp time.Time - // Hostname for the event. - Hostname string - // AggregationKey groups this event with others of the same key. - AggregationKey string - // Priority of the event. Can be statsd.Low or statsd.Normal. - Priority eventPriority - // SourceTypeName is a source type for the event. - SourceTypeName string - // AlertType can be statsd.Info, statsd.Error, statsd.Warning, or statsd.Success. - // If absent, the default value applied by the dogstatsd server is Info. - AlertType eventAlertType - // Tags for the event. - Tags []string -} - -// NewEvent creates a new event with the given title and text. Error checking -// against these values is done at send-time, or upon running e.Check. -func NewEvent(title, text string) *Event { - return &Event{ - Title: title, - Text: text, - } -} - -// Check verifies that an event is valid. -func (e Event) Check() error { - if len(e.Title) == 0 { - return fmt.Errorf("statsd.Event title is required") - } - if len(e.Text) == 0 { - return fmt.Errorf("statsd.Event text is required") - } - return nil -} - -// Encode returns the dogstatsd wire protocol representation for an event. -// Tags may be passed which will be added to the encoded output but not to -// the Event's list of tags, eg. for default tags. -func (e Event) Encode(tags ...string) (string, error) { - err := e.Check() - if err != nil { - return "", err - } - text := e.escapedText() - - var buffer bytes.Buffer - buffer.WriteString("_e{") - buffer.WriteString(strconv.FormatInt(int64(len(e.Title)), 10)) - buffer.WriteRune(',') - buffer.WriteString(strconv.FormatInt(int64(len(text)), 10)) - buffer.WriteString("}:") - buffer.WriteString(e.Title) - buffer.WriteRune('|') - buffer.WriteString(text) - - if !e.Timestamp.IsZero() { - buffer.WriteString("|d:") - buffer.WriteString(strconv.FormatInt(int64(e.Timestamp.Unix()), 10)) - } - - if len(e.Hostname) != 0 { - buffer.WriteString("|h:") - buffer.WriteString(e.Hostname) - } - - if len(e.AggregationKey) != 0 { - buffer.WriteString("|k:") - buffer.WriteString(e.AggregationKey) - - } - - if len(e.Priority) != 0 { - buffer.WriteString("|p:") - buffer.WriteString(string(e.Priority)) - } - - if len(e.SourceTypeName) != 0 { - buffer.WriteString("|s:") - buffer.WriteString(e.SourceTypeName) - } - - if len(e.AlertType) != 0 { - buffer.WriteString("|t:") - buffer.WriteString(string(e.AlertType)) - } - - writeTagString(&buffer, tags, e.Tags) - - return buffer.String(), nil -} - -// ServiceCheck support - -type ServiceCheckStatus byte - -const ( - // Ok is the "ok" ServiceCheck status - Ok ServiceCheckStatus = 0 - // Warn is the "warning" ServiceCheck status - Warn ServiceCheckStatus = 1 - // Critical is the "critical" ServiceCheck status - Critical ServiceCheckStatus = 2 - // Unknown is the "unknown" ServiceCheck status - Unknown ServiceCheckStatus = 3 -) - -// An ServiceCheck is an object that contains status of DataDog service check. -type ServiceCheck struct { - // Name of the service check. Required. - Name string - // Status of service check. Required. - Status ServiceCheckStatus - // Timestamp is a timestamp for the serviceCheck. If not provided, the dogstatsd - // server will set this to the current time. - Timestamp time.Time - // Hostname for the serviceCheck. - Hostname string - // A message describing the current state of the serviceCheck. - Message string - // Tags for the serviceCheck. - Tags []string -} - -// NewServiceCheck creates a new serviceCheck with the given name and status. Error checking -// against these values is done at send-time, or upon running sc.Check. -func NewServiceCheck(name string, status ServiceCheckStatus) *ServiceCheck { - return &ServiceCheck{ - Name: name, - Status: status, - } -} - -// Check verifies that an event is valid. -func (sc ServiceCheck) Check() error { - if len(sc.Name) == 0 { - return fmt.Errorf("statsd.ServiceCheck name is required") - } - if byte(sc.Status) < 0 || byte(sc.Status) > 3 { - return fmt.Errorf("statsd.ServiceCheck status has invalid value") - } - return nil -} - -// Encode returns the dogstatsd wire protocol representation for an serviceCheck. -// Tags may be passed which will be added to the encoded output but not to -// the Event's list of tags, eg. for default tags. -func (sc ServiceCheck) Encode(tags ...string) (string, error) { - err := sc.Check() - if err != nil { - return "", err - } - message := sc.escapedMessage() - - var buffer bytes.Buffer - buffer.WriteString("_sc|") - buffer.WriteString(sc.Name) - buffer.WriteRune('|') - buffer.WriteString(strconv.FormatInt(int64(sc.Status), 10)) - - if !sc.Timestamp.IsZero() { - buffer.WriteString("|d:") - buffer.WriteString(strconv.FormatInt(int64(sc.Timestamp.Unix()), 10)) - } - - if len(sc.Hostname) != 0 { - buffer.WriteString("|h:") - buffer.WriteString(sc.Hostname) - } - - writeTagString(&buffer, tags, sc.Tags) - - if len(message) != 0 { - buffer.WriteString("|m:") - buffer.WriteString(message) - } - - return buffer.String(), nil -} - -func (e Event) escapedText() string { - return strings.Replace(e.Text, "\n", "\\n", -1) -} - -func (sc ServiceCheck) escapedMessage() string { - msg := strings.Replace(sc.Message, "\n", "\\n", -1) - return strings.Replace(msg, "m:", `m\:`, -1) -} - -func removeNewlines(str string) string { - return strings.Replace(str, "\n", "", -1) -} - -func writeTagString(w io.Writer, tagList1, tagList2 []string) { - // the tag lists may be shared with other callers, so we cannot modify - // them in any way (which means we cannot append to them either) - // therefore we must make an entirely separate copy just for this call - totalLen := len(tagList1) + len(tagList2) - if totalLen == 0 { - return - } - tags := make([]string, 0, totalLen) - tags = append(tags, tagList1...) - tags = append(tags, tagList2...) - - io.WriteString(w, "|#") - io.WriteString(w, removeNewlines(tags[0])) - for _, tag := range tags[1:] { - io.WriteString(w, ",") - io.WriteString(w, removeNewlines(tag)) - } + c.Flush() + return c.sender.close() } diff --git a/vendor/github.com/DataDog/datadog-go/statsd/udp.go b/vendor/github.com/DataDog/datadog-go/statsd/udp.go index 7cbb5148bf65..9ddff421c704 100644 --- a/vendor/github.com/DataDog/datadog-go/statsd/udp.go +++ b/vendor/github.com/DataDog/datadog-go/statsd/udp.go @@ -2,17 +2,32 @@ package statsd import ( "errors" + "fmt" "net" + "os" "time" ) +const ( + autoHostEnvName = "DD_AGENT_HOST" + autoPortEnvName = "DD_DOGSTATSD_PORT" + defaultUDPPort = "8125" +) + // udpWriter is an internal class wrapping around management of UDP connection type udpWriter struct { conn net.Conn } // New returns a pointer to a new udpWriter given an addr in the format "hostname:port". -func newUdpWriter(addr string) (*udpWriter, error) { +func newUDPWriter(addr string) (*udpWriter, error) { + if addr == "" { + addr = addressFromEnvironment() + } + if addr == "" { + return nil, errors.New("No address passed and autodetection from environment failed") + } + udpAddr, err := net.ResolveUDPAddr("udp", addr) if err != nil { return nil, err @@ -31,11 +46,28 @@ func (w *udpWriter) SetWriteTimeout(d time.Duration) error { } // Write data to the UDP connection with no error handling -func (w *udpWriter) Write(data []byte) error { - _, e := w.conn.Write(data) - return e +func (w *udpWriter) Write(data []byte) (int, error) { + return w.conn.Write(data) } func (w *udpWriter) Close() error { return w.conn.Close() } + +func (w *udpWriter) remoteAddr() net.Addr { + return w.conn.RemoteAddr() +} + +func addressFromEnvironment() string { + autoHost := os.Getenv(autoHostEnvName) + if autoHost == "" { + return "" + } + + autoPort := os.Getenv(autoPortEnvName) + if autoPort == "" { + autoPort = defaultUDPPort + } + + return fmt.Sprintf("%s:%s", autoHost, autoPort) +} diff --git a/vendor/github.com/DataDog/datadog-go/statsd/uds.go b/vendor/github.com/DataDog/datadog-go/statsd/uds.go index fb8641a7cc7e..0762e1c42bee 100644 --- a/vendor/github.com/DataDog/datadog-go/statsd/uds.go +++ b/vendor/github.com/DataDog/datadog-go/statsd/uds.go @@ -2,7 +2,7 @@ package statsd import ( "net" - "strings" + "sync" "time" ) @@ -20,10 +20,11 @@ type udsWriter struct { conn net.Conn // write timeout writeTimeout time.Duration + sync.RWMutex // used to lock conn / writer can replace it } -// New returns a pointer to a new udsWriter given a socket file path as addr. -func newUdsWriter(addr string) (*udsWriter, error) { +// newUDSWriter returns a pointer to a new udsWriter given a socket file path as addr. +func newUDSWriter(addr string) (*udsWriter, error) { udsAddr, err := net.ResolveUnixAddr("unixgram", addr) if err != nil { return nil, err @@ -41,26 +42,57 @@ func (w *udsWriter) SetWriteTimeout(d time.Duration) error { // Write data to the UDS connection with write timeout and minimal error handling: // create the connection if nil, and destroy it if the statsd server has disconnected -func (w *udsWriter) Write(data []byte) error { - // Try connecting (first packet or connection lost) - if w.conn == nil { - conn, err := net.Dial(w.addr.Network(), w.addr.String()) - if err != nil { - return err - } else { - w.conn = conn - } +func (w *udsWriter) Write(data []byte) (int, error) { + conn, err := w.ensureConnection() + if err != nil { + return 0, err } - w.conn.SetWriteDeadline(time.Now().Add(w.writeTimeout)) - _, e := w.conn.Write(data) - if e != nil && strings.Contains(e.Error(), "transport endpoint is not connected") { + + conn.SetWriteDeadline(time.Now().Add(w.writeTimeout)) + n, e := conn.Write(data) + + if err, isNetworkErr := e.(net.Error); !isNetworkErr || !err.Temporary() { // Statsd server disconnected, retry connecting at next packet - w.conn = nil - return e + w.unsetConnection() + return 0, e } - return e + return n, e } func (w *udsWriter) Close() error { - return w.conn.Close() + if w.conn != nil { + return w.conn.Close() + } + return nil +} + +func (w *udsWriter) ensureConnection() (net.Conn, error) { + // Check if we've already got a socket we can use + w.RLock() + currentConn := w.conn + w.RUnlock() + + if currentConn != nil { + return currentConn, nil + } + + // Looks like we might need to connect - try again with write locking. + w.Lock() + defer w.Unlock() + if w.conn != nil { + return w.conn, nil + } + + newConn, err := net.Dial(w.addr.Network(), w.addr.String()) + if err != nil { + return nil, err + } + w.conn = newConn + return newConn, nil +} + +func (w *udsWriter) unsetConnection() { + w.Lock() + defer w.Unlock() + w.conn = nil } diff --git a/vendor/github.com/LK4D4/joincontext/.travis.yml b/vendor/github.com/LK4D4/joincontext/.travis.yml new file mode 100644 index 000000000000..e087144cbf48 --- /dev/null +++ b/vendor/github.com/LK4D4/joincontext/.travis.yml @@ -0,0 +1,13 @@ +language: go +sudo: false +go: + - 1.9 + - master +install: + - go get -t ./... + - go get github.com/golang/lint/golint +script: + - go vet ./... + - golint -set_exit_status ./... + - test -z "$(gofmt -s -l . | tee /dev/stderr)" + - go test -race -v ./... diff --git a/vendor/github.com/Microsoft/go-winio/.gitignore b/vendor/github.com/Microsoft/go-winio/.gitignore new file mode 100644 index 000000000000..b883f1fdc6d6 --- /dev/null +++ b/vendor/github.com/Microsoft/go-winio/.gitignore @@ -0,0 +1 @@ +*.exe diff --git a/vendor/github.com/NVIDIA/gpu-monitoring-tools/CLA b/vendor/github.com/NVIDIA/gpu-monitoring-tools/CLA deleted file mode 100644 index 1001ecb5f4b6..000000000000 --- a/vendor/github.com/NVIDIA/gpu-monitoring-tools/CLA +++ /dev/null @@ -1,160 +0,0 @@ - GPU Monitoring Tools - Software Grant and Corporate Contributor License Agreement ("Agreement") - - Thank you for your interest in the gpu-monitoring-tools Project (the - "Project"). In order to clarify the intellectual property license - granted with Contributions from any person or entity, NVIDIA - Corporation (the “Copyright Holders") must have a Contributor License - Agreement (CLA) on file that has been signed by each Contributor, - indicating agreement to the license terms below. This license is - for your protection as a Contributor as well as the protection of the - Project and its users; it does not change your rights to use your own - Contributions for any other purpose. - - This version of the Agreement allows an entity (the "Corporation") to - submit Contributions to the Project, to authorize Contributions - submitted by its designated employees to the Project, and to grant - copyright and patent licenses thereto to the Copyright Holders. - - If you have not already done so, please complete and sign, then scan and - email a pdf file of this Agreement to digits@nvidia.com. - Please read this document carefully before signing and keep a copy for - your records. - - Corporation name: ________________________________________________ - - Corporation address: ________________________________________________ - - ________________________________________________ - - ________________________________________________ - - Point of Contact: ________________________________________________ - - E-Mail: ________________________________________________ - - Telephone: _____________________ Fax: _____________________ - - - You accept and agree to the following terms and conditions for Your - present and future Contributions submitted to the Project. In - return, the Copyright Holders shall not use Your Contributions in a way - that is contrary to the public benefit or inconsistent with its nonprofit - status and bylaws in effect at the time of the Contribution. Except - for the license granted herein to the Copyright Holders and recipients of - software distributed by the Copyright Holders, You reserve all right, title, - and interest in and to Your Contributions. - - 1. Definitions. - - "You" (or "Your") shall mean the copyright owner or legal entity - authorized by the copyright owner that is making this Agreement - with the Copyright Holders. For legal entities, the entity making a - Contribution and all other entities that control, are controlled by, - or are under common control with that entity are considered to be a - single Contributor. 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. - - "Contribution" shall mean the code, documentation or other original - works of authorship expressly identified in Schedule B, as well as - any original work of authorship, including - any modifications or additions to an existing work, that is intentionally - submitted by You to the Copyright Holders for inclusion in, or - documentation of, any of the products owned or managed by the - Copyright Holders (the "Work"). For the purposes of this definition, - "submitted" means any form of electronic, verbal, or written - communication sent to the Copyright Holders 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 Copyright Holders for the - purpose of discussing and improving the Work, but excluding - communication that is conspicuously marked or otherwise designated - in writing by You as "Not a Contribution." - - 2. Grant of Copyright License. Subject to the terms and conditions - of this Agreement, You hereby grant to the Copyright Holders and to - recipients of software distributed by the Copyright Holders 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 - Your Contributions and such derivative works. - - 3. Grant of Patent License. Subject to the terms and conditions of - this Agreement, You hereby grant to the Copyright Holders and to - recipients of software distributed by the Copyright Holders - 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 You that are necessarily infringed - by Your Contribution(s) alone or by combination of Your Contribution(s) - with the Work to which such Contribution(s) were submitted. - If any entity institutes patent litigation against You or any - other entity (including a cross-claim or counterclaim in a lawsuit) - alleging that your Contribution, or the Work to which you have - contributed, constitutes direct or contributory patent infringement, - then any patent licenses granted to that entity under this Agreement - for that Contribution or Work shall terminate as of the date such - litigation is filed. - - 4. You represent that You are legally entitled to grant the above - license. You represent further that each employee of the - Corporation designated on Schedule A below (or in a subsequent - written modification to that Schedule) is authorized to submit - Contributions on behalf of the Corporation. - - 5. You represent that each of Your Contributions is Your original - creation (see section 7 for submissions on behalf of others). - - 6. You are not expected to provide support for Your Contributions, - except to the extent You desire to provide support. You may provide - support for free, for a fee, or not at all. Unless required by - applicable law or agreed to in writing, You provide Your - 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. - - 7. Should You wish to submit work that is not Your original creation, - You may submit it to the Copyright Holders separately from any - Contribution, identifying the complete details of its source and - of any license or other restriction (including, but not limited - to, related patents, trademarks, and license agreements) of which - you are personally aware, and conspicuously marking the work as - "Submitted on behalf of a third-party: [named here]". - - 8. It is your responsibility to notify the Copyright Holders when any change - is required to the list of designated employees authorized to submit - Contributions on behalf of the Corporation, or to the Corporation's - Point of Contact with the Copyright Holders. - - - - Please sign: __________________________________ Date: _______________ - - Title: __________________________________ - - Corporation: __________________________________ - - - - -Schedule A - - [Initial list of designated employees. NB: authorization is not - tied to particular Contributions.] - - - - - - -Schedule B - - [Identification of optional concurrent software grant. Would be - left blank or omitted if there is no concurrent software grant.] - - diff --git a/vendor/github.com/NVIDIA/gpu-monitoring-tools/README.md b/vendor/github.com/NVIDIA/gpu-monitoring-tools/README.md deleted file mode 100644 index 58d90402e1ca..000000000000 --- a/vendor/github.com/NVIDIA/gpu-monitoring-tools/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# NVIDIA GPU Monitoring Tools - -## NVML Go Bindings - -[NVIDIA Management Library (NVML)](https://developer.nvidia.com/nvidia-management-library-nvml) is a C-based API for monitoring and managing NVIDIA GPU devices. -NVML go bindings are taken from [nvidia-docker 1.0](https://github.com/NVIDIA/nvidia-docker/tree/1.0) with some improvements and additions. NVML headers are also added to the package to make it easy to use and build. - -### NVML Samples -Three [samples](https://github.com/NVIDIA/gpu-monitoring-tools/blob/master/bindings/go/samples/nvml/README.md) are included to demonstrate how to use the NVML API. - - -## DCGM Go Bindings - -[NVIDIA Data Center GPU Manager (DCGM)](https://developer.nvidia.com/data-center-gpu-manager-dcgm) is a set of tools for managing and monitoring NVIDIA GPUs in cluster environments. It's a low overhead tool suite that performs a variety of functions on each host system including active health monitoring, diagnostics, system validation, policies, power and clock management, group configuration and accounting. - -DCGM go bindings makes administering and monitoring containerized GPU applications easy. - -### DCGM Samples - -DCGM can be run in different modes, seven [samples](https://github.com/NVIDIA/gpu-monitoring-tools/blob/master/bindings/go/samples/dcgm/README.md) and a [REST API](https://github.com/NVIDIA/gpu-monitoring-tools/blob/master/bindings/go/samples/dcgm/restApi/README.md) are included for showing how to use the DCGM API and run it in different modes. - - -## DCGM exporter - -GPU metrics exporter for [Prometheus](https://prometheus.io/) leveraging [NVIDIA Data Center GPU Manager (DCGM)](https://developer.nvidia.com/data-center-gpu-manager-dcgm) is a simple shell script that starts nv-hostengine, reads GPU metrics every 1 second and converts it to a standard Prometheus format. - -Find the installation and run instructions [here](https://github.com/NVIDIA/gpu-monitoring-tools/blob/master/exporters/prometheus-dcgm/README.md). - -## Issues and Contributing - -A signed copy of the [Contributor License Agreement](https://github.com/NVIDIA/gpu-monitoring-tools/blob/master/CLA) needs to be provided to digits@nvidia.com before any change can be accepted. - -* Please let us know by [filing a new issue](https://github.com/NVIDIA/gpu-monitoring-tools/issues/new) -* You can contribute by opening a [pull request](https://help.github.com/articles/using-pull-requests/) diff --git a/vendor/github.com/NYTimes/gziphandler/.gitignore b/vendor/github.com/NYTimes/gziphandler/.gitignore new file mode 100644 index 000000000000..1377554ebea6 --- /dev/null +++ b/vendor/github.com/NYTimes/gziphandler/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/vendor/github.com/NYTimes/gziphandler/.travis.yml b/vendor/github.com/NYTimes/gziphandler/.travis.yml new file mode 100644 index 000000000000..d2b67f69c1cf --- /dev/null +++ b/vendor/github.com/NYTimes/gziphandler/.travis.yml @@ -0,0 +1,6 @@ +language: go + +go: + - 1.7 + - 1.8 + - tip diff --git a/vendor/github.com/NYTimes/gziphandler/gzip.go b/vendor/github.com/NYTimes/gziphandler/gzip.go index b6af9115a461..901c4554ac6d 100644 --- a/vendor/github.com/NYTimes/gziphandler/gzip.go +++ b/vendor/github.com/NYTimes/gziphandler/gzip.go @@ -150,7 +150,9 @@ func (w *GzipResponseWriter) startGzip() error { // WriteHeader just saves the response code until close or GZIP effective writes. func (w *GzipResponseWriter) WriteHeader(code int) { - w.code = code + if w.code == 0 { + w.code = code + } } // init graps a new gzip writer from the gzipWriterPool and writes the correct @@ -190,10 +192,16 @@ func (w *GzipResponseWriter) Close() error { // http.ResponseWriter if it is an http.Flusher. This makes GzipResponseWriter // an http.Flusher. func (w *GzipResponseWriter) Flush() { - if w.gw != nil { - w.gw.Flush() + if w.gw == nil { + // Only flush once startGzip has been called. + // + // Flush is thus a no-op until the written body + // exceeds minSize. + return } + w.gw.Flush() + if fw, ok := w.ResponseWriter.(http.Flusher); ok { fw.Flush() } diff --git a/vendor/github.com/Nvveen/Gotty/LICENSE b/vendor/github.com/Nvveen/Gotty/LICENSE deleted file mode 100644 index 0b71c97360eb..000000000000 --- a/vendor/github.com/Nvveen/Gotty/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2012, Neal van Veen (nealvanveen@gmail.com) -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 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 views and conclusions contained in the software and documentation are those -of the authors and should not be interpreted as representing official policies, -either expressed or implied, of the FreeBSD Project. diff --git a/vendor/github.com/Nvveen/Gotty/README b/vendor/github.com/Nvveen/Gotty/README deleted file mode 100644 index a6b0d9a8fe25..000000000000 --- a/vendor/github.com/Nvveen/Gotty/README +++ /dev/null @@ -1,5 +0,0 @@ -Gotty is a library written in Go that determines and reads termcap database -files to produce an interface for interacting with the capabilities of a -terminal. -See the godoc documentation or the source code for more information about -function usage. diff --git a/vendor/github.com/Nvveen/Gotty/TODO b/vendor/github.com/Nvveen/Gotty/TODO deleted file mode 100644 index 470460531ca9..000000000000 --- a/vendor/github.com/Nvveen/Gotty/TODO +++ /dev/null @@ -1,3 +0,0 @@ -gotty.go:// TODO add more concurrency to name lookup, look for more opportunities. -all:// TODO add more documentation, with function usage in a doc.go file. -all:// TODO add more testing/benchmarking with go test. diff --git a/vendor/github.com/Nvveen/Gotty/attributes.go b/vendor/github.com/Nvveen/Gotty/attributes.go deleted file mode 100644 index a4c005fae583..000000000000 --- a/vendor/github.com/Nvveen/Gotty/attributes.go +++ /dev/null @@ -1,514 +0,0 @@ -// Copyright 2012 Neal van Veen. All rights reserved. -// Usage of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package gotty - -// Boolean capabilities -var BoolAttr = [...]string{ - "auto_left_margin", "bw", - "auto_right_margin", "am", - "no_esc_ctlc", "xsb", - "ceol_standout_glitch", "xhp", - "eat_newline_glitch", "xenl", - "erase_overstrike", "eo", - "generic_type", "gn", - "hard_copy", "hc", - "has_meta_key", "km", - "has_status_line", "hs", - "insert_null_glitch", "in", - "memory_above", "da", - "memory_below", "db", - "move_insert_mode", "mir", - "move_standout_mode", "msgr", - "over_strike", "os", - "status_line_esc_ok", "eslok", - "dest_tabs_magic_smso", "xt", - "tilde_glitch", "hz", - "transparent_underline", "ul", - "xon_xoff", "nxon", - "needs_xon_xoff", "nxon", - "prtr_silent", "mc5i", - "hard_cursor", "chts", - "non_rev_rmcup", "nrrmc", - "no_pad_char", "npc", - "non_dest_scroll_region", "ndscr", - "can_change", "ccc", - "back_color_erase", "bce", - "hue_lightness_saturation", "hls", - "col_addr_glitch", "xhpa", - "cr_cancels_micro_mode", "crxm", - "has_print_wheel", "daisy", - "row_addr_glitch", "xvpa", - "semi_auto_right_margin", "sam", - "cpi_changes_res", "cpix", - "lpi_changes_res", "lpix", - "backspaces_with_bs", "", - "crt_no_scrolling", "", - "no_correctly_working_cr", "", - "gnu_has_meta_key", "", - "linefeed_is_newline", "", - "has_hardware_tabs", "", - "return_does_clr_eol", "", -} - -// Numerical capabilities -var NumAttr = [...]string{ - "columns", "cols", - "init_tabs", "it", - "lines", "lines", - "lines_of_memory", "lm", - "magic_cookie_glitch", "xmc", - "padding_baud_rate", "pb", - "virtual_terminal", "vt", - "width_status_line", "wsl", - "num_labels", "nlab", - "label_height", "lh", - "label_width", "lw", - "max_attributes", "ma", - "maximum_windows", "wnum", - "max_colors", "colors", - "max_pairs", "pairs", - "no_color_video", "ncv", - "buffer_capacity", "bufsz", - "dot_vert_spacing", "spinv", - "dot_horz_spacing", "spinh", - "max_micro_address", "maddr", - "max_micro_jump", "mjump", - "micro_col_size", "mcs", - "micro_line_size", "mls", - "number_of_pins", "npins", - "output_res_char", "orc", - "output_res_line", "orl", - "output_res_horz_inch", "orhi", - "output_res_vert_inch", "orvi", - "print_rate", "cps", - "wide_char_size", "widcs", - "buttons", "btns", - "bit_image_entwining", "bitwin", - "bit_image_type", "bitype", - "magic_cookie_glitch_ul", "", - "carriage_return_delay", "", - "new_line_delay", "", - "backspace_delay", "", - "horizontal_tab_delay", "", - "number_of_function_keys", "", -} - -// String capabilities -var StrAttr = [...]string{ - "back_tab", "cbt", - "bell", "bel", - "carriage_return", "cr", - "change_scroll_region", "csr", - "clear_all_tabs", "tbc", - "clear_screen", "clear", - "clr_eol", "el", - "clr_eos", "ed", - "column_address", "hpa", - "command_character", "cmdch", - "cursor_address", "cup", - "cursor_down", "cud1", - "cursor_home", "home", - "cursor_invisible", "civis", - "cursor_left", "cub1", - "cursor_mem_address", "mrcup", - "cursor_normal", "cnorm", - "cursor_right", "cuf1", - "cursor_to_ll", "ll", - "cursor_up", "cuu1", - "cursor_visible", "cvvis", - "delete_character", "dch1", - "delete_line", "dl1", - "dis_status_line", "dsl", - "down_half_line", "hd", - "enter_alt_charset_mode", "smacs", - "enter_blink_mode", "blink", - "enter_bold_mode", "bold", - "enter_ca_mode", "smcup", - "enter_delete_mode", "smdc", - "enter_dim_mode", "dim", - "enter_insert_mode", "smir", - "enter_secure_mode", "invis", - "enter_protected_mode", "prot", - "enter_reverse_mode", "rev", - "enter_standout_mode", "smso", - "enter_underline_mode", "smul", - "erase_chars", "ech", - "exit_alt_charset_mode", "rmacs", - "exit_attribute_mode", "sgr0", - "exit_ca_mode", "rmcup", - "exit_delete_mode", "rmdc", - "exit_insert_mode", "rmir", - "exit_standout_mode", "rmso", - "exit_underline_mode", "rmul", - "flash_screen", "flash", - "form_feed", "ff", - "from_status_line", "fsl", - "init_1string", "is1", - "init_2string", "is2", - "init_3string", "is3", - "init_file", "if", - "insert_character", "ich1", - "insert_line", "il1", - "insert_padding", "ip", - "key_backspace", "kbs", - "key_catab", "ktbc", - "key_clear", "kclr", - "key_ctab", "kctab", - "key_dc", "kdch1", - "key_dl", "kdl1", - "key_down", "kcud1", - "key_eic", "krmir", - "key_eol", "kel", - "key_eos", "ked", - "key_f0", "kf0", - "key_f1", "kf1", - "key_f10", "kf10", - "key_f2", "kf2", - "key_f3", "kf3", - "key_f4", "kf4", - "key_f5", "kf5", - "key_f6", "kf6", - "key_f7", "kf7", - "key_f8", "kf8", - "key_f9", "kf9", - "key_home", "khome", - "key_ic", "kich1", - "key_il", "kil1", - "key_left", "kcub1", - "key_ll", "kll", - "key_npage", "knp", - "key_ppage", "kpp", - "key_right", "kcuf1", - "key_sf", "kind", - "key_sr", "kri", - "key_stab", "khts", - "key_up", "kcuu1", - "keypad_local", "rmkx", - "keypad_xmit", "smkx", - "lab_f0", "lf0", - "lab_f1", "lf1", - "lab_f10", "lf10", - "lab_f2", "lf2", - "lab_f3", "lf3", - "lab_f4", "lf4", - "lab_f5", "lf5", - "lab_f6", "lf6", - "lab_f7", "lf7", - "lab_f8", "lf8", - "lab_f9", "lf9", - "meta_off", "rmm", - "meta_on", "smm", - "newline", "_glitch", - "pad_char", "npc", - "parm_dch", "dch", - "parm_delete_line", "dl", - "parm_down_cursor", "cud", - "parm_ich", "ich", - "parm_index", "indn", - "parm_insert_line", "il", - "parm_left_cursor", "cub", - "parm_right_cursor", "cuf", - "parm_rindex", "rin", - "parm_up_cursor", "cuu", - "pkey_key", "pfkey", - "pkey_local", "pfloc", - "pkey_xmit", "pfx", - "print_screen", "mc0", - "prtr_off", "mc4", - "prtr_on", "mc5", - "repeat_char", "rep", - "reset_1string", "rs1", - "reset_2string", "rs2", - "reset_3string", "rs3", - "reset_file", "rf", - "restore_cursor", "rc", - "row_address", "mvpa", - "save_cursor", "row_address", - "scroll_forward", "ind", - "scroll_reverse", "ri", - "set_attributes", "sgr", - "set_tab", "hts", - "set_window", "wind", - "tab", "s_magic_smso", - "to_status_line", "tsl", - "underline_char", "uc", - "up_half_line", "hu", - "init_prog", "iprog", - "key_a1", "ka1", - "key_a3", "ka3", - "key_b2", "kb2", - "key_c1", "kc1", - "key_c3", "kc3", - "prtr_non", "mc5p", - "char_padding", "rmp", - "acs_chars", "acsc", - "plab_norm", "pln", - "key_btab", "kcbt", - "enter_xon_mode", "smxon", - "exit_xon_mode", "rmxon", - "enter_am_mode", "smam", - "exit_am_mode", "rmam", - "xon_character", "xonc", - "xoff_character", "xoffc", - "ena_acs", "enacs", - "label_on", "smln", - "label_off", "rmln", - "key_beg", "kbeg", - "key_cancel", "kcan", - "key_close", "kclo", - "key_command", "kcmd", - "key_copy", "kcpy", - "key_create", "kcrt", - "key_end", "kend", - "key_enter", "kent", - "key_exit", "kext", - "key_find", "kfnd", - "key_help", "khlp", - "key_mark", "kmrk", - "key_message", "kmsg", - "key_move", "kmov", - "key_next", "knxt", - "key_open", "kopn", - "key_options", "kopt", - "key_previous", "kprv", - "key_print", "kprt", - "key_redo", "krdo", - "key_reference", "kref", - "key_refresh", "krfr", - "key_replace", "krpl", - "key_restart", "krst", - "key_resume", "kres", - "key_save", "ksav", - "key_suspend", "kspd", - "key_undo", "kund", - "key_sbeg", "kBEG", - "key_scancel", "kCAN", - "key_scommand", "kCMD", - "key_scopy", "kCPY", - "key_screate", "kCRT", - "key_sdc", "kDC", - "key_sdl", "kDL", - "key_select", "kslt", - "key_send", "kEND", - "key_seol", "kEOL", - "key_sexit", "kEXT", - "key_sfind", "kFND", - "key_shelp", "kHLP", - "key_shome", "kHOM", - "key_sic", "kIC", - "key_sleft", "kLFT", - "key_smessage", "kMSG", - "key_smove", "kMOV", - "key_snext", "kNXT", - "key_soptions", "kOPT", - "key_sprevious", "kPRV", - "key_sprint", "kPRT", - "key_sredo", "kRDO", - "key_sreplace", "kRPL", - "key_sright", "kRIT", - "key_srsume", "kRES", - "key_ssave", "kSAV", - "key_ssuspend", "kSPD", - "key_sundo", "kUND", - "req_for_input", "rfi", - "key_f11", "kf11", - "key_f12", "kf12", - "key_f13", "kf13", - "key_f14", "kf14", - "key_f15", "kf15", - "key_f16", "kf16", - "key_f17", "kf17", - "key_f18", "kf18", - "key_f19", "kf19", - "key_f20", "kf20", - "key_f21", "kf21", - "key_f22", "kf22", - "key_f23", "kf23", - "key_f24", "kf24", - "key_f25", "kf25", - "key_f26", "kf26", - "key_f27", "kf27", - "key_f28", "kf28", - "key_f29", "kf29", - "key_f30", "kf30", - "key_f31", "kf31", - "key_f32", "kf32", - "key_f33", "kf33", - "key_f34", "kf34", - "key_f35", "kf35", - "key_f36", "kf36", - "key_f37", "kf37", - "key_f38", "kf38", - "key_f39", "kf39", - "key_f40", "kf40", - "key_f41", "kf41", - "key_f42", "kf42", - "key_f43", "kf43", - "key_f44", "kf44", - "key_f45", "kf45", - "key_f46", "kf46", - "key_f47", "kf47", - "key_f48", "kf48", - "key_f49", "kf49", - "key_f50", "kf50", - "key_f51", "kf51", - "key_f52", "kf52", - "key_f53", "kf53", - "key_f54", "kf54", - "key_f55", "kf55", - "key_f56", "kf56", - "key_f57", "kf57", - "key_f58", "kf58", - "key_f59", "kf59", - "key_f60", "kf60", - "key_f61", "kf61", - "key_f62", "kf62", - "key_f63", "kf63", - "clr_bol", "el1", - "clear_margins", "mgc", - "set_left_margin", "smgl", - "set_right_margin", "smgr", - "label_format", "fln", - "set_clock", "sclk", - "display_clock", "dclk", - "remove_clock", "rmclk", - "create_window", "cwin", - "goto_window", "wingo", - "hangup", "hup", - "dial_phone", "dial", - "quick_dial", "qdial", - "tone", "tone", - "pulse", "pulse", - "flash_hook", "hook", - "fixed_pause", "pause", - "wait_tone", "wait", - "user0", "u0", - "user1", "u1", - "user2", "u2", - "user3", "u3", - "user4", "u4", - "user5", "u5", - "user6", "u6", - "user7", "u7", - "user8", "u8", - "user9", "u9", - "orig_pair", "op", - "orig_colors", "oc", - "initialize_color", "initc", - "initialize_pair", "initp", - "set_color_pair", "scp", - "set_foreground", "setf", - "set_background", "setb", - "change_char_pitch", "cpi", - "change_line_pitch", "lpi", - "change_res_horz", "chr", - "change_res_vert", "cvr", - "define_char", "defc", - "enter_doublewide_mode", "swidm", - "enter_draft_quality", "sdrfq", - "enter_italics_mode", "sitm", - "enter_leftward_mode", "slm", - "enter_micro_mode", "smicm", - "enter_near_letter_quality", "snlq", - "enter_normal_quality", "snrmq", - "enter_shadow_mode", "sshm", - "enter_subscript_mode", "ssubm", - "enter_superscript_mode", "ssupm", - "enter_upward_mode", "sum", - "exit_doublewide_mode", "rwidm", - "exit_italics_mode", "ritm", - "exit_leftward_mode", "rlm", - "exit_micro_mode", "rmicm", - "exit_shadow_mode", "rshm", - "exit_subscript_mode", "rsubm", - "exit_superscript_mode", "rsupm", - "exit_upward_mode", "rum", - "micro_column_address", "mhpa", - "micro_down", "mcud1", - "micro_left", "mcub1", - "micro_right", "mcuf1", - "micro_row_address", "mvpa", - "micro_up", "mcuu1", - "order_of_pins", "porder", - "parm_down_micro", "mcud", - "parm_left_micro", "mcub", - "parm_right_micro", "mcuf", - "parm_up_micro", "mcuu", - "select_char_set", "scs", - "set_bottom_margin", "smgb", - "set_bottom_margin_parm", "smgbp", - "set_left_margin_parm", "smglp", - "set_right_margin_parm", "smgrp", - "set_top_margin", "smgt", - "set_top_margin_parm", "smgtp", - "start_bit_image", "sbim", - "start_char_set_def", "scsd", - "stop_bit_image", "rbim", - "stop_char_set_def", "rcsd", - "subscript_characters", "subcs", - "superscript_characters", "supcs", - "these_cause_cr", "docr", - "zero_motion", "zerom", - "char_set_names", "csnm", - "key_mouse", "kmous", - "mouse_info", "minfo", - "req_mouse_pos", "reqmp", - "get_mouse", "getm", - "set_a_foreground", "setaf", - "set_a_background", "setab", - "pkey_plab", "pfxl", - "device_type", "devt", - "code_set_init", "csin", - "set0_des_seq", "s0ds", - "set1_des_seq", "s1ds", - "set2_des_seq", "s2ds", - "set3_des_seq", "s3ds", - "set_lr_margin", "smglr", - "set_tb_margin", "smgtb", - "bit_image_repeat", "birep", - "bit_image_newline", "binel", - "bit_image_carriage_return", "bicr", - "color_names", "colornm", - "define_bit_image_region", "defbi", - "end_bit_image_region", "endbi", - "set_color_band", "setcolor", - "set_page_length", "slines", - "display_pc_char", "dispc", - "enter_pc_charset_mode", "smpch", - "exit_pc_charset_mode", "rmpch", - "enter_scancode_mode", "smsc", - "exit_scancode_mode", "rmsc", - "pc_term_options", "pctrm", - "scancode_escape", "scesc", - "alt_scancode_esc", "scesa", - "enter_horizontal_hl_mode", "ehhlm", - "enter_left_hl_mode", "elhlm", - "enter_low_hl_mode", "elohlm", - "enter_right_hl_mode", "erhlm", - "enter_top_hl_mode", "ethlm", - "enter_vertical_hl_mode", "evhlm", - "set_a_attributes", "sgr1", - "set_pglen_inch", "slength", - "termcap_init2", "", - "termcap_reset", "", - "linefeed_if_not_lf", "", - "backspace_if_not_bs", "", - "other_non_function_keys", "", - "arrow_key_map", "", - "acs_ulcorner", "", - "acs_llcorner", "", - "acs_urcorner", "", - "acs_lrcorner", "", - "acs_ltee", "", - "acs_rtee", "", - "acs_btee", "", - "acs_ttee", "", - "acs_hline", "", - "acs_vline", "", - "acs_plus", "", - "memory_lock", "", - "memory_unlock", "", - "box_chars_1", "", -} diff --git a/vendor/github.com/Nvveen/Gotty/gotty.go b/vendor/github.com/Nvveen/Gotty/gotty.go deleted file mode 100644 index 093cbf37e1bc..000000000000 --- a/vendor/github.com/Nvveen/Gotty/gotty.go +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright 2012 Neal van Veen. All rights reserved. -// Usage of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Gotty is a Go-package for reading and parsing the terminfo database -package gotty - -// TODO add more concurrency to name lookup, look for more opportunities. - -import ( - "encoding/binary" - "errors" - "fmt" - "os" - "reflect" - "strings" - "sync" -) - -// Open a terminfo file by the name given and construct a TermInfo object. -// If something went wrong reading the terminfo database file, an error is -// returned. -func OpenTermInfo(termName string) (*TermInfo, error) { - var term *TermInfo - var err error - // Find the environment variables - termloc := os.Getenv("TERMINFO") - if len(termloc) == 0 { - // Search like ncurses - locations := []string{os.Getenv("HOME") + "/.terminfo/", "/etc/terminfo/", - "/lib/terminfo/", "/usr/share/terminfo/"} - var path string - for _, str := range locations { - // Construct path - path = str + string(termName[0]) + "/" + termName - // Check if path can be opened - file, _ := os.Open(path) - if file != nil { - // Path can open, fall out and use current path - file.Close() - break - } - } - if len(path) > 0 { - term, err = readTermInfo(path) - } else { - err = errors.New(fmt.Sprintf("No terminfo file(-location) found")) - } - } - return term, err -} - -// Open a terminfo file from the environment variable containing the current -// terminal name and construct a TermInfo object. If something went wrong -// reading the terminfo database file, an error is returned. -func OpenTermInfoEnv() (*TermInfo, error) { - termenv := os.Getenv("TERM") - return OpenTermInfo(termenv) -} - -// Return an attribute by the name attr provided. If none can be found, -// an error is returned. -func (term *TermInfo) GetAttribute(attr string) (stacker, error) { - // Channel to store the main value in. - var value stacker - // Add a blocking WaitGroup - var block sync.WaitGroup - // Keep track of variable being written. - written := false - // Function to put into goroutine. - f := func(ats interface{}) { - var ok bool - var v stacker - // Switch on type of map to use and assign value to it. - switch reflect.TypeOf(ats).Elem().Kind() { - case reflect.Bool: - v, ok = ats.(map[string]bool)[attr] - case reflect.Int16: - v, ok = ats.(map[string]int16)[attr] - case reflect.String: - v, ok = ats.(map[string]string)[attr] - } - // If ok, a value is found, so we can write. - if ok { - value = v - written = true - } - // Goroutine is done - block.Done() - } - block.Add(3) - // Go for all 3 attribute lists. - go f(term.boolAttributes) - go f(term.numAttributes) - go f(term.strAttributes) - // Wait until every goroutine is done. - block.Wait() - // If a value has been written, return it. - if written { - return value, nil - } - // Otherwise, error. - return nil, fmt.Errorf("Erorr finding attribute") -} - -// Return an attribute by the name attr provided. If none can be found, -// an error is returned. A name is first converted to its termcap value. -func (term *TermInfo) GetAttributeName(name string) (stacker, error) { - tc := GetTermcapName(name) - return term.GetAttribute(tc) -} - -// A utility function that finds and returns the termcap equivalent of a -// variable name. -func GetTermcapName(name string) string { - // Termcap name - var tc string - // Blocking group - var wait sync.WaitGroup - // Function to put into a goroutine - f := func(attrs []string) { - // Find the string corresponding to the name - for i, s := range attrs { - if s == name { - tc = attrs[i+1] - } - } - // Goroutine is finished - wait.Done() - } - wait.Add(3) - // Go for all 3 attribute lists - go f(BoolAttr[:]) - go f(NumAttr[:]) - go f(StrAttr[:]) - // Wait until every goroutine is done - wait.Wait() - // Return the termcap name - return tc -} - -// This function takes a path to a terminfo file and reads it in binary -// form to construct the actual TermInfo file. -func readTermInfo(path string) (*TermInfo, error) { - // Open the terminfo file - file, err := os.Open(path) - defer file.Close() - if err != nil { - return nil, err - } - - // magic, nameSize, boolSize, nrSNum, nrOffsetsStr, strSize - // Header is composed of the magic 0432 octal number, size of the name - // section, size of the boolean section, the amount of number values, - // the number of offsets of strings, and the size of the string section. - var header [6]int16 - // Byte array is used to read in byte values - var byteArray []byte - // Short array is used to read in short values - var shArray []int16 - // TermInfo object to store values - var term TermInfo - - // Read in the header - err = binary.Read(file, binary.LittleEndian, &header) - if err != nil { - return nil, err - } - // If magic number isn't there or isn't correct, we have the wrong filetype - if header[0] != 0432 { - return nil, errors.New(fmt.Sprintf("Wrong filetype")) - } - - // Read in the names - byteArray = make([]byte, header[1]) - err = binary.Read(file, binary.LittleEndian, &byteArray) - if err != nil { - return nil, err - } - term.Names = strings.Split(string(byteArray), "|") - - // Read in the booleans - byteArray = make([]byte, header[2]) - err = binary.Read(file, binary.LittleEndian, &byteArray) - if err != nil { - return nil, err - } - term.boolAttributes = make(map[string]bool) - for i, b := range byteArray { - if b == 1 { - term.boolAttributes[BoolAttr[i*2+1]] = true - } - } - // If the number of bytes read is not even, a byte for alignment is added - if len(byteArray)%2 != 0 { - err = binary.Read(file, binary.LittleEndian, make([]byte, 1)) - if err != nil { - return nil, err - } - } - - // Read in shorts - shArray = make([]int16, header[3]) - err = binary.Read(file, binary.LittleEndian, &shArray) - if err != nil { - return nil, err - } - term.numAttributes = make(map[string]int16) - for i, n := range shArray { - if n != 0377 && n > -1 { - term.numAttributes[NumAttr[i*2+1]] = n - } - } - - // Read the offsets into the short array - shArray = make([]int16, header[4]) - err = binary.Read(file, binary.LittleEndian, &shArray) - if err != nil { - return nil, err - } - // Read the actual strings in the byte array - byteArray = make([]byte, header[5]) - err = binary.Read(file, binary.LittleEndian, &byteArray) - if err != nil { - return nil, err - } - term.strAttributes = make(map[string]string) - // We get an offset, and then iterate until the string is null-terminated - for i, offset := range shArray { - if offset > -1 { - r := offset - for ; byteArray[r] != 0; r++ { - } - term.strAttributes[StrAttr[i*2+1]] = string(byteArray[offset:r]) - } - } - return &term, nil -} diff --git a/vendor/github.com/Nvveen/Gotty/parser.go b/vendor/github.com/Nvveen/Gotty/parser.go deleted file mode 100644 index a9d5d23c5425..000000000000 --- a/vendor/github.com/Nvveen/Gotty/parser.go +++ /dev/null @@ -1,362 +0,0 @@ -// Copyright 2012 Neal van Veen. All rights reserved. -// Usage of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package gotty - -import ( - "bytes" - "errors" - "fmt" - "regexp" - "strconv" - "strings" -) - -var exp = [...]string{ - "%%", - "%c", - "%s", - "%p(\\d)", - "%P([A-z])", - "%g([A-z])", - "%'(.)'", - "%{([0-9]+)}", - "%l", - "%\\+|%-|%\\*|%/|%m", - "%&|%\\||%\\^", - "%=|%>|%<", - "%A|%O", - "%!|%~", - "%i", - "%(:[\\ #\\-\\+]{0,4})?(\\d+\\.\\d+|\\d+)?[doxXs]", - "%\\?(.*?);", -} - -var regex *regexp.Regexp -var staticVar map[byte]stacker - -// Parses the attribute that is received with name attr and parameters params. -func (term *TermInfo) Parse(attr string, params ...interface{}) (string, error) { - // Get the attribute name first. - iface, err := term.GetAttribute(attr) - str, ok := iface.(string) - if err != nil { - return "", err - } - if !ok { - return str, errors.New("Only string capabilities can be parsed.") - } - // Construct the hidden parser struct so we can use a recursive stack based - // parser. - ps := &parser{} - // Dynamic variables only exist in this context. - ps.dynamicVar = make(map[byte]stacker, 26) - ps.parameters = make([]stacker, len(params)) - // Convert the parameters to insert them into the parser struct. - for i, x := range params { - ps.parameters[i] = x - } - // Recursively walk and return. - result, err := ps.walk(str) - return result, err -} - -// Parses the attribute that is received with name attr and parameters params. -// Only works on full name of a capability that is given, which it uses to -// search for the termcap name. -func (term *TermInfo) ParseName(attr string, params ...interface{}) (string, error) { - tc := GetTermcapName(attr) - return term.Parse(tc, params) -} - -// Identify each token in a stack based manner and do the actual parsing. -func (ps *parser) walk(attr string) (string, error) { - // We use a buffer to get the modified string. - var buf bytes.Buffer - // Next, find and identify all tokens by their indices and strings. - tokens := regex.FindAllStringSubmatch(attr, -1) - if len(tokens) == 0 { - return attr, nil - } - indices := regex.FindAllStringIndex(attr, -1) - q := 0 // q counts the matches of one token - // Iterate through the string per character. - for i := 0; i < len(attr); i++ { - // If the current position is an identified token, execute the following - // steps. - if q < len(indices) && i >= indices[q][0] && i < indices[q][1] { - // Switch on token. - switch { - case tokens[q][0][:2] == "%%": - // Literal percentage character. - buf.WriteByte('%') - case tokens[q][0][:2] == "%c": - // Pop a character. - c, err := ps.st.pop() - if err != nil { - return buf.String(), err - } - buf.WriteByte(c.(byte)) - case tokens[q][0][:2] == "%s": - // Pop a string. - str, err := ps.st.pop() - if err != nil { - return buf.String(), err - } - if _, ok := str.(string); !ok { - return buf.String(), errors.New("Stack head is not a string") - } - buf.WriteString(str.(string)) - case tokens[q][0][:2] == "%p": - // Push a parameter on the stack. - index, err := strconv.ParseInt(tokens[q][1], 10, 8) - index-- - if err != nil { - return buf.String(), err - } - if int(index) >= len(ps.parameters) { - return buf.String(), errors.New("Parameters index out of bound") - } - ps.st.push(ps.parameters[index]) - case tokens[q][0][:2] == "%P": - // Pop a variable from the stack as a dynamic or static variable. - val, err := ps.st.pop() - if err != nil { - return buf.String(), err - } - index := tokens[q][2] - if len(index) > 1 { - errorStr := fmt.Sprintf("%s is not a valid dynamic variables index", - index) - return buf.String(), errors.New(errorStr) - } - // Specify either dynamic or static. - if index[0] >= 'a' && index[0] <= 'z' { - ps.dynamicVar[index[0]] = val - } else if index[0] >= 'A' && index[0] <= 'Z' { - staticVar[index[0]] = val - } - case tokens[q][0][:2] == "%g": - // Push a variable from the stack as a dynamic or static variable. - index := tokens[q][3] - if len(index) > 1 { - errorStr := fmt.Sprintf("%s is not a valid static variables index", - index) - return buf.String(), errors.New(errorStr) - } - var val stacker - if index[0] >= 'a' && index[0] <= 'z' { - val = ps.dynamicVar[index[0]] - } else if index[0] >= 'A' && index[0] <= 'Z' { - val = staticVar[index[0]] - } - ps.st.push(val) - case tokens[q][0][:2] == "%'": - // Push a character constant. - con := tokens[q][4] - if len(con) > 1 { - errorStr := fmt.Sprintf("%s is not a valid character constant", con) - return buf.String(), errors.New(errorStr) - } - ps.st.push(con[0]) - case tokens[q][0][:2] == "%{": - // Push an integer constant. - con, err := strconv.ParseInt(tokens[q][5], 10, 32) - if err != nil { - return buf.String(), err - } - ps.st.push(con) - case tokens[q][0][:2] == "%l": - // Push the length of the string that is popped from the stack. - popStr, err := ps.st.pop() - if err != nil { - return buf.String(), err - } - if _, ok := popStr.(string); !ok { - errStr := fmt.Sprintf("Stack head is not a string") - return buf.String(), errors.New(errStr) - } - ps.st.push(len(popStr.(string))) - case tokens[q][0][:2] == "%?": - // If-then-else construct. First, the whole string is identified and - // then inside this substring, we can specify which parts to switch on. - ifReg, _ := regexp.Compile("%\\?(.*)%t(.*)%e(.*);|%\\?(.*)%t(.*);") - ifTokens := ifReg.FindStringSubmatch(tokens[q][0]) - var ( - ifStr string - err error - ) - // Parse the if-part to determine if-else. - if len(ifTokens[1]) > 0 { - ifStr, err = ps.walk(ifTokens[1]) - } else { // else - ifStr, err = ps.walk(ifTokens[4]) - } - // Return any errors - if err != nil { - return buf.String(), err - } else if len(ifStr) > 0 { - // Self-defined limitation, not sure if this is correct, but didn't - // seem like it. - return buf.String(), errors.New("If-clause cannot print statements") - } - var thenStr string - // Pop the first value that is set by parsing the if-clause. - choose, err := ps.st.pop() - if err != nil { - return buf.String(), err - } - // Switch to if or else. - if choose.(int) == 0 && len(ifTokens[1]) > 0 { - thenStr, err = ps.walk(ifTokens[3]) - } else if choose.(int) != 0 { - if len(ifTokens[1]) > 0 { - thenStr, err = ps.walk(ifTokens[2]) - } else { - thenStr, err = ps.walk(ifTokens[5]) - } - } - if err != nil { - return buf.String(), err - } - buf.WriteString(thenStr) - case tokens[q][0][len(tokens[q][0])-1] == 'd': // Fallthrough for printing - fallthrough - case tokens[q][0][len(tokens[q][0])-1] == 'o': // digits. - fallthrough - case tokens[q][0][len(tokens[q][0])-1] == 'x': - fallthrough - case tokens[q][0][len(tokens[q][0])-1] == 'X': - fallthrough - case tokens[q][0][len(tokens[q][0])-1] == 's': - token := tokens[q][0] - // Remove the : that comes before a flag. - if token[1] == ':' { - token = token[:1] + token[2:] - } - digit, err := ps.st.pop() - if err != nil { - return buf.String(), err - } - // The rest is determined like the normal formatted prints. - digitStr := fmt.Sprintf(token, digit.(int)) - buf.WriteString(digitStr) - case tokens[q][0][:2] == "%i": - // Increment the parameters by one. - if len(ps.parameters) < 2 { - return buf.String(), errors.New("Not enough parameters to increment.") - } - val1, val2 := ps.parameters[0].(int), ps.parameters[1].(int) - val1++ - val2++ - ps.parameters[0], ps.parameters[1] = val1, val2 - default: - // The rest of the tokens is a special case, where two values are - // popped and then operated on by the token that comes after them. - op1, err := ps.st.pop() - if err != nil { - return buf.String(), err - } - op2, err := ps.st.pop() - if err != nil { - return buf.String(), err - } - var result stacker - switch tokens[q][0][:2] { - case "%+": - // Addition - result = op2.(int) + op1.(int) - case "%-": - // Subtraction - result = op2.(int) - op1.(int) - case "%*": - // Multiplication - result = op2.(int) * op1.(int) - case "%/": - // Division - result = op2.(int) / op1.(int) - case "%m": - // Modulo - result = op2.(int) % op1.(int) - case "%&": - // Bitwise AND - result = op2.(int) & op1.(int) - case "%|": - // Bitwise OR - result = op2.(int) | op1.(int) - case "%^": - // Bitwise XOR - result = op2.(int) ^ op1.(int) - case "%=": - // Equals - result = op2 == op1 - case "%>": - // Greater-than - result = op2.(int) > op1.(int) - case "%<": - // Lesser-than - result = op2.(int) < op1.(int) - case "%A": - // Logical AND - result = op2.(bool) && op1.(bool) - case "%O": - // Logical OR - result = op2.(bool) || op1.(bool) - case "%!": - // Logical complement - result = !op1.(bool) - case "%~": - // Bitwise complement - result = ^(op1.(int)) - } - ps.st.push(result) - } - - i = indices[q][1] - 1 - q++ - } else { - // We are not "inside" a token, so just skip until the end or the next - // token, and add all characters to the buffer. - j := i - if q != len(indices) { - for !(j >= indices[q][0] && j < indices[q][1]) { - j++ - } - } else { - j = len(attr) - } - buf.WriteString(string(attr[i:j])) - i = j - } - } - // Return the buffer as a string. - return buf.String(), nil -} - -// Push a stacker-value onto the stack. -func (st *stack) push(s stacker) { - *st = append(*st, s) -} - -// Pop a stacker-value from the stack. -func (st *stack) pop() (stacker, error) { - if len(*st) == 0 { - return nil, errors.New("Stack is empty.") - } - newStack := make(stack, len(*st)-1) - val := (*st)[len(*st)-1] - copy(newStack, (*st)[:len(*st)-1]) - *st = newStack - return val, nil -} - -// Initialize regexes and the static vars (that don't get changed between -// calls. -func init() { - // Initialize the main regex. - expStr := strings.Join(exp[:], "|") - regex, _ = regexp.Compile(expStr) - // Initialize the static variables. - staticVar = make(map[byte]stacker, 26) -} diff --git a/vendor/github.com/Nvveen/Gotty/types.go b/vendor/github.com/Nvveen/Gotty/types.go deleted file mode 100644 index 9bcc65e9b889..000000000000 --- a/vendor/github.com/Nvveen/Gotty/types.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 Neal van Veen. All rights reserved. -// Usage of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package gotty - -type TermInfo struct { - boolAttributes map[string]bool - numAttributes map[string]int16 - strAttributes map[string]string - // The various names of the TermInfo file. - Names []string -} - -type stacker interface { -} -type stack []stacker - -type parser struct { - st stack - parameters []stacker - dynamicVar map[byte]stacker -} diff --git a/vendor/github.com/StackExchange/wmi/wmi.go b/vendor/github.com/StackExchange/wmi/wmi.go index 9c688b03841c..a951b1258b04 100644 --- a/vendor/github.com/StackExchange/wmi/wmi.go +++ b/vendor/github.com/StackExchange/wmi/wmi.go @@ -370,32 +370,50 @@ func (c *Client) loadEntity(dst interface{}, src *ole.IDispatch) (errFieldMismat } } default: - // Only support []string slices for now - if f.Kind() == reflect.Slice && f.Type().Elem().Kind() == reflect.String { - safeArray := prop.ToArray() - if safeArray != nil { - arr := safeArray.ToValueArray() - fArr := reflect.MakeSlice(f.Type(), len(arr), len(arr)) - for i, v := range arr { - s := fArr.Index(i) - s.SetString(v.(string)) + if f.Kind() == reflect.Slice { + switch f.Type().Elem().Kind() { + case reflect.String: + safeArray := prop.ToArray() + if safeArray != nil { + arr := safeArray.ToValueArray() + fArr := reflect.MakeSlice(f.Type(), len(arr), len(arr)) + for i, v := range arr { + s := fArr.Index(i) + s.SetString(v.(string)) + } + f.Set(fArr) + } + case reflect.Uint8: + safeArray := prop.ToArray() + if safeArray != nil { + arr := safeArray.ToValueArray() + fArr := reflect.MakeSlice(f.Type(), len(arr), len(arr)) + for i, v := range arr { + s := fArr.Index(i) + s.SetUint(reflect.ValueOf(v).Uint()) + } + f.Set(fArr) + } + default: + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: fmt.Sprintf("unsupported slice type (%T)", val), + } + } + } else { + typeof := reflect.TypeOf(val) + if typeof == nil && (isPtr || c.NonePtrZero) { + if (isPtr && c.PtrNil) || (!isPtr && c.NonePtrZero) { + of.Set(reflect.Zero(of.Type())) } - f.Set(fArr) break } - } - - typeof := reflect.TypeOf(val) - if typeof == nil && (isPtr || c.NonePtrZero) { - if (isPtr && c.PtrNil) || (!isPtr && c.NonePtrZero) { - of.Set(reflect.Zero(of.Type())) + return &ErrFieldMismatch{ + StructType: of.Type(), + FieldName: n, + Reason: fmt.Sprintf("unsupported type (%T)", val), } - break - } - return &ErrFieldMismatch{ - StructType: of.Type(), - FieldName: n, - Reason: fmt.Sprintf("unsupported type (%T)", val), } } } diff --git a/vendor/github.com/agext/levenshtein/.gitignore b/vendor/github.com/agext/levenshtein/.gitignore new file mode 100644 index 000000000000..404365f638fd --- /dev/null +++ b/vendor/github.com/agext/levenshtein/.gitignore @@ -0,0 +1,2 @@ +README.html +coverage.out diff --git a/vendor/github.com/agext/levenshtein/.travis.yml b/vendor/github.com/agext/levenshtein/.travis.yml new file mode 100644 index 000000000000..95be94af9f30 --- /dev/null +++ b/vendor/github.com/agext/levenshtein/.travis.yml @@ -0,0 +1,70 @@ +language: go +sudo: false +go: + - 1.8 + - 1.7.5 + - 1.7.4 + - 1.7.3 + - 1.7.2 + - 1.7.1 + - 1.7 + - tip + - 1.6.4 + - 1.6.3 + - 1.6.2 + - 1.6.1 + - 1.6 + - 1.5.4 + - 1.5.3 + - 1.5.2 + - 1.5.1 + - 1.5 + - 1.4.3 + - 1.4.2 + - 1.4.1 + - 1.4 + - 1.3.3 + - 1.3.2 + - 1.3.1 + - 1.3 + - 1.2.2 + - 1.2.1 + - 1.2 + - 1.1.2 + - 1.1.1 + - 1.1 +before_install: + - go get github.com/mattn/goveralls +script: + - $HOME/gopath/bin/goveralls -service=travis-ci +notifications: + email: + on_success: never +matrix: + fast_finish: true + allow_failures: + - go: tip + - go: 1.6.4 + - go: 1.6.3 + - go: 1.6.2 + - go: 1.6.1 + - go: 1.6 + - go: 1.5.4 + - go: 1.5.3 + - go: 1.5.2 + - go: 1.5.1 + - go: 1.5 + - go: 1.4.3 + - go: 1.4.2 + - go: 1.4.1 + - go: 1.4 + - go: 1.3.3 + - go: 1.3.2 + - go: 1.3.1 + - go: 1.3 + - go: 1.2.2 + - go: 1.2.1 + - go: 1.2 + - go: 1.1.2 + - go: 1.1.1 + - go: 1.1 diff --git a/vendor/github.com/apparentlymart/go-textseg/LICENSE b/vendor/github.com/apparentlymart/go-textseg/LICENSE deleted file mode 100644 index 684b03b4a27d..000000000000 --- a/vendor/github.com/apparentlymart/go-textseg/LICENSE +++ /dev/null @@ -1,95 +0,0 @@ -Copyright (c) 2017 Martin Atkins - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ---------- - -Unicode table generation programs are under a separate copyright and license: - -Copyright (c) 2014 Couchbase, Inc. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -except in compliance with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the -License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -either express or implied. See the License for the specific language governing permissions -and limitations under the License. - ---------- - -Grapheme break data is provided as part of the Unicode character database, -copright 2016 Unicode, Inc, which is provided with the following license: - -Unicode Data Files include all data files under the directories -http://www.unicode.org/Public/, http://www.unicode.org/reports/, -http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and -http://www.unicode.org/utility/trac/browser/. - -Unicode Data Files do not include PDF online code charts under the -directory http://www.unicode.org/Public/. - -Software includes any source code published in the Unicode Standard -or under the directories -http://www.unicode.org/Public/, http://www.unicode.org/reports/, -http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and -http://www.unicode.org/utility/trac/browser/. - -NOTICE TO USER: Carefully read the following legal agreement. -BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S -DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), -YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE -TERMS AND CONDITIONS OF THIS AGREEMENT. -IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE -THE DATA FILES OR SOFTWARE. - -COPYRIGHT AND PERMISSION NOTICE - -Copyright © 1991-2017 Unicode, Inc. All rights reserved. -Distributed under the Terms of Use in http://www.unicode.org/copyright.html. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Unicode data files and any associated documentation -(the "Data Files") or Unicode software and any associated documentation -(the "Software") to deal in the Data Files or Software -without restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, and/or sell copies of -the Data Files or Software, and to permit persons to whom the Data Files -or Software are furnished to do so, provided that either -(a) this copyright and permission notice appear with all copies -of the Data Files or Software, or -(b) this copyright and permission notice appear in associated -Documentation. - -THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF -ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT OF THIRD PARTY RIGHTS. -IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS -NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL -DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THE DATA FILES OR SOFTWARE. - -Except as contained in this notice, the name of a copyright holder -shall not be used in advertising or otherwise to promote the sale, -use or other dealings in these Data Files or Software without prior -written authorization of the copyright holder. diff --git a/vendor/github.com/apparentlymart/go-textseg/v12/textseg/make_tables.go b/vendor/github.com/apparentlymart/go-textseg/v12/textseg/make_tables.go deleted file mode 100644 index c7602dbaac38..000000000000 --- a/vendor/github.com/apparentlymart/go-textseg/v12/textseg/make_tables.go +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software distributed under the -// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -// either express or implied. See the License for the specific language governing permissions -// and limitations under the License. - -// Modified by Martin Atkins to serve the needs of package textseg. - -// +build ignore - -package main - -import ( - "bufio" - "flag" - "fmt" - "io" - "log" - "net/http" - "os" - "os/exec" - "sort" - "strconv" - "strings" - "unicode" -) - -var url = flag.String("url", - "http://www.unicode.org/Public/12.0.0/ucd/auxiliary/", - "URL of Unicode database directory") -var verbose = flag.Bool("verbose", - false, - "write data to stdout as it is parsed") -var localFiles = flag.Bool("local", - false, - "data files have been copied to the current directory; for debugging only") -var outputFile = flag.String("output", - "", - "output file for generated tables; default stdout") - -var output *bufio.Writer - -func main() { - flag.Parse() - setupOutput() - - graphemePropertyRanges := make(map[string]*unicode.RangeTable) - loadUnicodeData("GraphemeBreakProperty.txt", graphemePropertyRanges) - wordPropertyRanges := make(map[string]*unicode.RangeTable) - loadUnicodeData("WordBreakProperty.txt", wordPropertyRanges) - sentencePropertyRanges := make(map[string]*unicode.RangeTable) - loadUnicodeData("SentenceBreakProperty.txt", sentencePropertyRanges) - - fmt.Fprintf(output, fileHeader, *url) - generateTables("Grapheme", graphemePropertyRanges) - generateTables("Word", wordPropertyRanges) - generateTables("Sentence", sentencePropertyRanges) - - flushOutput() -} - -// WordBreakProperty.txt has the form: -// 05F0..05F2 ; Hebrew_Letter # Lo [3] HEBREW LIGATURE YIDDISH DOUBLE VAV..HEBREW LIGATURE YIDDISH DOUBLE YOD -// FB1D ; Hebrew_Letter # Lo HEBREW LETTER YOD WITH HIRIQ -func openReader(file string) (input io.ReadCloser) { - if *localFiles { - f, err := os.Open(file) - if err != nil { - log.Fatal(err) - } - input = f - } else { - path := *url + file - resp, err := http.Get(path) - if err != nil { - log.Fatal(err) - } - if resp.StatusCode != 200 { - log.Fatal("bad GET status for "+file, resp.Status) - } - input = resp.Body - } - return -} - -func loadUnicodeData(filename string, propertyRanges map[string]*unicode.RangeTable) { - f := openReader(filename) - defer f.Close() - bufioReader := bufio.NewReader(f) - line, err := bufioReader.ReadString('\n') - for err == nil { - parseLine(line, propertyRanges) - line, err = bufioReader.ReadString('\n') - } - // if the err was EOF still need to process last value - if err == io.EOF { - parseLine(line, propertyRanges) - } -} - -const comment = "#" -const sep = ";" -const rnge = ".." - -func parseLine(line string, propertyRanges map[string]*unicode.RangeTable) { - if strings.HasPrefix(line, comment) { - return - } - line = strings.TrimSpace(line) - if len(line) == 0 { - return - } - commentStart := strings.Index(line, comment) - if commentStart > 0 { - line = line[0:commentStart] - } - pieces := strings.Split(line, sep) - if len(pieces) != 2 { - log.Printf("unexpected %d pieces in %s", len(pieces), line) - return - } - - propertyName := strings.TrimSpace(pieces[1]) - - rangeTable, ok := propertyRanges[propertyName] - if !ok { - rangeTable = &unicode.RangeTable{ - LatinOffset: 0, - } - propertyRanges[propertyName] = rangeTable - } - - codepointRange := strings.TrimSpace(pieces[0]) - rngeIndex := strings.Index(codepointRange, rnge) - - if rngeIndex < 0 { - // single codepoint, not range - codepointInt, err := strconv.ParseUint(codepointRange, 16, 64) - if err != nil { - log.Printf("error parsing int: %v", err) - return - } - if codepointInt < 0x10000 { - r16 := unicode.Range16{ - Lo: uint16(codepointInt), - Hi: uint16(codepointInt), - Stride: 1, - } - addR16ToTable(rangeTable, r16) - } else { - r32 := unicode.Range32{ - Lo: uint32(codepointInt), - Hi: uint32(codepointInt), - Stride: 1, - } - addR32ToTable(rangeTable, r32) - } - } else { - rngeStart := codepointRange[0:rngeIndex] - rngeEnd := codepointRange[rngeIndex+2:] - rngeStartInt, err := strconv.ParseUint(rngeStart, 16, 64) - if err != nil { - log.Printf("error parsing int: %v", err) - return - } - rngeEndInt, err := strconv.ParseUint(rngeEnd, 16, 64) - if err != nil { - log.Printf("error parsing int: %v", err) - return - } - if rngeStartInt < 0x10000 && rngeEndInt < 0x10000 { - r16 := unicode.Range16{ - Lo: uint16(rngeStartInt), - Hi: uint16(rngeEndInt), - Stride: 1, - } - addR16ToTable(rangeTable, r16) - } else if rngeStartInt >= 0x10000 && rngeEndInt >= 0x10000 { - r32 := unicode.Range32{ - Lo: uint32(rngeStartInt), - Hi: uint32(rngeEndInt), - Stride: 1, - } - addR32ToTable(rangeTable, r32) - } else { - log.Printf("unexpected range") - } - } -} - -func addR16ToTable(r *unicode.RangeTable, r16 unicode.Range16) { - if r.R16 == nil { - r.R16 = make([]unicode.Range16, 0, 1) - } - r.R16 = append(r.R16, r16) - if r16.Hi <= unicode.MaxLatin1 { - r.LatinOffset++ - } -} - -func addR32ToTable(r *unicode.RangeTable, r32 unicode.Range32) { - if r.R32 == nil { - r.R32 = make([]unicode.Range32, 0, 1) - } - r.R32 = append(r.R32, r32) -} - -func generateTables(prefix string, propertyRanges map[string]*unicode.RangeTable) { - prNames := make([]string, 0, len(propertyRanges)) - for k := range propertyRanges { - prNames = append(prNames, k) - } - sort.Strings(prNames) - for _, key := range prNames { - rt := propertyRanges[key] - fmt.Fprintf(output, "var _%s%s = %s\n", prefix, key, generateRangeTable(rt)) - } - fmt.Fprintf(output, "type _%sRuneRange unicode.RangeTable\n", prefix) - - fmt.Fprintf(output, "func _%sRuneType(r rune) *_%sRuneRange {\n", prefix, prefix) - fmt.Fprintf(output, "\tswitch {\n") - for _, key := range prNames { - fmt.Fprintf(output, "\tcase unicode.Is(_%s%s, r):\n\t\treturn (*_%sRuneRange)(_%s%s)\n", prefix, key, prefix, prefix, key) - } - fmt.Fprintf(output, "\tdefault:\n\t\treturn nil\n") - fmt.Fprintf(output, "\t}\n") - fmt.Fprintf(output, "}\n") - - fmt.Fprintf(output, "func (rng *_%sRuneRange) String() string {\n", prefix) - fmt.Fprintf(output, "\tswitch (*unicode.RangeTable)(rng) {\n") - for _, key := range prNames { - fmt.Fprintf(output, "\tcase _%s%s:\n\t\treturn %q\n", prefix, key, key) - } - fmt.Fprintf(output, "\tdefault:\n\t\treturn \"Other\"\n") - fmt.Fprintf(output, "\t}\n") - fmt.Fprintf(output, "}\n") -} - -func generateRangeTable(rt *unicode.RangeTable) string { - rv := "&unicode.RangeTable{\n" - if rt.R16 != nil { - rv += "\tR16: []unicode.Range16{\n" - for _, r16 := range rt.R16 { - rv += fmt.Sprintf("\t\t%#v,\n", r16) - } - rv += "\t},\n" - } - if rt.R32 != nil { - rv += "\tR32: []unicode.Range32{\n" - for _, r32 := range rt.R32 { - rv += fmt.Sprintf("\t\t%#v,\n", r32) - } - rv += "\t},\n" - } - rv += fmt.Sprintf("\t\tLatinOffset: %d,\n", rt.LatinOffset) - rv += "}\n" - return rv -} - -const fileHeader = `// Generated by running -// maketables --url=%s -// DO NOT EDIT - -package textseg - -import( - "unicode" -) -` - -func setupOutput() { - output = bufio.NewWriter(startGofmt()) -} - -// startGofmt connects output to a gofmt process if -output is set. -func startGofmt() io.Writer { - if *outputFile == "" { - return os.Stdout - } - stdout, err := os.Create(*outputFile) - if err != nil { - log.Fatal(err) - } - // Pipe output to gofmt. - gofmt := exec.Command("gofmt") - fd, err := gofmt.StdinPipe() - if err != nil { - log.Fatal(err) - } - gofmt.Stdout = stdout - gofmt.Stderr = os.Stderr - err = gofmt.Start() - if err != nil { - log.Fatal(err) - } - return fd -} - -func flushOutput() { - err := output.Flush() - if err != nil { - log.Fatal(err) - } -} diff --git a/vendor/github.com/apparentlymart/go-textseg/v12/textseg/make_test_tables.go b/vendor/github.com/apparentlymart/go-textseg/v12/textseg/make_test_tables.go deleted file mode 100644 index fe038bdf1f63..000000000000 --- a/vendor/github.com/apparentlymart/go-textseg/v12/textseg/make_test_tables.go +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright (c) 2014 Couchbase, Inc. -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software distributed under the -// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, -// either express or implied. See the License for the specific language governing permissions -// and limitations under the License. - -// +build ignore - -package main - -import ( - "bufio" - "bytes" - "flag" - "fmt" - "io" - "log" - "net/http" - "os" - "os/exec" - "strconv" - "strings" -) - -var url = flag.String("url", - "http://www.unicode.org/Public/12.0.0/ucd/auxiliary/", - "URL of Unicode database directory") -var verbose = flag.Bool("verbose", - false, - "write data to stdout as it is parsed") -var localFiles = flag.Bool("local", - false, - "data files have been copied to the current directory; for debugging only") - -var outputFile = flag.String("output", - "", - "output file for generated tables; default stdout") - -var output *bufio.Writer - -func main() { - flag.Parse() - setupOutput() - - graphemeTests := make([]test, 0) - graphemeTests = loadUnicodeData("GraphemeBreakTest.txt", graphemeTests) - wordTests := make([]test, 0) - wordTests = loadUnicodeData("WordBreakTest.txt", wordTests) - sentenceTests := make([]test, 0) - sentenceTests = loadUnicodeData("SentenceBreakTest.txt", sentenceTests) - - fmt.Fprintf(output, fileHeader, *url) - generateTestTables("Grapheme", graphemeTests) - generateTestTables("Word", wordTests) - generateTestTables("Sentence", sentenceTests) - - flushOutput() -} - -// WordBreakProperty.txt has the form: -// 05F0..05F2 ; Hebrew_Letter # Lo [3] HEBREW LIGATURE YIDDISH DOUBLE VAV..HEBREW LIGATURE YIDDISH DOUBLE YOD -// FB1D ; Hebrew_Letter # Lo HEBREW LETTER YOD WITH HIRIQ -func openReader(file string) (input io.ReadCloser) { - if *localFiles { - f, err := os.Open(file) - if err != nil { - log.Fatal(err) - } - input = f - } else { - path := *url + file - resp, err := http.Get(path) - if err != nil { - log.Fatal(err) - } - if resp.StatusCode != 200 { - log.Fatal("bad GET status for "+file, resp.Status) - } - input = resp.Body - } - return -} - -func loadUnicodeData(filename string, tests []test) []test { - f := openReader(filename) - defer f.Close() - bufioReader := bufio.NewReader(f) - line, err := bufioReader.ReadString('\n') - for err == nil { - tests = parseLine(line, tests) - line, err = bufioReader.ReadString('\n') - } - // if the err was EOF still need to process last value - if err == io.EOF { - tests = parseLine(line, tests) - } - return tests -} - -const comment = "#" -const brk = "÷" -const nbrk = "×" - -type test [][]byte - -func parseLine(line string, tests []test) []test { - if strings.HasPrefix(line, comment) { - return tests - } - line = strings.TrimSpace(line) - if len(line) == 0 { - return tests - } - commentStart := strings.Index(line, comment) - if commentStart > 0 { - line = line[0:commentStart] - } - pieces := strings.Split(line, brk) - t := make(test, 0) - for _, piece := range pieces { - piece = strings.TrimSpace(piece) - if len(piece) > 0 { - codePoints := strings.Split(piece, nbrk) - word := "" - for _, codePoint := range codePoints { - codePoint = strings.TrimSpace(codePoint) - r, err := strconv.ParseInt(codePoint, 16, 64) - if err != nil { - log.Printf("err: %v for '%s'", err, string(r)) - return tests - } - - word += string(r) - } - t = append(t, []byte(word)) - } - } - tests = append(tests, t) - return tests -} - -func generateTestTables(prefix string, tests []test) { - fmt.Fprintf(output, testHeader, prefix) - for _, t := range tests { - fmt.Fprintf(output, "\t\t{\n") - fmt.Fprintf(output, "\t\t\tinput: %#v,\n", bytes.Join(t, []byte{})) - fmt.Fprintf(output, "\t\t\toutput: %s,\n", generateTest(t)) - fmt.Fprintf(output, "\t\t},\n") - } - fmt.Fprintf(output, "}\n") -} - -func generateTest(t test) string { - rv := "[][]byte{" - for _, te := range t { - rv += fmt.Sprintf("%#v,", te) - } - rv += "}" - return rv -} - -const fileHeader = `// Generated by running -// maketesttables --url=%s -// DO NOT EDIT - -package textseg -` - -const testHeader = `var unicode%sTests = []struct { - input []byte - output [][]byte - }{ -` - -func setupOutput() { - output = bufio.NewWriter(startGofmt()) -} - -// startGofmt connects output to a gofmt process if -output is set. -func startGofmt() io.Writer { - if *outputFile == "" { - return os.Stdout - } - stdout, err := os.Create(*outputFile) - if err != nil { - log.Fatal(err) - } - // Pipe output to gofmt. - gofmt := exec.Command("gofmt") - fd, err := gofmt.StdinPipe() - if err != nil { - log.Fatal(err) - } - gofmt.Stdout = stdout - gofmt.Stderr = os.Stderr - err = gofmt.Start() - if err != nil { - log.Fatal(err) - } - return fd -} - -func flushOutput() { - err := output.Flush() - if err != nil { - log.Fatal(err) - } -} diff --git a/vendor/github.com/appc/spec/LICENSE b/vendor/github.com/appc/spec/LICENSE deleted file mode 100644 index e06d2081865a..000000000000 --- a/vendor/github.com/appc/spec/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/vendor/github.com/appc/spec/schema/common/common.go b/vendor/github.com/appc/spec/schema/common/common.go deleted file mode 100644 index ffc0f6f9b4a3..000000000000 --- a/vendor/github.com/appc/spec/schema/common/common.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2015 The appc 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 common - -import ( - "fmt" - "net/url" - "strings" -) - -// MakeQueryString takes a comma-separated LABEL=VALUE string and returns an -// "&"-separated string with URL escaped values. -// -// Examples: -// version=1.0.0,label=v1+v2 -> version=1.0.0&label=v1%2Bv2 -// name=db,source=/tmp$1 -> name=db&source=%2Ftmp%241 -func MakeQueryString(app string) (string, error) { - parts := strings.Split(app, ",") - escapedParts := make([]string, len(parts)) - for i, s := range parts { - p := strings.SplitN(s, "=", 2) - if len(p) != 2 { - return "", fmt.Errorf("malformed string %q - has a label without a value: %s", app, p[0]) - } - escapedParts[i] = fmt.Sprintf("%s=%s", p[0], url.QueryEscape(p[1])) - } - return strings.Join(escapedParts, "&"), nil -} diff --git a/vendor/github.com/appc/spec/schema/doc.go b/vendor/github.com/appc/spec/schema/doc.go deleted file mode 100644 index ba381543f87f..000000000000 --- a/vendor/github.com/appc/spec/schema/doc.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The appc 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 schema provides definitions for the JSON schema of the different -// manifests in the App Container Specification. The manifests are canonically -// represented in their respective structs: -// - `ImageManifest` -// - `PodManifest` -// -// Validation is performed through serialization: if a blob of JSON data will -// unmarshal to one of the *Manifests, it is considered a valid implementation -// of the standard. Similarly, if a constructed *Manifest struct marshals -// successfully to JSON, it must be valid. -package schema diff --git a/vendor/github.com/appc/spec/schema/image.go b/vendor/github.com/appc/spec/schema/image.go deleted file mode 100644 index fac4c794c329..000000000000 --- a/vendor/github.com/appc/spec/schema/image.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2015 The appc 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 schema - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - - "github.com/appc/spec/schema/types" - - "go4.org/errorutil" -) - -const ( - ACIExtension = ".aci" - ImageManifestKind = types.ACKind("ImageManifest") -) - -type ImageManifest struct { - ACKind types.ACKind `json:"acKind"` - ACVersion types.SemVer `json:"acVersion"` - Name types.ACIdentifier `json:"name"` - Labels types.Labels `json:"labels,omitempty"` - App *types.App `json:"app,omitempty"` - Annotations types.Annotations `json:"annotations,omitempty"` - Dependencies types.Dependencies `json:"dependencies,omitempty"` - PathWhitelist []string `json:"pathWhitelist,omitempty"` -} - -// imageManifest is a model to facilitate extra validation during the -// unmarshalling of the ImageManifest -type imageManifest ImageManifest - -func BlankImageManifest() *ImageManifest { - return &ImageManifest{ACKind: ImageManifestKind, ACVersion: AppContainerVersion} -} - -func (im *ImageManifest) UnmarshalJSON(data []byte) error { - a := imageManifest(*im) - err := json.Unmarshal(data, &a) - if err != nil { - if serr, ok := err.(*json.SyntaxError); ok { - line, col, highlight := errorutil.HighlightBytePosition(bytes.NewReader(data), serr.Offset) - return fmt.Errorf("\nError at line %d, column %d\n%s%v", line, col, highlight, err) - } - return err - } - nim := ImageManifest(a) - if err := nim.assertValid(); err != nil { - return err - } - *im = nim - return nil -} - -func (im ImageManifest) MarshalJSON() ([]byte, error) { - if err := im.assertValid(); err != nil { - return nil, err - } - return json.Marshal(imageManifest(im)) -} - -var imKindError = types.InvalidACKindError(ImageManifestKind) - -// assertValid performs extra assertions on an ImageManifest to ensure that -// fields are set appropriately, etc. It is used exclusively when marshalling -// and unmarshalling an ImageManifest. Most field-specific validation is -// performed through the individual types being marshalled; assertValid() -// should only deal with higher-level validation. -func (im *ImageManifest) assertValid() error { - if im.ACKind != ImageManifestKind { - return imKindError - } - if im.ACVersion.Empty() { - return errors.New(`acVersion must be set`) - } - if im.Name.Empty() { - return errors.New(`name must be set`) - } - return nil -} - -func (im *ImageManifest) GetLabel(name string) (val string, ok bool) { - return im.Labels.Get(name) -} - -func (im *ImageManifest) GetAnnotation(name string) (val string, ok bool) { - return im.Annotations.Get(name) -} diff --git a/vendor/github.com/appc/spec/schema/kind.go b/vendor/github.com/appc/spec/schema/kind.go deleted file mode 100644 index 5dc4f957ecfa..000000000000 --- a/vendor/github.com/appc/spec/schema/kind.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015 The appc 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 schema - -import ( - "encoding/json" - - "github.com/appc/spec/schema/types" -) - -type Kind struct { - ACVersion types.SemVer `json:"acVersion"` - ACKind types.ACKind `json:"acKind"` -} - -type kind Kind - -func (k *Kind) UnmarshalJSON(data []byte) error { - nk := kind{} - err := json.Unmarshal(data, &nk) - if err != nil { - return err - } - *k = Kind(nk) - return nil -} - -func (k Kind) MarshalJSON() ([]byte, error) { - return json.Marshal(kind(k)) -} diff --git a/vendor/github.com/appc/spec/schema/pod.go b/vendor/github.com/appc/spec/schema/pod.go deleted file mode 100644 index a834e51bdd30..000000000000 --- a/vendor/github.com/appc/spec/schema/pod.go +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright 2015 The appc 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 schema - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - - "github.com/appc/spec/schema/types" - - "go4.org/errorutil" -) - -const PodManifestKind = types.ACKind("PodManifest") - -type PodManifest struct { - ACVersion types.SemVer `json:"acVersion"` - ACKind types.ACKind `json:"acKind"` - Apps AppList `json:"apps"` - Volumes []types.Volume `json:"volumes"` - Isolators []types.Isolator `json:"isolators"` - Annotations types.Annotations `json:"annotations"` - Ports []types.ExposedPort `json:"ports"` - UserAnnotations types.UserAnnotations `json:"userAnnotations,omitempty"` - UserLabels types.UserLabels `json:"userLabels,omitempty"` -} - -// podManifest is a model to facilitate extra validation during the -// unmarshalling of the PodManifest -type podManifest PodManifest - -func BlankPodManifest() *PodManifest { - return &PodManifest{ACKind: PodManifestKind, ACVersion: AppContainerVersion} -} - -func (pm *PodManifest) UnmarshalJSON(data []byte) error { - p := podManifest(*pm) - err := json.Unmarshal(data, &p) - if err != nil { - if serr, ok := err.(*json.SyntaxError); ok { - line, col, highlight := errorutil.HighlightBytePosition(bytes.NewReader(data), serr.Offset) - return fmt.Errorf("\nError at line %d, column %d\n%s%v", line, col, highlight, err) - } - return err - } - npm := PodManifest(p) - if err := npm.assertValid(); err != nil { - return err - } - *pm = npm - return nil -} - -func (pm PodManifest) MarshalJSON() ([]byte, error) { - if err := pm.assertValid(); err != nil { - return nil, err - } - return json.Marshal(podManifest(pm)) -} - -var pmKindError = types.InvalidACKindError(PodManifestKind) - -// assertValid performs extra assertions on an PodManifest to -// ensure that fields are set appropriately, etc. It is used exclusively when -// marshalling and unmarshalling an PodManifest. Most -// field-specific validation is performed through the individual types being -// marshalled; assertValid() should only deal with higher-level validation. -func (pm *PodManifest) assertValid() error { - if pm.ACKind != PodManifestKind { - return pmKindError - } - - // ensure volumes names are unique (unique key) - volNames := make(map[types.ACName]bool, len(pm.Volumes)) - for _, vol := range pm.Volumes { - if volNames[vol.Name] { - return fmt.Errorf("duplicate volume name %q", vol.Name) - } - volNames[vol.Name] = true - } - return nil -} - -type AppList []RuntimeApp - -type appList AppList - -func (al *AppList) UnmarshalJSON(data []byte) error { - a := appList{} - err := json.Unmarshal(data, &a) - if err != nil { - return err - } - nal := AppList(a) - if err := nal.assertValid(); err != nil { - return err - } - *al = nal - return nil -} - -func (al AppList) MarshalJSON() ([]byte, error) { - if err := al.assertValid(); err != nil { - return nil, err - } - return json.Marshal(appList(al)) -} - -func (al AppList) assertValid() error { - seen := map[types.ACName]bool{} - for _, a := range al { - if _, ok := seen[a.Name]; ok { - return fmt.Errorf(`duplicate apps of name %q`, a.Name) - } - seen[a.Name] = true - } - return nil -} - -// Get retrieves an app by the specified name from the AppList; if there is -// no such app, nil is returned. The returned *RuntimeApp MUST be considered -// read-only. -func (al AppList) Get(name types.ACName) *RuntimeApp { - for _, a := range al { - if name.Equals(a.Name) { - aa := a - return &aa - } - } - return nil -} - -// Mount describes the mapping between a volume and the path it is mounted -// inside of an app's filesystem. -// The AppVolume is optional. If missing, the pod-level Volume of the -// same name shall be used. -type Mount struct { - Volume types.ACName `json:"volume"` - Path string `json:"path"` - AppVolume *types.Volume `json:"appVolume,omitempty"` -} - -func (r Mount) assertValid() error { - if r.Volume.Empty() { - return errors.New("volume must be set") - } - if r.Path == "" { - return errors.New("path must be set") - } - return nil -} - -// RuntimeApp describes an application referenced in a PodManifest -type RuntimeApp struct { - Name types.ACName `json:"name"` - Image RuntimeImage `json:"image"` - App *types.App `json:"app,omitempty"` - ReadOnlyRootFS bool `json:"readOnlyRootFS,omitempty"` - Mounts []Mount `json:"mounts,omitempty"` - Annotations types.Annotations `json:"annotations,omitempty"` -} - -// RuntimeImage describes an image referenced in a RuntimeApp -type RuntimeImage struct { - Name *types.ACIdentifier `json:"name,omitempty"` - ID types.Hash `json:"id"` - Labels types.Labels `json:"labels,omitempty"` -} diff --git a/vendor/github.com/appc/spec/schema/types/acidentifier.go b/vendor/github.com/appc/spec/schema/types/acidentifier.go deleted file mode 100644 index 904eda5cbc36..000000000000 --- a/vendor/github.com/appc/spec/schema/types/acidentifier.go +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "errors" - "regexp" - "strings" -) - -var ( - // ValidACIdentifier is a regular expression that defines a valid ACIdentifier - ValidACIdentifier = regexp.MustCompile("^[a-z0-9]+([-._~/][a-z0-9]+)*$") - - invalidACIdentifierChars = regexp.MustCompile("[^a-z0-9-._~/]") - invalidACIdentifierEdges = regexp.MustCompile("(^[-._~/]+)|([-._~/]+$)") - - ErrEmptyACIdentifier = ACIdentifierError("ACIdentifier cannot be empty") - ErrInvalidEdgeInACIdentifier = ACIdentifierError("ACIdentifier must start and end with only lower case " + - "alphanumeric characters") - ErrInvalidCharInACIdentifier = ACIdentifierError("ACIdentifier must contain only lower case " + - `alphanumeric characters plus "-._~/"`) -) - -// ACIdentifier (an App-Container Identifier) is a format used by keys in image names -// and image labels of the App Container Standard. An ACIdentifier is restricted to numeric -// and lowercase URI unreserved characters defined in URI RFC[1]; all alphabetical characters -// must be lowercase only. Furthermore, the first and last character ("edges") must be -// alphanumeric, and an ACIdentifier cannot be empty. Programmatically, an ACIdentifier must -// conform to the regular expression ValidACIdentifier. -// -// [1] http://tools.ietf.org/html/rfc3986#section-2.3 -type ACIdentifier string - -func (n ACIdentifier) String() string { - return string(n) -} - -// Set sets the ACIdentifier to the given value, if it is valid; if not, -// an error is returned. -func (n *ACIdentifier) Set(s string) error { - nn, err := NewACIdentifier(s) - if err == nil { - *n = *nn - } - return err -} - -// Equals checks whether a given ACIdentifier is equal to this one. -func (n ACIdentifier) Equals(o ACIdentifier) bool { - return strings.ToLower(string(n)) == strings.ToLower(string(o)) -} - -// Empty returns a boolean indicating whether this ACIdentifier is empty. -func (n ACIdentifier) Empty() bool { - return n.String() == "" -} - -// NewACIdentifier generates a new ACIdentifier from a string. If the given string is -// not a valid ACIdentifier, nil and an error are returned. -func NewACIdentifier(s string) (*ACIdentifier, error) { - n := ACIdentifier(s) - if err := n.assertValid(); err != nil { - return nil, err - } - return &n, nil -} - -// MustACIdentifier generates a new ACIdentifier from a string, If the given string is -// not a valid ACIdentifier, it panics. -func MustACIdentifier(s string) *ACIdentifier { - n, err := NewACIdentifier(s) - if err != nil { - panic(err) - } - return n -} - -func (n ACIdentifier) assertValid() error { - s := string(n) - if len(s) == 0 { - return ErrEmptyACIdentifier - } - if invalidACIdentifierChars.MatchString(s) { - return ErrInvalidCharInACIdentifier - } - if invalidACIdentifierEdges.MatchString(s) { - return ErrInvalidEdgeInACIdentifier - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaler interface -func (n *ACIdentifier) UnmarshalJSON(data []byte) error { - var s string - if err := json.Unmarshal(data, &s); err != nil { - return err - } - nn, err := NewACIdentifier(s) - if err != nil { - return err - } - *n = *nn - return nil -} - -// MarshalJSON implements the json.Marshaler interface -func (n ACIdentifier) MarshalJSON() ([]byte, error) { - if err := n.assertValid(); err != nil { - return nil, err - } - return json.Marshal(n.String()) -} - -// SanitizeACIdentifier replaces every invalid ACIdentifier character in s with an underscore -// making it a legal ACIdentifier string. If the character is an upper case letter it -// replaces it with its lower case. It also removes illegal edge characters -// (hyphens, period, underscore, tilde and slash). -// -// This is a helper function and its algorithm is not part of the spec. It -// should not be called without the user explicitly asking for a suggestion. -func SanitizeACIdentifier(s string) (string, error) { - s = strings.ToLower(s) - s = invalidACIdentifierChars.ReplaceAllString(s, "_") - s = invalidACIdentifierEdges.ReplaceAllString(s, "") - - if s == "" { - return "", errors.New("must contain at least one valid character") - } - - return s, nil -} diff --git a/vendor/github.com/appc/spec/schema/types/ackind.go b/vendor/github.com/appc/spec/schema/types/ackind.go deleted file mode 100644 index 1793ca8de8e9..000000000000 --- a/vendor/github.com/appc/spec/schema/types/ackind.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "fmt" -) - -var ( - ErrNoACKind = ACKindError("ACKind must be set") -) - -// ACKind wraps a string to define a field which must be set with one of -// several ACKind values. If it is unset, or has an invalid value, the field -// will refuse to marshal/unmarshal. -type ACKind string - -func (a ACKind) String() string { - return string(a) -} - -func (a ACKind) assertValid() error { - s := a.String() - switch s { - case "ImageManifest", "PodManifest": - return nil - case "": - return ErrNoACKind - default: - msg := fmt.Sprintf("bad ACKind: %s", s) - return ACKindError(msg) - } -} - -func (a ACKind) MarshalJSON() ([]byte, error) { - if err := a.assertValid(); err != nil { - return nil, err - } - return json.Marshal(a.String()) -} - -func (a *ACKind) UnmarshalJSON(data []byte) error { - var s string - err := json.Unmarshal(data, &s) - if err != nil { - return err - } - na := ACKind(s) - if err := na.assertValid(); err != nil { - return err - } - *a = na - return nil -} diff --git a/vendor/github.com/appc/spec/schema/types/acname.go b/vendor/github.com/appc/spec/schema/types/acname.go deleted file mode 100644 index 5ececffb7f2d..000000000000 --- a/vendor/github.com/appc/spec/schema/types/acname.go +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "errors" - "regexp" - "strings" -) - -var ( - // ValidACName is a regular expression that defines a valid ACName - ValidACName = regexp.MustCompile("^[a-z0-9]+([-][a-z0-9]+)*$") - - invalidACNameChars = regexp.MustCompile("[^a-z0-9-]") - invalidACNameEdges = regexp.MustCompile("(^[-]+)|([-]+$)") - - ErrEmptyACName = ACNameError("ACName cannot be empty") - ErrInvalidEdgeInACName = ACNameError("ACName must start and end with only lower case " + - "alphanumeric characters") - ErrInvalidCharInACName = ACNameError("ACName must contain only lower case " + - `alphanumeric characters plus "-"`) -) - -// ACName (an App-Container Name) is a format used by keys in different formats -// of the App Container Standard. An ACName is restricted to numeric and lowercase -// characters accepted by the DNS RFC[1] plus "-"; all alphabetical characters must -// be lowercase only. Furthermore, the first and last character ("edges") must be -// alphanumeric, and an ACName cannot be empty. Programmatically, an ACName must -// conform to the regular expression ValidACName. -// -// [1] http://tools.ietf.org/html/rfc1123#page-13 -type ACName string - -func (n ACName) String() string { - return string(n) -} - -// Set sets the ACName to the given value, if it is valid; if not, -// an error is returned. -func (n *ACName) Set(s string) error { - nn, err := NewACName(s) - if err == nil { - *n = *nn - } - return err -} - -// Equals checks whether a given ACName is equal to this one. -func (n ACName) Equals(o ACName) bool { - return strings.ToLower(string(n)) == strings.ToLower(string(o)) -} - -// Empty returns a boolean indicating whether this ACName is empty. -func (n ACName) Empty() bool { - return n.String() == "" -} - -// NewACName generates a new ACName from a string. If the given string is -// not a valid ACName, nil and an error are returned. -func NewACName(s string) (*ACName, error) { - n := ACName(s) - if err := n.assertValid(); err != nil { - return nil, err - } - return &n, nil -} - -// MustACName generates a new ACName from a string, If the given string is -// not a valid ACName, it panics. -func MustACName(s string) *ACName { - n, err := NewACName(s) - if err != nil { - panic(err) - } - return n -} - -func (n ACName) assertValid() error { - s := string(n) - if len(s) == 0 { - return ErrEmptyACName - } - if invalidACNameChars.MatchString(s) { - return ErrInvalidCharInACName - } - if invalidACNameEdges.MatchString(s) { - return ErrInvalidEdgeInACName - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaler interface -func (n *ACName) UnmarshalJSON(data []byte) error { - var s string - if err := json.Unmarshal(data, &s); err != nil { - return err - } - nn, err := NewACName(s) - if err != nil { - return err - } - *n = *nn - return nil -} - -// MarshalJSON implements the json.Marshaler interface -func (n ACName) MarshalJSON() ([]byte, error) { - if err := n.assertValid(); err != nil { - return nil, err - } - return json.Marshal(n.String()) -} - -// SanitizeACName replaces every invalid ACName character in s with a dash -// making it a legal ACName string. If the character is an upper case letter it -// replaces it with its lower case. It also removes illegal edge characters -// (hyphens). -// -// This is a helper function and its algorithm is not part of the spec. It -// should not be called without the user explicitly asking for a suggestion. -func SanitizeACName(s string) (string, error) { - s = strings.ToLower(s) - s = invalidACNameChars.ReplaceAllString(s, "-") - s = invalidACNameEdges.ReplaceAllString(s, "") - - if s == "" { - return "", errors.New("must contain at least one valid character") - } - - return s, nil -} diff --git a/vendor/github.com/appc/spec/schema/types/annotations.go b/vendor/github.com/appc/spec/schema/types/annotations.go deleted file mode 100644 index ce7743bf53ff..000000000000 --- a/vendor/github.com/appc/spec/schema/types/annotations.go +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "fmt" -) - -type Annotations []Annotation - -type annotations Annotations - -type Annotation struct { - Name ACIdentifier `json:"name"` - Value string `json:"value"` -} - -func (a Annotations) assertValid() error { - seen := map[ACIdentifier]string{} - for _, anno := range a { - _, ok := seen[anno.Name] - if ok { - return fmt.Errorf(`duplicate annotations of name %q`, anno.Name) - } - seen[anno.Name] = anno.Value - } - if c, ok := seen["created"]; ok { - if _, err := NewDate(c); err != nil { - return err - } - } - if h, ok := seen["homepage"]; ok { - if _, err := NewURL(h); err != nil { - return err - } - } - if d, ok := seen["documentation"]; ok { - if _, err := NewURL(d); err != nil { - return err - } - } - - return nil -} - -func (a Annotations) MarshalJSON() ([]byte, error) { - if err := a.assertValid(); err != nil { - return nil, err - } - return json.Marshal(annotations(a)) -} - -func (a *Annotations) UnmarshalJSON(data []byte) error { - var ja annotations - if err := json.Unmarshal(data, &ja); err != nil { - return err - } - na := Annotations(ja) - if err := na.assertValid(); err != nil { - return err - } - *a = na - return nil -} - -// Retrieve the value of an annotation by the given name from Annotations, if -// it exists. -func (a Annotations) Get(name string) (val string, ok bool) { - for _, anno := range a { - if anno.Name.String() == name { - return anno.Value, true - } - } - return "", false -} - -// Set sets the value of an annotation by the given name, overwriting if one already exists. -func (a *Annotations) Set(name ACIdentifier, value string) { - for i, anno := range *a { - if anno.Name.Equals(name) { - (*a)[i] = Annotation{ - Name: name, - Value: value, - } - return - } - } - anno := Annotation{ - Name: name, - Value: value, - } - *a = append(*a, anno) -} diff --git a/vendor/github.com/appc/spec/schema/types/app.go b/vendor/github.com/appc/spec/schema/types/app.go deleted file mode 100644 index 0ef68c892f85..000000000000 --- a/vendor/github.com/appc/spec/schema/types/app.go +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "errors" - "fmt" - "path" -) - -type App struct { - Exec Exec `json:"exec"` - EventHandlers []EventHandler `json:"eventHandlers,omitempty"` - User string `json:"user"` - Group string `json:"group"` - SupplementaryGIDs []int `json:"supplementaryGIDs,omitempty"` - WorkingDirectory string `json:"workingDirectory,omitempty"` - Environment Environment `json:"environment,omitempty"` - MountPoints []MountPoint `json:"mountPoints,omitempty"` - Ports []Port `json:"ports,omitempty"` - Isolators Isolators `json:"isolators,omitempty"` - UserAnnotations UserAnnotations `json:"userAnnotations,omitempty"` - UserLabels UserLabels `json:"userLabels,omitempty"` -} - -// app is a model to facilitate extra validation during the -// unmarshalling of the App -type app App - -func (a *App) UnmarshalJSON(data []byte) error { - ja := app(*a) - err := json.Unmarshal(data, &ja) - if err != nil { - return err - } - na := App(ja) - if err := na.assertValid(); err != nil { - return err - } - if na.Environment == nil { - na.Environment = make(Environment, 0) - } - *a = na - return nil -} - -func (a App) MarshalJSON() ([]byte, error) { - if err := a.assertValid(); err != nil { - return nil, err - } - return json.Marshal(app(a)) -} - -func (a *App) assertValid() error { - if err := a.Exec.assertValid(); err != nil { - return err - } - if a.User == "" { - return errors.New(`user is required`) - } - if a.Group == "" { - return errors.New(`group is required`) - } - if !path.IsAbs(a.WorkingDirectory) && a.WorkingDirectory != "" { - return errors.New("workingDirectory must be an absolute path") - } - eh := make(map[string]bool) - for _, e := range a.EventHandlers { - name := e.Name - if eh[name] { - return fmt.Errorf("Only one eventHandler of name %q allowed", name) - } - eh[name] = true - } - if err := a.Environment.assertValid(); err != nil { - return err - } - if err := a.Isolators.assertValid(); err != nil { - return err - } - return nil -} diff --git a/vendor/github.com/appc/spec/schema/types/date.go b/vendor/github.com/appc/spec/schema/types/date.go deleted file mode 100644 index 4458bf45d94d..000000000000 --- a/vendor/github.com/appc/spec/schema/types/date.go +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "fmt" - "time" -) - -// Date wraps time.Time to marshal/unmarshal to/from JSON strings in strict -// accordance with RFC3339 -// TODO(jonboulle): golang's implementation seems slightly buggy here; -// according to http://tools.ietf.org/html/rfc3339#section-5.6 , applications -// may choose to separate the date and time with a space instead of a T -// character (for example, `date --rfc-3339` on GNU coreutils) - but this is -// considered an error by go's parser. File a bug? -type Date time.Time - -func NewDate(s string) (*Date, error) { - t, err := time.Parse(time.RFC3339, s) - if err != nil { - return nil, fmt.Errorf("bad Date: %v", err) - } - d := Date(t) - return &d, nil -} - -func (d Date) String() string { - return time.Time(d).Format(time.RFC3339) -} - -func (d *Date) UnmarshalJSON(data []byte) error { - var s string - if err := json.Unmarshal(data, &s); err != nil { - return err - } - nd, err := NewDate(s) - if err != nil { - return err - } - *d = *nd - return nil -} - -func (d Date) MarshalJSON() ([]byte, error) { - return json.Marshal(d.String()) -} diff --git a/vendor/github.com/appc/spec/schema/types/dependencies.go b/vendor/github.com/appc/spec/schema/types/dependencies.go deleted file mode 100644 index fb399e4041f2..000000000000 --- a/vendor/github.com/appc/spec/schema/types/dependencies.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "errors" -) - -type Dependencies []Dependency - -type Dependency struct { - ImageName ACIdentifier `json:"imageName"` - ImageID *Hash `json:"imageID,omitempty"` - Labels Labels `json:"labels,omitempty"` - Size uint `json:"size,omitempty"` -} - -type dependency Dependency - -func (d Dependency) assertValid() error { - if len(d.ImageName) < 1 { - return errors.New(`imageName cannot be empty`) - } - return nil -} - -func (d Dependency) MarshalJSON() ([]byte, error) { - if err := d.assertValid(); err != nil { - return nil, err - } - return json.Marshal(dependency(d)) -} - -func (d *Dependency) UnmarshalJSON(data []byte) error { - var jd dependency - if err := json.Unmarshal(data, &jd); err != nil { - return err - } - nd := Dependency(jd) - if err := nd.assertValid(); err != nil { - return err - } - *d = nd - return nil -} diff --git a/vendor/github.com/appc/spec/schema/types/doc.go b/vendor/github.com/appc/spec/schema/types/doc.go deleted file mode 100644 index 9c540851b05a..000000000000 --- a/vendor/github.com/appc/spec/schema/types/doc.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The appc 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 types contains structs representing the various types in the app -// container specification. It is used by the [schema manifest types](../) -// to enforce validation. -package types diff --git a/vendor/github.com/appc/spec/schema/types/environment.go b/vendor/github.com/appc/spec/schema/types/environment.go deleted file mode 100644 index 3e7b18fade7a..000000000000 --- a/vendor/github.com/appc/spec/schema/types/environment.go +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "fmt" - "regexp" -) - -var ( - envPattern = regexp.MustCompile("^[A-Za-z_][A-Za-z_0-9.-]*$") -) - -type Environment []EnvironmentVariable - -type environment Environment - -type EnvironmentVariable struct { - Name string `json:"name"` - Value string `json:"value"` -} - -func (ev EnvironmentVariable) assertValid() error { - if len(ev.Name) == 0 { - return fmt.Errorf(`environment variable name must not be empty`) - } - if !envPattern.MatchString(ev.Name) { - return fmt.Errorf(`environment variable does not have valid identifier %q`, ev.Name) - } - return nil -} - -func (e Environment) assertValid() error { - seen := map[string]bool{} - for _, env := range e { - if err := env.assertValid(); err != nil { - return err - } - _, ok := seen[env.Name] - if ok { - return fmt.Errorf(`duplicate environment variable of name %q`, env.Name) - } - seen[env.Name] = true - } - - return nil -} - -func (e Environment) MarshalJSON() ([]byte, error) { - if err := e.assertValid(); err != nil { - return nil, err - } - return json.Marshal(environment(e)) -} - -func (e *Environment) UnmarshalJSON(data []byte) error { - var je environment - if err := json.Unmarshal(data, &je); err != nil { - return err - } - ne := Environment(je) - if err := ne.assertValid(); err != nil { - return err - } - *e = ne - return nil -} - -// Retrieve the value of an environment variable by the given name from -// Environment, if it exists. -func (e Environment) Get(name string) (value string, ok bool) { - for _, env := range e { - if env.Name == name { - return env.Value, true - } - } - return "", false -} - -// Set sets the value of an environment variable by the given name, -// overwriting if one already exists. -func (e *Environment) Set(name string, value string) { - for i, env := range *e { - if env.Name == name { - (*e)[i] = EnvironmentVariable{ - Name: name, - Value: value, - } - return - } - } - env := EnvironmentVariable{ - Name: name, - Value: value, - } - *e = append(*e, env) -} diff --git a/vendor/github.com/appc/spec/schema/types/errors.go b/vendor/github.com/appc/spec/schema/types/errors.go deleted file mode 100644 index bb46515944b9..000000000000 --- a/vendor/github.com/appc/spec/schema/types/errors.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015 The appc 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 types - -import "fmt" - -// An ACKindError is returned when the wrong ACKind is set in a manifest -type ACKindError string - -func (e ACKindError) Error() string { - return string(e) -} - -func InvalidACKindError(kind ACKind) ACKindError { - return ACKindError(fmt.Sprintf("missing or bad ACKind (must be %#v)", kind)) -} - -// An ACVersionError is returned when a bad ACVersion is set in a manifest -type ACVersionError string - -func (e ACVersionError) Error() string { - return string(e) -} - -// An ACIdentifierError is returned when a bad value is used for an ACIdentifier -type ACIdentifierError string - -func (e ACIdentifierError) Error() string { - return string(e) -} - -// An ACNameError is returned when a bad value is used for an ACName -type ACNameError string - -func (e ACNameError) Error() string { - return string(e) -} diff --git a/vendor/github.com/appc/spec/schema/types/event_handler.go b/vendor/github.com/appc/spec/schema/types/event_handler.go deleted file mode 100644 index f40c642be40b..000000000000 --- a/vendor/github.com/appc/spec/schema/types/event_handler.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "errors" - "fmt" -) - -type EventHandler struct { - Name string `json:"name"` - Exec Exec `json:"exec"` -} - -type eventHandler EventHandler - -func (e EventHandler) assertValid() error { - s := e.Name - switch s { - case "pre-start", "post-stop": - return nil - case "": - return errors.New(`eventHandler "name" cannot be empty`) - default: - return fmt.Errorf(`bad eventHandler "name": %q`, s) - } -} - -func (e EventHandler) MarshalJSON() ([]byte, error) { - if err := e.assertValid(); err != nil { - return nil, err - } - return json.Marshal(eventHandler(e)) -} - -func (e *EventHandler) UnmarshalJSON(data []byte) error { - var je eventHandler - err := json.Unmarshal(data, &je) - if err != nil { - return err - } - ne := EventHandler(je) - if err := ne.assertValid(); err != nil { - return err - } - *e = ne - return nil -} diff --git a/vendor/github.com/appc/spec/schema/types/exec.go b/vendor/github.com/appc/spec/schema/types/exec.go deleted file mode 100644 index fa8b156cfb08..000000000000 --- a/vendor/github.com/appc/spec/schema/types/exec.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015 The appc 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 types - -import "encoding/json" - -type Exec []string - -type exec Exec - -func (e Exec) assertValid() error { - return nil -} - -func (e Exec) MarshalJSON() ([]byte, error) { - if err := e.assertValid(); err != nil { - return nil, err - } - return json.Marshal(exec(e)) -} - -func (e *Exec) UnmarshalJSON(data []byte) error { - var je exec - err := json.Unmarshal(data, &je) - if err != nil { - return err - } - ne := Exec(je) - if err := ne.assertValid(); err != nil { - return err - } - *e = ne - return nil -} diff --git a/vendor/github.com/appc/spec/schema/types/hash.go b/vendor/github.com/appc/spec/schema/types/hash.go deleted file mode 100644 index 1c060a47a0a1..000000000000 --- a/vendor/github.com/appc/spec/schema/types/hash.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "crypto/sha512" - "encoding/json" - "errors" - "fmt" - "reflect" - "strings" -) - -const ( - maxHashSize = (sha512.Size / 2) + len("sha512-") -) - -// Hash encodes a hash specified in a string of the form: -// "-" -// for example -// "sha512-06c733b1838136838e6d2d3e8fa5aea4c7905e92[...]" -// Valid types are currently: -// * sha512 -type Hash struct { - typ string - Val string -} - -func NewHash(s string) (*Hash, error) { - elems := strings.Split(s, "-") - if len(elems) != 2 { - return nil, errors.New("badly formatted hash string") - } - nh := Hash{ - typ: elems[0], - Val: elems[1], - } - if err := nh.assertValid(); err != nil { - return nil, err - } - return &nh, nil -} - -func (h Hash) String() string { - return fmt.Sprintf("%s-%s", h.typ, h.Val) -} - -func (h *Hash) Set(s string) error { - nh, err := NewHash(s) - if err == nil { - *h = *nh - } - return err -} - -func (h Hash) Empty() bool { - return reflect.DeepEqual(h, Hash{}) -} - -func (h Hash) assertValid() error { - switch h.typ { - case "sha512": - case "": - return fmt.Errorf("unexpected empty hash type") - default: - return fmt.Errorf("unrecognized hash type: %v", h.typ) - } - if h.Val == "" { - return fmt.Errorf("unexpected empty hash value") - } - return nil -} - -func (h *Hash) UnmarshalJSON(data []byte) error { - var s string - if err := json.Unmarshal(data, &s); err != nil { - return err - } - nh, err := NewHash(s) - if err != nil { - return err - } - *h = *nh - return nil -} - -func (h Hash) MarshalJSON() ([]byte, error) { - if err := h.assertValid(); err != nil { - return nil, err - } - return json.Marshal(h.String()) -} - -func NewHashSHA512(b []byte) *Hash { - h := sha512.New() - h.Write(b) - nh, _ := NewHash(fmt.Sprintf("sha512-%x", h.Sum(nil))) - return nh -} - -func ShortHash(hash string) string { - if len(hash) > maxHashSize { - return hash[:maxHashSize] - } - return hash -} diff --git a/vendor/github.com/appc/spec/schema/types/isolator.go b/vendor/github.com/appc/spec/schema/types/isolator.go deleted file mode 100644 index fcd1801e64e6..000000000000 --- a/vendor/github.com/appc/spec/schema/types/isolator.go +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "errors" - "fmt" -) - -var ( - isolatorMap map[ACIdentifier]IsolatorValueConstructor - - // ErrIncompatibleIsolator is returned whenever an Isolators set contains - // conflicting IsolatorValue instances - ErrIncompatibleIsolator = errors.New("isolators set contains incompatible types") - // ErrInvalidIsolator is returned upon validation failures due to improper - // or partially constructed Isolator instances (eg. from incomplete direct construction) - ErrInvalidIsolator = errors.New("invalid isolator") -) - -func init() { - isolatorMap = make(map[ACIdentifier]IsolatorValueConstructor) -} - -type IsolatorValueConstructor func() IsolatorValue - -func AddIsolatorValueConstructor(n ACIdentifier, i IsolatorValueConstructor) { - isolatorMap[n] = i -} - -func AddIsolatorName(n ACIdentifier, ns map[ACIdentifier]struct{}) { - ns[n] = struct{}{} -} - -// Isolators encapsulates a list of individual Isolators for the ImageManifest -// and PodManifest schemas. -type Isolators []Isolator - -// assertValid checks that every single isolator is valid and that -// the whole set is well built -func (isolators Isolators) assertValid() error { - typesMap := make(map[ACIdentifier]bool) - for _, i := range isolators { - v := i.Value() - if v == nil { - return ErrInvalidIsolator - } - if err := v.AssertValid(); err != nil { - return err - } - if _, ok := typesMap[i.Name]; ok { - if !v.multipleAllowed() { - return fmt.Errorf(`isolators set contains too many instances of type %s"`, i.Name) - } - } - for _, c := range v.Conflicts() { - if _, found := typesMap[c]; found { - return ErrIncompatibleIsolator - } - } - typesMap[i.Name] = true - } - return nil -} - -// GetByName returns the last isolator in the list by the given name. -func (is *Isolators) GetByName(name ACIdentifier) *Isolator { - var i Isolator - for j := len(*is) - 1; j >= 0; j-- { - i = []Isolator(*is)[j] - if i.Name == name { - return &i - } - } - return nil -} - -// ReplaceIsolatorsByName overrides matching isolator types with a new -// isolator, deleting them all and appending the new one instead -func (is *Isolators) ReplaceIsolatorsByName(newIs Isolator, oldNames []ACIdentifier) { - var i Isolator - for j := len(*is) - 1; j >= 0; j-- { - i = []Isolator(*is)[j] - for _, name := range oldNames { - if i.Name == name { - *is = append((*is)[:j], (*is)[j+1:]...) - } - } - } - *is = append((*is)[:], newIs) - return -} - -// Unrecognized returns a set of isolators that are not recognized. -// An isolator is not recognized if it has not had an associated -// constructor registered with AddIsolatorValueConstructor. -func (is *Isolators) Unrecognized() Isolators { - u := Isolators{} - for _, i := range *is { - if i.value == nil { - u = append(u, i) - } - } - return u -} - -// IsolatorValue encapsulates the actual value of an Isolator which may be -// serialized as any arbitrary JSON blob. Specific Isolator types should -// implement this interface to facilitate unmarshalling and validation. -type IsolatorValue interface { - // UnmarshalJSON unserialize a JSON-encoded isolator - UnmarshalJSON(b []byte) error - // AssertValid returns a non-nil error value if an IsolatorValue is not valid - // according to appc spec - AssertValid() error - // Conflicts returns a list of conflicting isolators types, which cannot co-exist - // together with this IsolatorValue - Conflicts() []ACIdentifier - // multipleAllowed specifies whether multiple isolator instances are allowed - // for this isolator type - multipleAllowed() bool -} - -// Isolator is a model for unmarshalling isolator types from their JSON-encoded -// representation. -type Isolator struct { - // Name is the name of the Isolator type as defined in the specification. - Name ACIdentifier `json:"name"` - // ValueRaw captures the raw JSON value of an Isolator that was - // unmarshalled. This field is used for unmarshalling only. It MUST NOT - // be referenced by external users of the Isolator struct. It is - // exported only to satisfy Go's unfortunate requirement that fields - // must be capitalized to be unmarshalled successfully. - ValueRaw *json.RawMessage `json:"value"` - // value captures the "true" value of the isolator. - value IsolatorValue -} - -// isolator is a shadow type used for unmarshalling. -type isolator Isolator - -// Value returns the raw Value of this Isolator. Users should perform a type -// switch/assertion on this value to extract the underlying isolator type. -func (i *Isolator) Value() IsolatorValue { - return i.value -} - -// UnmarshalJSON populates this Isolator from a JSON-encoded representation. To -// unmarshal the Value of the Isolator, it will use the appropriate constructor -// as registered by AddIsolatorValueConstructor. -func (i *Isolator) UnmarshalJSON(b []byte) error { - var ii isolator - err := json.Unmarshal(b, &ii) - if err != nil { - return err - } - - var dst IsolatorValue - con, ok := isolatorMap[ii.Name] - if ok { - dst = con() - err = dst.UnmarshalJSON(*ii.ValueRaw) - if err != nil { - return err - } - err = dst.AssertValid() - if err != nil { - return err - } - } - - i.value = dst - i.ValueRaw = ii.ValueRaw - i.Name = ii.Name - - return nil -} diff --git a/vendor/github.com/appc/spec/schema/types/isolator_linux_specific.go b/vendor/github.com/appc/spec/schema/types/isolator_linux_specific.go deleted file mode 100644 index ad3441a8dd4c..000000000000 --- a/vendor/github.com/appc/spec/schema/types/isolator_linux_specific.go +++ /dev/null @@ -1,533 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "errors" - "fmt" - "strings" - "unicode" -) - -const ( - LinuxCapabilitiesRetainSetName = "os/linux/capabilities-retain-set" - LinuxCapabilitiesRevokeSetName = "os/linux/capabilities-remove-set" - LinuxNoNewPrivilegesName = "os/linux/no-new-privileges" - LinuxSeccompRemoveSetName = "os/linux/seccomp-remove-set" - LinuxSeccompRetainSetName = "os/linux/seccomp-retain-set" - LinuxOOMScoreAdjName = "os/linux/oom-score-adj" - LinuxCPUSharesName = "os/linux/cpu-shares" - LinuxSELinuxContextName = "os/linux/selinux-context" -) - -var LinuxIsolatorNames = make(map[ACIdentifier]struct{}) - -func init() { - for name, con := range map[ACIdentifier]IsolatorValueConstructor{ - LinuxCapabilitiesRevokeSetName: func() IsolatorValue { return &LinuxCapabilitiesRevokeSet{} }, - LinuxCapabilitiesRetainSetName: func() IsolatorValue { return &LinuxCapabilitiesRetainSet{} }, - LinuxNoNewPrivilegesName: func() IsolatorValue { v := LinuxNoNewPrivileges(false); return &v }, - LinuxOOMScoreAdjName: func() IsolatorValue { v := LinuxOOMScoreAdj(0); return &v }, - LinuxCPUSharesName: func() IsolatorValue { v := LinuxCPUShares(1024); return &v }, - LinuxSeccompRemoveSetName: func() IsolatorValue { return &LinuxSeccompRemoveSet{} }, - LinuxSeccompRetainSetName: func() IsolatorValue { return &LinuxSeccompRetainSet{} }, - LinuxSELinuxContextName: func() IsolatorValue { return &LinuxSELinuxContext{} }, - } { - AddIsolatorName(name, LinuxIsolatorNames) - AddIsolatorValueConstructor(name, con) - } -} - -type LinuxNoNewPrivileges bool - -func (l LinuxNoNewPrivileges) AssertValid() error { - return nil -} - -// TODO(lucab): both need to be clarified in spec, -// see https://github.com/appc/spec/issues/625 -func (l LinuxNoNewPrivileges) multipleAllowed() bool { - return true -} -func (l LinuxNoNewPrivileges) Conflicts() []ACIdentifier { - return nil -} - -func (l *LinuxNoNewPrivileges) UnmarshalJSON(b []byte) error { - var v bool - err := json.Unmarshal(b, &v) - if err != nil { - return err - } - - *l = LinuxNoNewPrivileges(v) - - return nil -} - -type AsIsolator interface { - AsIsolator() (*Isolator, error) -} - -type LinuxCapabilitiesSet interface { - Set() []LinuxCapability - AssertValid() error -} - -type LinuxCapability string - -type linuxCapabilitiesSetValue struct { - Set []LinuxCapability `json:"set"` -} - -type linuxCapabilitiesSetBase struct { - val linuxCapabilitiesSetValue -} - -func (l linuxCapabilitiesSetBase) AssertValid() error { - if len(l.val.Set) == 0 { - return errors.New("set must be non-empty") - } - return nil -} - -// TODO(lucab): both need to be clarified in spec, -// see https://github.com/appc/spec/issues/625 -func (l linuxCapabilitiesSetBase) multipleAllowed() bool { - return true -} -func (l linuxCapabilitiesSetBase) Conflicts() []ACIdentifier { - return nil -} - -func (l *linuxCapabilitiesSetBase) UnmarshalJSON(b []byte) error { - var v linuxCapabilitiesSetValue - err := json.Unmarshal(b, &v) - if err != nil { - return err - } - - l.val = v - - return err -} - -func (l linuxCapabilitiesSetBase) Set() []LinuxCapability { - return l.val.Set -} - -type LinuxCapabilitiesRetainSet struct { - linuxCapabilitiesSetBase -} - -func NewLinuxCapabilitiesRetainSet(caps ...string) (*LinuxCapabilitiesRetainSet, error) { - l := LinuxCapabilitiesRetainSet{ - linuxCapabilitiesSetBase{ - linuxCapabilitiesSetValue{ - make([]LinuxCapability, len(caps)), - }, - }, - } - for i, c := range caps { - l.linuxCapabilitiesSetBase.val.Set[i] = LinuxCapability(c) - } - if err := l.AssertValid(); err != nil { - return nil, err - } - return &l, nil -} - -func (l LinuxCapabilitiesRetainSet) AsIsolator() (*Isolator, error) { - b, err := json.Marshal(l.linuxCapabilitiesSetBase.val) - if err != nil { - return nil, err - } - rm := json.RawMessage(b) - return &Isolator{ - Name: LinuxCapabilitiesRetainSetName, - ValueRaw: &rm, - value: &l, - }, nil -} - -type LinuxCapabilitiesRevokeSet struct { - linuxCapabilitiesSetBase -} - -func NewLinuxCapabilitiesRevokeSet(caps ...string) (*LinuxCapabilitiesRevokeSet, error) { - l := LinuxCapabilitiesRevokeSet{ - linuxCapabilitiesSetBase{ - linuxCapabilitiesSetValue{ - make([]LinuxCapability, len(caps)), - }, - }, - } - for i, c := range caps { - l.linuxCapabilitiesSetBase.val.Set[i] = LinuxCapability(c) - } - if err := l.AssertValid(); err != nil { - return nil, err - } - return &l, nil -} - -func (l LinuxCapabilitiesRevokeSet) AsIsolator() (*Isolator, error) { - b, err := json.Marshal(l.linuxCapabilitiesSetBase.val) - if err != nil { - return nil, err - } - rm := json.RawMessage(b) - return &Isolator{ - Name: LinuxCapabilitiesRevokeSetName, - ValueRaw: &rm, - value: &l, - }, nil -} - -type LinuxSeccompSet interface { - Set() []LinuxSeccompEntry - Errno() LinuxSeccompErrno - AssertValid() error -} - -type LinuxSeccompEntry string -type LinuxSeccompErrno string - -type linuxSeccompValue struct { - Set []LinuxSeccompEntry `json:"set"` - Errno LinuxSeccompErrno `json:"errno"` -} - -type linuxSeccompBase struct { - val linuxSeccompValue -} - -func (l linuxSeccompBase) multipleAllowed() bool { - return false -} - -func (l linuxSeccompBase) AssertValid() error { - if len(l.val.Set) == 0 { - return errors.New("set must be non-empty") - } - if l.val.Errno == "" { - return nil - } - for i, c := range l.val.Errno { - if i == 0 && c != 'E' { - s := fmt.Sprintf("errno must start with an 'E' character, got %s", l.val.Errno) - return errors.New(s) - } else if !(unicode.IsUpper(c) || unicode.IsNumber(c)) { - s := fmt.Sprintf("errno can only contain upper case or numeric characters, got %s", l.val.Errno) - return errors.New(s) - } - } - return nil -} - -func (l *linuxSeccompBase) UnmarshalJSON(b []byte) error { - var v linuxSeccompValue - err := json.Unmarshal(b, &v) - if err != nil { - return err - } - l.val = v - return nil -} - -func (l linuxSeccompBase) Set() []LinuxSeccompEntry { - return l.val.Set -} - -func (l linuxSeccompBase) Errno() LinuxSeccompErrno { - return l.val.Errno -} - -type LinuxSeccompRetainSet struct { - linuxSeccompBase -} - -func (l LinuxSeccompRetainSet) Conflicts() []ACIdentifier { - return []ACIdentifier{LinuxSeccompRemoveSetName} -} - -func NewLinuxSeccompRetainSet(errno string, syscall ...string) (*LinuxSeccompRetainSet, error) { - l := LinuxSeccompRetainSet{ - linuxSeccompBase{ - linuxSeccompValue{ - make([]LinuxSeccompEntry, len(syscall)), - LinuxSeccompErrno(errno), - }, - }, - } - for i, c := range syscall { - l.linuxSeccompBase.val.Set[i] = LinuxSeccompEntry(c) - } - if err := l.AssertValid(); err != nil { - return nil, err - } - return &l, nil -} - -func (l LinuxSeccompRetainSet) AsIsolator() (*Isolator, error) { - b, err := json.Marshal(l.linuxSeccompBase.val) - if err != nil { - return nil, err - } - rm := json.RawMessage(b) - return &Isolator{ - Name: LinuxSeccompRetainSetName, - ValueRaw: &rm, - value: &l, - }, nil -} - -type LinuxSeccompRemoveSet struct { - linuxSeccompBase -} - -func (l LinuxSeccompRemoveSet) Conflicts() []ACIdentifier { - return []ACIdentifier{LinuxSeccompRetainSetName} -} - -func NewLinuxSeccompRemoveSet(errno string, syscall ...string) (*LinuxSeccompRemoveSet, error) { - l := LinuxSeccompRemoveSet{ - linuxSeccompBase{ - linuxSeccompValue{ - make([]LinuxSeccompEntry, len(syscall)), - LinuxSeccompErrno(errno), - }, - }, - } - for i, c := range syscall { - l.linuxSeccompBase.val.Set[i] = LinuxSeccompEntry(c) - } - if err := l.AssertValid(); err != nil { - return nil, err - } - return &l, nil -} - -func (l LinuxSeccompRemoveSet) AsIsolator() (*Isolator, error) { - b, err := json.Marshal(l.linuxSeccompBase.val) - if err != nil { - return nil, err - } - rm := json.RawMessage(b) - return &Isolator{ - Name: LinuxSeccompRemoveSetName, - ValueRaw: &rm, - value: &l, - }, nil -} - -// LinuxCPUShares assigns the CPU time share weight to the processes executed. -// See https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html#CPUShares=weight, -// https://www.kernel.org/doc/Documentation/scheduler/sched-design-CFS.txt -type LinuxCPUShares int - -func NewLinuxCPUShares(val int) (*LinuxCPUShares, error) { - l := LinuxCPUShares(val) - if err := l.AssertValid(); err != nil { - return nil, err - } - - return &l, nil -} - -func (l LinuxCPUShares) AssertValid() error { - if l < 2 || l > 262144 { - return fmt.Errorf("%s must be between 2 and 262144, got %d", LinuxCPUSharesName, l) - } - return nil -} - -func (l LinuxCPUShares) multipleAllowed() bool { - return false -} - -func (l LinuxCPUShares) Conflicts() []ACIdentifier { - return nil -} - -func (l *LinuxCPUShares) UnmarshalJSON(b []byte) error { - var v int - err := json.Unmarshal(b, &v) - if err != nil { - return err - } - - *l = LinuxCPUShares(v) - return nil -} - -func (l LinuxCPUShares) AsIsolator() Isolator { - b, err := json.Marshal(l) - if err != nil { - panic(err) - } - rm := json.RawMessage(b) - return Isolator{ - Name: LinuxCPUSharesName, - ValueRaw: &rm, - value: &l, - } -} - -// LinuxOOMScoreAdj is equivalent to /proc/[pid]/oom_score_adj -type LinuxOOMScoreAdj int // -1000 to 1000 - -func NewLinuxOOMScoreAdj(val int) (*LinuxOOMScoreAdj, error) { - l := LinuxOOMScoreAdj(val) - if err := l.AssertValid(); err != nil { - return nil, err - } - - return &l, nil -} - -func (l LinuxOOMScoreAdj) AssertValid() error { - if l < -1000 || l > 1000 { - return fmt.Errorf("%s must be between -1000 and 1000, got %d", LinuxOOMScoreAdjName, l) - } - return nil -} - -func (l LinuxOOMScoreAdj) multipleAllowed() bool { - return false -} - -func (l LinuxOOMScoreAdj) Conflicts() []ACIdentifier { - return nil -} - -func (l *LinuxOOMScoreAdj) UnmarshalJSON(b []byte) error { - var v int - err := json.Unmarshal(b, &v) - if err != nil { - return err - } - - *l = LinuxOOMScoreAdj(v) - return nil -} - -func (l LinuxOOMScoreAdj) AsIsolator() Isolator { - b, err := json.Marshal(l) - if err != nil { - panic(err) - } - rm := json.RawMessage(b) - return Isolator{ - Name: LinuxOOMScoreAdjName, - ValueRaw: &rm, - value: &l, - } -} - -type LinuxSELinuxUser string -type LinuxSELinuxRole string -type LinuxSELinuxType string -type LinuxSELinuxLevel string - -type linuxSELinuxValue struct { - User LinuxSELinuxUser `json:"user"` - Role LinuxSELinuxRole `json:"role"` - Type LinuxSELinuxType `json:"type"` - Level LinuxSELinuxLevel `json:"level"` -} - -type LinuxSELinuxContext struct { - val linuxSELinuxValue -} - -func (l LinuxSELinuxContext) AssertValid() error { - if l.val.User == "" || strings.Contains(string(l.val.User), ":") { - return fmt.Errorf("invalid user value %q", l.val.User) - } - if l.val.Role == "" || strings.Contains(string(l.val.Role), ":") { - return fmt.Errorf("invalid role value %q", l.val.Role) - } - if l.val.Type == "" || strings.Contains(string(l.val.Type), ":") { - return fmt.Errorf("invalid type value %q", l.val.Type) - } - if l.val.Level == "" { - return fmt.Errorf("invalid level value %q", l.val.Level) - } - return nil -} - -func (l *LinuxSELinuxContext) UnmarshalJSON(b []byte) error { - var v linuxSELinuxValue - err := json.Unmarshal(b, &v) - if err != nil { - return err - } - l.val = v - return nil -} - -func (l LinuxSELinuxContext) User() LinuxSELinuxUser { - return l.val.User -} - -func (l LinuxSELinuxContext) Role() LinuxSELinuxRole { - return l.val.Role -} - -func (l LinuxSELinuxContext) Type() LinuxSELinuxType { - return l.val.Type -} - -func (l LinuxSELinuxContext) Level() LinuxSELinuxLevel { - return l.val.Level -} - -func (l LinuxSELinuxContext) multipleAllowed() bool { - return false -} - -func (l LinuxSELinuxContext) Conflicts() []ACIdentifier { - return nil -} - -func NewLinuxSELinuxContext(selinuxUser, selinuxRole, selinuxType, selinuxLevel string) (*LinuxSELinuxContext, error) { - l := LinuxSELinuxContext{ - linuxSELinuxValue{ - LinuxSELinuxUser(selinuxUser), - LinuxSELinuxRole(selinuxRole), - LinuxSELinuxType(selinuxType), - LinuxSELinuxLevel(selinuxLevel), - }, - } - if err := l.AssertValid(); err != nil { - return nil, err - } - return &l, nil -} - -func (l LinuxSELinuxContext) AsIsolator() (*Isolator, error) { - b, err := json.Marshal(l.val) - if err != nil { - return nil, err - } - rm := json.RawMessage(b) - return &Isolator{ - Name: LinuxSELinuxContextName, - ValueRaw: &rm, - value: &l, - }, nil -} diff --git a/vendor/github.com/appc/spec/schema/types/isolator_resources.go b/vendor/github.com/appc/spec/schema/types/isolator_resources.go deleted file mode 100644 index 2ec250d4f977..000000000000 --- a/vendor/github.com/appc/spec/schema/types/isolator_resources.go +++ /dev/null @@ -1,245 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "errors" - "fmt" - - "github.com/appc/spec/schema/types/resource" -) - -var ( - ErrDefaultTrue = errors.New("default must be false") - ErrDefaultRequired = errors.New("default must be true") - ErrRequestNonEmpty = errors.New("request not supported by this resource, must be empty") - - ResourceIsolatorNames = make(map[ACIdentifier]struct{}) -) - -const ( - ResourceBlockBandwidthName = "resource/block-bandwidth" - ResourceBlockIOPSName = "resource/block-iops" - ResourceCPUName = "resource/cpu" - ResourceMemoryName = "resource/memory" - ResourceNetworkBandwidthName = "resource/network-bandwidth" -) - -func init() { - for name, con := range map[ACIdentifier]IsolatorValueConstructor{ - ResourceBlockBandwidthName: func() IsolatorValue { return &ResourceBlockBandwidth{} }, - ResourceBlockIOPSName: func() IsolatorValue { return &ResourceBlockIOPS{} }, - ResourceCPUName: func() IsolatorValue { return &ResourceCPU{} }, - ResourceMemoryName: func() IsolatorValue { return &ResourceMemory{} }, - ResourceNetworkBandwidthName: func() IsolatorValue { return &ResourceNetworkBandwidth{} }, - } { - AddIsolatorName(name, ResourceIsolatorNames) - AddIsolatorValueConstructor(name, con) - } -} - -type Resource interface { - Limit() *resource.Quantity - Request() *resource.Quantity - Default() bool -} - -type ResourceBase struct { - val resourceValue -} - -type resourceValue struct { - Default bool `json:"default"` - Request *resource.Quantity `json:"request"` - Limit *resource.Quantity `json:"limit"` -} - -func (r ResourceBase) Limit() *resource.Quantity { - return r.val.Limit -} -func (r ResourceBase) Request() *resource.Quantity { - return r.val.Request -} -func (r ResourceBase) Default() bool { - return r.val.Default -} - -func (r *ResourceBase) UnmarshalJSON(b []byte) error { - return json.Unmarshal(b, &r.val) -} - -func (r ResourceBase) AssertValid() error { - return nil -} - -// TODO(lucab): both need to be clarified in spec, -// see https://github.com/appc/spec/issues/625 -func (l ResourceBase) multipleAllowed() bool { - return true -} -func (l ResourceBase) Conflicts() []ACIdentifier { - return nil -} - -type ResourceBlockBandwidth struct { - ResourceBase -} - -func (r ResourceBlockBandwidth) AssertValid() error { - if r.Default() != true { - return ErrDefaultRequired - } - if r.Request() != nil { - return ErrRequestNonEmpty - } - return nil -} - -type ResourceBlockIOPS struct { - ResourceBase -} - -func (r ResourceBlockIOPS) AssertValid() error { - if r.Default() != true { - return ErrDefaultRequired - } - if r.Request() != nil { - return ErrRequestNonEmpty - } - return nil -} - -type ResourceCPU struct { - ResourceBase -} - -func (r ResourceCPU) String() string { - return fmt.Sprintf("ResourceCPU(request=%s, limit=%s)", r.Request(), r.Limit()) -} - -func (r ResourceCPU) AssertValid() error { - if r.Default() != false { - return ErrDefaultTrue - } - return nil -} - -func (r ResourceCPU) AsIsolator() Isolator { - isol := isolatorMap[ResourceCPUName]() - - b, err := json.Marshal(r.val) - if err != nil { - panic(err) - } - valRaw := json.RawMessage(b) - return Isolator{ - Name: ResourceCPUName, - ValueRaw: &valRaw, - value: isol, - } -} - -func NewResourceCPUIsolator(request, limit string) (*ResourceCPU, error) { - req, err := resource.ParseQuantity(request) - if err != nil { - return nil, fmt.Errorf("error parsing request: %v", err) - } - lim, err := resource.ParseQuantity(limit) - if err != nil { - return nil, fmt.Errorf("error parsing limit: %v", err) - } - res := &ResourceCPU{ - ResourceBase{ - resourceValue{ - Request: &req, - Limit: &lim, - }, - }, - } - if err := res.AssertValid(); err != nil { - // should never happen - return nil, err - } - return res, nil -} - -type ResourceMemory struct { - ResourceBase -} - -func (r ResourceMemory) String() string { - return fmt.Sprintf("ResourceMemory(request=%s, limit=%s)", r.Request(), r.Limit()) -} - -func (r ResourceMemory) AssertValid() error { - if r.Default() != false { - return ErrDefaultTrue - } - return nil -} - -func (r ResourceMemory) AsIsolator() Isolator { - isol := isolatorMap[ResourceMemoryName]() - - b, err := json.Marshal(r.val) - if err != nil { - panic(err) - } - valRaw := json.RawMessage(b) - return Isolator{ - Name: ResourceMemoryName, - ValueRaw: &valRaw, - value: isol, - } -} - -func NewResourceMemoryIsolator(request, limit string) (*ResourceMemory, error) { - req, err := resource.ParseQuantity(request) - if err != nil { - return nil, fmt.Errorf("error parsing request: %v", err) - } - lim, err := resource.ParseQuantity(limit) - if err != nil { - return nil, fmt.Errorf("error parsing limit: %v", err) - } - res := &ResourceMemory{ - ResourceBase{ - resourceValue{ - Request: &req, - Limit: &lim, - }, - }, - } - if err := res.AssertValid(); err != nil { - // should never happen - return nil, err - } - return res, nil -} - -type ResourceNetworkBandwidth struct { - ResourceBase -} - -func (r ResourceNetworkBandwidth) AssertValid() error { - if r.Default() != true { - return ErrDefaultRequired - } - if r.Request() != nil { - return ErrRequestNonEmpty - } - return nil -} diff --git a/vendor/github.com/appc/spec/schema/types/isolator_unix.go b/vendor/github.com/appc/spec/schema/types/isolator_unix.go deleted file mode 100644 index ac0111a7deb3..000000000000 --- a/vendor/github.com/appc/spec/schema/types/isolator_unix.go +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2016 The appc 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 types - -import ( - "encoding/json" -) - -var ( - UnixIsolatorNames = make(map[ACIdentifier]struct{}) -) - -const ( - //TODO(lucab): add "ulimit" isolators - UnixSysctlName = "os/unix/sysctl" -) - -func init() { - for name, con := range map[ACIdentifier]IsolatorValueConstructor{ - UnixSysctlName: func() IsolatorValue { return &UnixSysctl{} }, - } { - AddIsolatorName(name, UnixIsolatorNames) - AddIsolatorValueConstructor(name, con) - } -} - -type UnixSysctl map[string]string - -func (s *UnixSysctl) UnmarshalJSON(b []byte) error { - var v map[string]string - err := json.Unmarshal(b, &v) - if err != nil { - return err - } - *s = UnixSysctl(v) - return err -} - -func (s UnixSysctl) AssertValid() error { - return nil -} - -func (s UnixSysctl) multipleAllowed() bool { - return false -} -func (s UnixSysctl) Conflicts() []ACIdentifier { - return nil -} - -func (s UnixSysctl) AsIsolator() Isolator { - isol := isolatorMap[UnixSysctlName]() - - b, err := json.Marshal(s) - if err != nil { - panic(err) - } - valRaw := json.RawMessage(b) - return Isolator{ - Name: UnixSysctlName, - ValueRaw: &valRaw, - value: isol, - } -} - -func NewUnixSysctlIsolator(cfg map[string]string) (*UnixSysctl, error) { - s := UnixSysctl(cfg) - if err := s.AssertValid(); err != nil { - return nil, err - } - return &s, nil -} diff --git a/vendor/github.com/appc/spec/schema/types/labels.go b/vendor/github.com/appc/spec/schema/types/labels.go deleted file mode 100644 index 25931f94027d..000000000000 --- a/vendor/github.com/appc/spec/schema/types/labels.go +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "fmt" - "sort" -) - -var ValidOSArch = map[string][]string{ - "linux": {"amd64", "i386", "aarch64", "aarch64_be", "armv6l", "armv7l", "armv7b", "ppc64", "ppc64le", "s390x"}, - "freebsd": {"amd64", "i386", "arm"}, - "darwin": {"x86_64", "i386"}, -} - -type Labels []Label - -type labelsSlice Labels - -func (l labelsSlice) Len() int { return len(l) } -func (l labelsSlice) Swap(i, j int) { l[i], l[j] = l[j], l[i] } -func (l labelsSlice) Less(i, j int) bool { return l[i].Name < l[j].Name } - -type Label struct { - Name ACIdentifier `json:"name"` - Value string `json:"value"` -} - -// {appc,go}ArchTuple are internal helper types used to translate arch tuple between go and appc -type appcArchTuple struct { - appcOs string - appcArch string -} -type goArchTuple struct { - goOs string - goArch string - goArchFlavor string -} - -// IsValidOsArch checks if a OS-architecture combination is valid given a map -// of valid OS-architectures -func IsValidOSArch(labels map[ACIdentifier]string, validOSArch map[string][]string) error { - if os, ok := labels["os"]; ok { - if validArchs, ok := validOSArch[os]; !ok { - // Not a whitelisted OS. TODO: how to warn rather than fail? - validOses := make([]string, 0, len(validOSArch)) - for validOs := range validOSArch { - validOses = append(validOses, validOs) - } - sort.Strings(validOses) - return fmt.Errorf(`bad os %#v (must be one of: %v)`, os, validOses) - } else { - // Whitelisted OS. We check arch here, as arch makes sense only - // when os is defined. - if arch, ok := labels["arch"]; ok { - found := false - for _, validArch := range validArchs { - if arch == validArch { - found = true - break - } - } - if !found { - return fmt.Errorf(`bad arch %#v for %v (must be one of: %v)`, arch, os, validArchs) - } - } - } - } - return nil -} - -func (l Labels) assertValid() error { - seen := map[ACIdentifier]string{} - for _, lbl := range l { - if lbl.Name == "name" { - return fmt.Errorf(`invalid label name: "name"`) - } - _, ok := seen[lbl.Name] - if ok { - return fmt.Errorf(`duplicate labels of name %q`, lbl.Name) - } - seen[lbl.Name] = lbl.Value - } - return IsValidOSArch(seen, ValidOSArch) -} - -func (l Labels) MarshalJSON() ([]byte, error) { - if err := l.assertValid(); err != nil { - return nil, err - } - return json.Marshal(labelsSlice(l)) -} - -func (l *Labels) UnmarshalJSON(data []byte) error { - var jl labelsSlice - if err := json.Unmarshal(data, &jl); err != nil { - return err - } - nl := Labels(jl) - if err := nl.assertValid(); err != nil { - return err - } - *l = nl - return nil -} - -// Get retrieves the value of the label by the given name from Labels, if it exists -func (l Labels) Get(name string) (val string, ok bool) { - for _, lbl := range l { - if lbl.Name.String() == name { - return lbl.Value, true - } - } - return "", false -} - -// ToMap creates a map[ACIdentifier]string. -func (l Labels) ToMap() map[ACIdentifier]string { - labelsMap := make(map[ACIdentifier]string) - for _, lbl := range l { - labelsMap[lbl.Name] = lbl.Value - } - return labelsMap -} - -// LabelsFromMap creates Labels from a map[ACIdentifier]string -func LabelsFromMap(labelsMap map[ACIdentifier]string) (Labels, error) { - labels := Labels{} - for n, v := range labelsMap { - labels = append(labels, Label{Name: n, Value: v}) - } - if err := labels.assertValid(); err != nil { - return nil, err - } - sort.Sort(labelsSlice(labels)) - return labels, nil -} - -// ToAppcOSArch translates a Golang arch tuple (OS, architecture, flavor) into -// an appc arch tuple (OS, architecture) -func ToAppcOSArch(goOs string, goArch string, goArchFlavor string) (appcOs string, appcArch string, e error) { - tabularAppcToGo := map[goArchTuple]appcArchTuple{ - {"linux", "amd64", ""}: {"linux", "amd64"}, - {"linux", "386", ""}: {"linux", "i386"}, - {"linux", "arm64", ""}: {"linux", "aarch64"}, - {"linux", "arm", ""}: {"linux", "armv6l"}, - {"linux", "arm", "6"}: {"linux", "armv6l"}, - {"linux", "arm", "7"}: {"linux", "armv7l"}, - {"linux", "ppc64", ""}: {"linux", "ppc64"}, - {"linux", "ppc64le", ""}: {"linux", "ppc64le"}, - {"linux", "s390x", ""}: {"linux", "s390x"}, - - {"freebsd", "amd64", ""}: {"freebsd", "amd64"}, - {"freebsd", "386", ""}: {"freebsd", "i386"}, - {"freebsd", "arm", ""}: {"freebsd", "arm"}, - {"freebsd", "arm", "5"}: {"freebsd", "arm"}, - {"freebsd", "arm", "6"}: {"freebsd", "arm"}, - {"freebsd", "arm", "7"}: {"freebsd", "arm"}, - - {"darwin", "amd64", ""}: {"darwin", "x86_64"}, - {"darwin", "386", ""}: {"darwin", "i386"}, - } - archTuple, ok := tabularAppcToGo[goArchTuple{goOs, goArch, goArchFlavor}] - if !ok { - return "", "", fmt.Errorf("unknown arch tuple: %q - %q - %q", goOs, goArch, goArchFlavor) - } - return archTuple.appcOs, archTuple.appcArch, nil -} - -// ToGoOSArch translates an appc arch tuple (OS, architecture) into -// a Golang arch tuple (OS, architecture, flavor) -func ToGoOSArch(appcOs string, appcArch string) (goOs string, goArch string, goArchFlavor string, e error) { - tabularGoToAppc := map[appcArchTuple]goArchTuple{ - // {"linux", "aarch64_be"}: nil, - // {"linux", "armv7b"}: nil, - {"linux", "aarch64"}: {"linux", "arm64", ""}, - {"linux", "amd64"}: {"linux", "amd64", ""}, - {"linux", "armv6l"}: {"linux", "arm", "6"}, - {"linux", "armv7l"}: {"linux", "arm", "7"}, - {"linux", "i386"}: {"linux", "386", ""}, - {"linux", "ppc64"}: {"linux", "ppc64", ""}, - {"linux", "ppc64le"}: {"linux", "ppc64le", ""}, - {"linux", "s390x"}: {"linux", "s390x", ""}, - - {"freebsd", "amd64"}: {"freebsd", "amd64", ""}, - {"freebsd", "arm"}: {"freebsd", "arm", "6"}, - {"freebsd", "386"}: {"freebsd", "i386", ""}, - - {"darwin", "amd64"}: {"darwin", "x86_64", ""}, - {"darwin", "386"}: {"darwin", "i386", ""}, - } - - archTuple, ok := tabularGoToAppc[appcArchTuple{appcOs, appcArch}] - if !ok { - return "", "", "", fmt.Errorf("unknown arch tuple: %q - %q", appcOs, appcArch) - } - return archTuple.goOs, archTuple.goArch, archTuple.goArchFlavor, nil -} diff --git a/vendor/github.com/appc/spec/schema/types/mountpoint.go b/vendor/github.com/appc/spec/schema/types/mountpoint.go deleted file mode 100644 index 9d4e52b3d0d3..000000000000 --- a/vendor/github.com/appc/spec/schema/types/mountpoint.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "errors" - "fmt" - "net/url" - "strconv" - - "github.com/appc/spec/schema/common" -) - -// MountPoint is the application-side manifestation of a Volume. -type MountPoint struct { - Name ACName `json:"name"` - Path string `json:"path"` - ReadOnly bool `json:"readOnly,omitempty"` -} - -func (mount MountPoint) assertValid() error { - if mount.Name.Empty() { - return errors.New("name must be set") - } - if len(mount.Path) == 0 { - return errors.New("path must be set") - } - return nil -} - -// MountPointFromString takes a command line mountpoint parameter and returns a mountpoint -// -// It is useful for actool patch-manifest --mounts -// -// Example mountpoint parameters: -// database,path=/tmp,readOnly=true -func MountPointFromString(mp string) (*MountPoint, error) { - var mount MountPoint - - mp = "name=" + mp - mpQuery, err := common.MakeQueryString(mp) - if err != nil { - return nil, err - } - - v, err := url.ParseQuery(mpQuery) - if err != nil { - return nil, err - } - for key, val := range v { - if len(val) > 1 { - return nil, fmt.Errorf("label %s with multiple values %q", key, val) - } - - switch key { - case "name": - acn, err := NewACName(val[0]) - if err != nil { - return nil, err - } - mount.Name = *acn - case "path": - mount.Path = val[0] - case "readOnly": - ro, err := strconv.ParseBool(val[0]) - if err != nil { - return nil, err - } - mount.ReadOnly = ro - default: - return nil, fmt.Errorf("unknown mountpoint parameter %q", key) - } - } - err = mount.assertValid() - if err != nil { - return nil, err - } - - return &mount, nil -} diff --git a/vendor/github.com/appc/spec/schema/types/port.go b/vendor/github.com/appc/spec/schema/types/port.go deleted file mode 100644 index 2d54515037af..000000000000 --- a/vendor/github.com/appc/spec/schema/types/port.go +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "errors" - "fmt" - "net" - "net/url" - "strconv" - - "github.com/appc/spec/schema/common" -) - -// Port represents a port as offered by an application *inside* -// the pod. -type Port struct { - Name ACName `json:"name"` - Protocol string `json:"protocol"` - Port uint `json:"port"` - Count uint `json:"count"` - SocketActivated bool `json:"socketActivated"` -} - -// ExposedPort represents a port listening on the host side. -// The PodPort is optional -- if missing, then try and find the pod-side -// information by matching names -type ExposedPort struct { - Name ACName `json:"name"` - HostPort uint `json:"hostPort"` - HostIP net.IP `json:"hostIP,omitempty"` // optional - PodPort *Port `json:"podPort,omitempty"` // optional. If missing, try and find a corresponding App's port -} - -type port Port - -func (p *Port) UnmarshalJSON(data []byte) error { - var pp port - if err := json.Unmarshal(data, &pp); err != nil { - return err - } - np := Port(pp) - if err := np.assertValid(); err != nil { - return err - } - if np.Count == 0 { - np.Count = 1 - } - *p = np - return nil -} - -func (p Port) MarshalJSON() ([]byte, error) { - if err := p.assertValid(); err != nil { - return nil, err - } - return json.Marshal(port(p)) -} - -func (p Port) assertValid() error { - // Although there are no guarantees, most (if not all) - // transport protocols use 16 bit ports - if p.Port > 65535 || p.Port < 1 { - return errors.New("port must be in 1-65535 range") - } - if p.Port+p.Count > 65536 { - return errors.New("end of port range must be in 1-65535 range") - } - return nil -} - -// PortFromString takes a command line port parameter and returns a port -// -// It is useful for actool patch-manifest --ports -// -// Example port parameters: -// health-check,protocol=udp,port=8000 -// query,protocol=tcp,port=8080,count=1,socketActivated=true -func PortFromString(pt string) (*Port, error) { - var port Port - - pt = "name=" + pt - ptQuery, err := common.MakeQueryString(pt) - if err != nil { - return nil, err - } - - v, err := url.ParseQuery(ptQuery) - if err != nil { - return nil, err - } - for key, val := range v { - if len(val) > 1 { - return nil, fmt.Errorf("label %s with multiple values %q", key, val) - } - - switch key { - case "name": - acn, err := NewACName(val[0]) - if err != nil { - return nil, err - } - port.Name = *acn - case "protocol": - port.Protocol = val[0] - case "port": - p, err := strconv.ParseUint(val[0], 10, 16) - if err != nil { - return nil, err - } - port.Port = uint(p) - case "count": - cnt, err := strconv.ParseUint(val[0], 10, 16) - if err != nil { - return nil, err - } - port.Count = uint(cnt) - case "socketActivated": - sa, err := strconv.ParseBool(val[0]) - if err != nil { - return nil, err - } - port.SocketActivated = sa - default: - return nil, fmt.Errorf("unknown port parameter %q", key) - } - } - err = port.assertValid() - if err != nil { - return nil, err - } - - return &port, nil -} diff --git a/vendor/github.com/appc/spec/schema/types/resource/README.md b/vendor/github.com/appc/spec/schema/types/resource/README.md deleted file mode 100644 index b3c16d251272..000000000000 --- a/vendor/github.com/appc/spec/schema/types/resource/README.md +++ /dev/null @@ -1,4 +0,0 @@ -This package was copied in from the Kubernetes repo to avoid a cyclic -dependency. These files were taken from master from -github.com/kubernetes/kubernetes at commit hash -b0deb2eb8f4037421077f77cb163dbb4c0a2a9f5. diff --git a/vendor/github.com/appc/spec/schema/types/resource/amount.go b/vendor/github.com/appc/spec/schema/types/resource/amount.go deleted file mode 100644 index 6ae823a0229e..000000000000 --- a/vendor/github.com/appc/spec/schema/types/resource/amount.go +++ /dev/null @@ -1,298 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package resource - -import ( - "math/big" - "strconv" - - inf "gopkg.in/inf.v0" -) - -// Scale is used for getting and setting the base-10 scaled value. -// Base-2 scales are omitted for mathematical simplicity. -// See Quantity.ScaledValue for more details. -type Scale int32 - -// infScale adapts a Scale value to an inf.Scale value. -func (s Scale) infScale() inf.Scale { - return inf.Scale(-s) // inf.Scale is upside-down -} - -const ( - Nano Scale = -9 - Micro Scale = -6 - Milli Scale = -3 - Kilo Scale = 3 - Mega Scale = 6 - Giga Scale = 9 - Tera Scale = 12 - Peta Scale = 15 - Exa Scale = 18 -) - -var ( - Zero = int64Amount{} - - // Used by quantity strings - treat as read only - zeroBytes = []byte("0") -) - -// int64Amount represents a fixed precision numerator and arbitrary scale exponent. It is faster -// than operations on inf.Dec for values that can be represented as int64. -type int64Amount struct { - value int64 - scale Scale -} - -// Sign returns 0 if the value is zero, -1 if it is less than 0, or 1 if it is greater than 0. -func (a int64Amount) Sign() int { - switch { - case a.value == 0: - return 0 - case a.value > 0: - return 1 - default: - return -1 - } -} - -// AsInt64 returns the current amount as an int64 at scale 0, or false if the value cannot be -// represented in an int64 OR would result in a loss of precision. This method is intended as -// an optimization to avoid calling AsDec. -func (a int64Amount) AsInt64() (int64, bool) { - if a.scale == 0 { - return a.value, true - } - if a.scale < 0 { - // TODO: attempt to reduce factors, although it is assumed that factors are reduced prior - // to the int64Amount being created. - return 0, false - } - return positiveScaleInt64(a.value, a.scale) -} - -// AsScaledInt64 returns an int64 representing the value of this amount at the specified scale, -// rounding up, or false if that would result in overflow. (1e20).AsScaledInt64(1) would result -// in overflow because 1e19 is not representable as an int64. Note that setting a scale larger -// than the current value may result in loss of precision - i.e. (1e-6).AsScaledInt64(0) would -// return 1, because 0.000001 is rounded up to 1. -func (a int64Amount) AsScaledInt64(scale Scale) (result int64, ok bool) { - if a.scale < scale { - result, _ = negativeScaleInt64(a.value, scale-a.scale) - return result, true - } - return positiveScaleInt64(a.value, a.scale-scale) -} - -// AsDec returns an inf.Dec representation of this value. -func (a int64Amount) AsDec() *inf.Dec { - var base inf.Dec - base.SetUnscaled(a.value) - base.SetScale(inf.Scale(-a.scale)) - return &base -} - -// Cmp returns 0 if a and b are equal, 1 if a is greater than b, or -1 if a is less than b. -func (a int64Amount) Cmp(b int64Amount) int { - switch { - case a.scale == b.scale: - // compare only the unscaled portion - case a.scale > b.scale: - result, remainder, exact := divideByScaleInt64(b.value, a.scale-b.scale) - if !exact { - return a.AsDec().Cmp(b.AsDec()) - } - if result == a.value { - switch { - case remainder == 0: - return 0 - case remainder > 0: - return -1 - default: - return 1 - } - } - b.value = result - default: - result, remainder, exact := divideByScaleInt64(a.value, b.scale-a.scale) - if !exact { - return a.AsDec().Cmp(b.AsDec()) - } - if result == b.value { - switch { - case remainder == 0: - return 0 - case remainder > 0: - return 1 - default: - return -1 - } - } - a.value = result - } - - switch { - case a.value == b.value: - return 0 - case a.value < b.value: - return -1 - default: - return 1 - } -} - -// Add adds two int64Amounts together, matching scales. It will return false and not mutate -// a if overflow or underflow would result. -func (a *int64Amount) Add(b int64Amount) bool { - switch { - case b.value == 0: - return true - case a.value == 0: - a.value = b.value - a.scale = b.scale - return true - case a.scale == b.scale: - c, ok := int64Add(a.value, b.value) - if !ok { - return false - } - a.value = c - case a.scale > b.scale: - c, ok := positiveScaleInt64(a.value, a.scale-b.scale) - if !ok { - return false - } - c, ok = int64Add(c, b.value) - if !ok { - return false - } - a.scale = b.scale - a.value = c - default: - c, ok := positiveScaleInt64(b.value, b.scale-a.scale) - if !ok { - return false - } - c, ok = int64Add(a.value, c) - if !ok { - return false - } - a.value = c - } - return true -} - -// Sub removes the value of b from the current amount, or returns false if underflow would result. -func (a *int64Amount) Sub(b int64Amount) bool { - return a.Add(int64Amount{value: -b.value, scale: b.scale}) -} - -// AsScale adjusts this amount to set a minimum scale, rounding up, and returns true iff no precision -// was lost. (1.1e5).AsScale(5) would return 1.1e5, but (1.1e5).AsScale(6) would return 1e6. -func (a int64Amount) AsScale(scale Scale) (int64Amount, bool) { - if a.scale >= scale { - return a, true - } - result, exact := negativeScaleInt64(a.value, scale-a.scale) - return int64Amount{value: result, scale: scale}, exact -} - -// AsCanonicalBytes accepts a buffer to write the base-10 string value of this field to, and returns -// either that buffer or a larger buffer and the current exponent of the value. The value is adjusted -// until the exponent is a multiple of 3 - i.e. 1.1e5 would return "110", 3. -func (a int64Amount) AsCanonicalBytes(out []byte) (result []byte, exponent int32) { - mantissa := a.value - exponent = int32(a.scale) - - amount, times := removeInt64Factors(mantissa, 10) - exponent += int32(times) - - // make sure exponent is a multiple of 3 - var ok bool - switch exponent % 3 { - case 1, -2: - amount, ok = int64MultiplyScale10(amount) - if !ok { - return infDecAmount{a.AsDec()}.AsCanonicalBytes(out) - } - exponent = exponent - 1 - case 2, -1: - amount, ok = int64MultiplyScale100(amount) - if !ok { - return infDecAmount{a.AsDec()}.AsCanonicalBytes(out) - } - exponent = exponent - 2 - } - return strconv.AppendInt(out, amount, 10), exponent -} - -// AsCanonicalBase1024Bytes accepts a buffer to write the base-1024 string value of this field to, and returns -// either that buffer or a larger buffer and the current exponent of the value. 2048 is 2 * 1024 ^ 1 and would -// return []byte("2048"), 1. -func (a int64Amount) AsCanonicalBase1024Bytes(out []byte) (result []byte, exponent int32) { - value, ok := a.AsScaledInt64(0) - if !ok { - return infDecAmount{a.AsDec()}.AsCanonicalBase1024Bytes(out) - } - amount, exponent := removeInt64Factors(value, 1024) - return strconv.AppendInt(out, amount, 10), exponent -} - -// infDecAmount implements common operations over an inf.Dec that are specific to the quantity -// representation. -type infDecAmount struct { - *inf.Dec -} - -// AsScale adjusts this amount to set a minimum scale, rounding up, and returns true iff no precision -// was lost. (1.1e5).AsScale(5) would return 1.1e5, but (1.1e5).AsScale(6) would return 1e6. -func (a infDecAmount) AsScale(scale Scale) (infDecAmount, bool) { - tmp := &inf.Dec{} - tmp.Round(a.Dec, scale.infScale(), inf.RoundUp) - return infDecAmount{tmp}, tmp.Cmp(a.Dec) == 0 -} - -// AsCanonicalBytes accepts a buffer to write the base-10 string value of this field to, and returns -// either that buffer or a larger buffer and the current exponent of the value. The value is adjusted -// until the exponent is a multiple of 3 - i.e. 1.1e5 would return "110", 3. -func (a infDecAmount) AsCanonicalBytes(out []byte) (result []byte, exponent int32) { - mantissa := a.Dec.UnscaledBig() - exponent = int32(-a.Dec.Scale()) - amount := big.NewInt(0).Set(mantissa) - // move all factors of 10 into the exponent for easy reasoning - amount, times := removeBigIntFactors(amount, bigTen) - exponent += times - - // make sure exponent is a multiple of 3 - for exponent%3 != 0 { - amount.Mul(amount, bigTen) - exponent-- - } - - return append(out, amount.String()...), exponent -} - -// AsCanonicalBase1024Bytes accepts a buffer to write the base-1024 string value of this field to, and returns -// either that buffer or a larger buffer and the current exponent of the value. 2048 is 2 * 1024 ^ 1 and would -// return []byte("2048"), 1. -func (a infDecAmount) AsCanonicalBase1024Bytes(out []byte) (result []byte, exponent int32) { - tmp := &inf.Dec{} - tmp.Round(a.Dec, 0, inf.RoundUp) - amount, exponent := removeBigIntFactors(tmp.UnscaledBig(), big1024) - return append(out, amount.String()...), exponent -} diff --git a/vendor/github.com/appc/spec/schema/types/resource/math.go b/vendor/github.com/appc/spec/schema/types/resource/math.go deleted file mode 100644 index 163aafa5db6a..000000000000 --- a/vendor/github.com/appc/spec/schema/types/resource/math.go +++ /dev/null @@ -1,327 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package resource - -import ( - "math/big" - - inf "gopkg.in/inf.v0" -) - -const ( - // maxInt64Factors is the highest value that will be checked when removing factors of 10 from an int64. - // It is also the maximum decimal digits that can be represented with an int64. - maxInt64Factors = 18 -) - -var ( - // Commonly needed big.Int values-- treat as read only! - bigTen = big.NewInt(10) - bigZero = big.NewInt(0) - bigOne = big.NewInt(1) - bigThousand = big.NewInt(1000) - big1024 = big.NewInt(1024) - - // Commonly needed inf.Dec values-- treat as read only! - decZero = inf.NewDec(0, 0) - decOne = inf.NewDec(1, 0) - decMinusOne = inf.NewDec(-1, 0) - decThousand = inf.NewDec(1000, 0) - dec1024 = inf.NewDec(1024, 0) - decMinus1024 = inf.NewDec(-1024, 0) - - // Largest (in magnitude) number allowed. - maxAllowed = infDecAmount{inf.NewDec((1<<63)-1, 0)} // == max int64 - - // The maximum value we can represent milli-units for. - // Compare with the return value of Quantity.Value() to - // see if it's safe to use Quantity.MilliValue(). - MaxMilliValue = int64(((1 << 63) - 1) / 1000) -) - -const mostNegative = -(mostPositive + 1) -const mostPositive = 1<<63 - 1 - -// int64Add returns a+b, or false if that would overflow int64. -func int64Add(a, b int64) (int64, bool) { - c := a + b - switch { - case a > 0 && b > 0: - if c < 0 { - return 0, false - } - case a < 0 && b < 0: - if c > 0 { - return 0, false - } - if a == mostNegative && b == mostNegative { - return 0, false - } - } - return c, true -} - -// int64Multiply returns a*b, or false if that would overflow or underflow int64. -func int64Multiply(a, b int64) (int64, bool) { - if a == 0 || b == 0 || a == 1 || b == 1 { - return a * b, true - } - if a == mostNegative || b == mostNegative { - return 0, false - } - c := a * b - return c, c/b == a -} - -// int64MultiplyScale returns a*b, assuming b is greater than one, or false if that would overflow or underflow int64. -// Use when b is known to be greater than one. -func int64MultiplyScale(a int64, b int64) (int64, bool) { - if a == 0 || a == 1 { - return a * b, true - } - if a == mostNegative && b != 1 { - return 0, false - } - c := a * b - return c, c/b == a -} - -// int64MultiplyScale10 multiplies a by 10, or returns false if that would overflow. This method is faster than -// int64Multiply(a, 10) because the compiler can optimize constant factor multiplication. -func int64MultiplyScale10(a int64) (int64, bool) { - if a == 0 || a == 1 { - return a * 10, true - } - if a == mostNegative { - return 0, false - } - c := a * 10 - return c, c/10 == a -} - -// int64MultiplyScale100 multiplies a by 100, or returns false if that would overflow. This method is faster than -// int64Multiply(a, 100) because the compiler can optimize constant factor multiplication. -func int64MultiplyScale100(a int64) (int64, bool) { - if a == 0 || a == 1 { - return a * 100, true - } - if a == mostNegative { - return 0, false - } - c := a * 100 - return c, c/100 == a -} - -// int64MultiplyScale1000 multiplies a by 1000, or returns false if that would overflow. This method is faster than -// int64Multiply(a, 1000) because the compiler can optimize constant factor multiplication. -func int64MultiplyScale1000(a int64) (int64, bool) { - if a == 0 || a == 1 { - return a * 1000, true - } - if a == mostNegative { - return 0, false - } - c := a * 1000 - return c, c/1000 == a -} - -// positiveScaleInt64 multiplies base by 10^scale, returning false if the -// value overflows. Passing a negative scale is undefined. -func positiveScaleInt64(base int64, scale Scale) (int64, bool) { - switch scale { - case 0: - return base, true - case 1: - return int64MultiplyScale10(base) - case 2: - return int64MultiplyScale100(base) - case 3: - return int64MultiplyScale1000(base) - case 6: - return int64MultiplyScale(base, 1000000) - case 9: - return int64MultiplyScale(base, 1000000000) - default: - value := base - var ok bool - for i := Scale(0); i < scale; i++ { - if value, ok = int64MultiplyScale(value, 10); !ok { - return 0, false - } - } - return value, true - } -} - -// negativeScaleInt64 reduces base by the provided scale, rounding up, until the -// value is zero or the scale is reached. Passing a negative scale is undefined. -// The value returned, if not exact, is rounded away from zero. -func negativeScaleInt64(base int64, scale Scale) (result int64, exact bool) { - if scale == 0 { - return base, true - } - - value := base - var fraction bool - for i := Scale(0); i < scale; i++ { - if !fraction && value%10 != 0 { - fraction = true - } - value = value / 10 - if value == 0 { - if fraction { - if base > 0 { - return 1, false - } - return -1, false - } - return 0, true - } - } - if fraction { - if base > 0 { - value += 1 - } else { - value += -1 - } - } - return value, !fraction -} - -func pow10Int64(b int64) int64 { - switch b { - case 0: - return 1 - case 1: - return 10 - case 2: - return 100 - case 3: - return 1000 - case 4: - return 10000 - case 5: - return 100000 - case 6: - return 1000000 - case 7: - return 10000000 - case 8: - return 100000000 - case 9: - return 1000000000 - case 10: - return 10000000000 - case 11: - return 100000000000 - case 12: - return 1000000000000 - case 13: - return 10000000000000 - case 14: - return 100000000000000 - case 15: - return 1000000000000000 - case 16: - return 10000000000000000 - case 17: - return 100000000000000000 - case 18: - return 1000000000000000000 - default: - return 0 - } -} - -// powInt64 raises a to the bth power. Is not overflow aware. -func powInt64(a, b int64) int64 { - p := int64(1) - for b > 0 { - if b&1 != 0 { - p *= a - } - b >>= 1 - a *= a - } - return p -} - -// negativeScaleInt64 returns the result of dividing base by scale * 10 and the remainder, or -// false if no such division is possible. Dividing by negative scales is undefined. -func divideByScaleInt64(base int64, scale Scale) (result, remainder int64, exact bool) { - if scale == 0 { - return base, 0, true - } - // the max scale representable in base 10 in an int64 is 18 decimal places - if scale >= 18 { - return 0, base, false - } - divisor := pow10Int64(int64(scale)) - return base / divisor, base % divisor, true -} - -// removeInt64Factors divides in a loop; the return values have the property that -// value == result * base ^ scale -func removeInt64Factors(value int64, base int64) (result int64, times int32) { - times = 0 - result = value - negative := result < 0 - if negative { - result = -result - } - switch base { - // allow the compiler to optimize the common cases - case 10: - for result >= 10 && result%10 == 0 { - times++ - result = result / 10 - } - // allow the compiler to optimize the common cases - case 1024: - for result >= 1024 && result%1024 == 0 { - times++ - result = result / 1024 - } - default: - for result >= base && result%base == 0 { - times++ - result = result / base - } - } - if negative { - result = -result - } - return result, times -} - -// removeBigIntFactors divides in a loop; the return values have the property that -// d == result * factor ^ times -// d may be modified in place. -// If d == 0, then the return values will be (0, 0) -func removeBigIntFactors(d, factor *big.Int) (result *big.Int, times int32) { - q := big.NewInt(0) - m := big.NewInt(0) - for d.Cmp(bigZero) != 0 { - q.DivMod(d, factor, m) - if m.Cmp(bigZero) != 0 { - break - } - times++ - d, q = q, d - } - return d, times -} diff --git a/vendor/github.com/appc/spec/schema/types/resource/quantity.go b/vendor/github.com/appc/spec/schema/types/resource/quantity.go deleted file mode 100644 index 96877b4c946f..000000000000 --- a/vendor/github.com/appc/spec/schema/types/resource/quantity.go +++ /dev/null @@ -1,768 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package resource - -import ( - "bytes" - "errors" - "fmt" - "math/big" - "regexp" - "strconv" - "strings" - - flag "github.com/spf13/pflag" - - inf "gopkg.in/inf.v0" -) - -// Quantity is a fixed-point representation of a number. -// It provides convenient marshaling/unmarshaling in JSON and YAML, -// in addition to String() and Int64() accessors. -// -// The serialization format is: -// -// ::= -// (Note that may be empty, from the "" case in .) -// ::= 0 | 1 | ... | 9 -// ::= | -// ::= | . | . | . -// ::= "+" | "-" -// ::= | -// ::= | | -// ::= Ki | Mi | Gi | Ti | Pi | Ei -// (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) -// ::= m | "" | k | M | G | T | P | E -// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) -// ::= "e" | "E" -// -// No matter which of the three exponent forms is used, no quantity may represent -// a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal -// places. Numbers larger or more precise will be capped or rounded up. -// (E.g.: 0.1m will rounded up to 1m.) -// This may be extended in the future if we require larger or smaller quantities. -// -// When a Quantity is parsed from a string, it will remember the type of suffix -// it had, and will use the same type again when it is serialized. -// -// Before serializing, Quantity will be put in "canonical form". -// This means that Exponent/suffix will be adjusted up or down (with a -// corresponding increase or decrease in Mantissa) such that: -// a. No precision is lost -// b. No fractional digits will be emitted -// c. The exponent (or suffix) is as large as possible. -// The sign will be omitted unless the number is negative. -// -// Examples: -// 1.5 will be serialized as "1500m" -// 1.5Gi will be serialized as "1536Mi" -// -// NOTE: We reserve the right to amend this canonical format, perhaps to -// allow 1.5 to be canonical. -// TODO: Remove above disclaimer after all bikeshedding about format is over, -// or after March 2015. -// -// Note that the quantity will NEVER be internally represented by a -// floating point number. That is the whole point of this exercise. -// -// Non-canonical values will still parse as long as they are well formed, -// but will be re-emitted in their canonical form. (So always use canonical -// form, or don't diff.) -// -// This format is intended to make it difficult to use these numbers without -// writing some sort of special handling code in the hopes that that will -// cause implementors to also use a fixed point implementation. -// -// +gencopy=false -// +protobuf=true -// +protobuf.embed=string -// +protobuf.options.marshal=false -// +protobuf.options.(gogoproto.goproto_stringer)=false -type Quantity struct { - // i is the quantity in int64 scaled form, if d.Dec == nil - i int64Amount - // d is the quantity in inf.Dec form if d.Dec != nil - d infDecAmount - // s is the generated value of this quantity to avoid recalculation - s string - - // Change Format at will. See the comment for Canonicalize for - // more details. - Format -} - -// CanonicalValue allows a quantity amount to be converted to a string. -type CanonicalValue interface { - // AsCanonicalBytes returns a byte array representing the string representation - // of the value mantissa and an int32 representing its exponent in base-10. Callers may - // pass a byte slice to the method to avoid allocations. - AsCanonicalBytes(out []byte) ([]byte, int32) - // AsCanonicalBase1024Bytes returns a byte array representing the string representation - // of the value mantissa and an int32 representing its exponent in base-1024. Callers - // may pass a byte slice to the method to avoid allocations. - AsCanonicalBase1024Bytes(out []byte) ([]byte, int32) -} - -// Format lists the three possible formattings of a quantity. -type Format string - -const ( - DecimalExponent = Format("DecimalExponent") // e.g., 12e6 - BinarySI = Format("BinarySI") // e.g., 12Mi (12 * 2^20) - DecimalSI = Format("DecimalSI") // e.g., 12M (12 * 10^6) -) - -// MustParse turns the given string into a quantity or panics; for tests -// or others cases where you know the string is valid. -func MustParse(str string) Quantity { - q, err := ParseQuantity(str) - if err != nil { - panic(fmt.Errorf("cannot parse '%v': %v", str, err)) - } - return q -} - -const ( - // splitREString is used to separate a number from its suffix; as such, - // this is overly permissive, but that's OK-- it will be checked later. - splitREString = "^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$" -) - -var ( - // splitRE is used to get the various parts of a number. - splitRE = regexp.MustCompile(splitREString) - - // Errors that could happen while parsing a string. - ErrFormatWrong = errors.New("quantities must match the regular expression '" + splitREString + "'") - ErrNumeric = errors.New("unable to parse numeric part of quantity") - ErrSuffix = errors.New("unable to parse quantity's suffix") -) - -// parseQuantityString is a fast scanner for quantity values. -func parseQuantityString(str string) (positive bool, value, num, denom, suffix string, err error) { - positive = true - pos := 0 - end := len(str) - - // handle leading sign - if pos < end { - switch str[0] { - case '-': - positive = false - pos++ - case '+': - pos++ - } - } - - // strip leading zeros -Zeroes: - for i := pos; ; i++ { - if i >= end { - num = "0" - value = num - return - } - switch str[i] { - case '0': - pos++ - default: - break Zeroes - } - } - - // extract the numerator -Num: - for i := pos; ; i++ { - if i >= end { - num = str[pos:end] - value = str[0:end] - return - } - switch str[i] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - default: - num = str[pos:i] - pos = i - break Num - } - } - - // if we stripped all numerator positions, always return 0 - if len(num) == 0 { - num = "0" - } - - // handle a denominator - if pos < end && str[pos] == '.' { - pos++ - Denom: - for i := pos; ; i++ { - if i >= end { - denom = str[pos:end] - value = str[0:end] - return - } - switch str[i] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - default: - denom = str[pos:i] - pos = i - break Denom - } - } - // TODO: we currently allow 1.G, but we may not want to in the future. - // if len(denom) == 0 { - // err = ErrFormatWrong - // return - // } - } - value = str[0:pos] - - // grab the elements of the suffix - suffixStart := pos - for i := pos; ; i++ { - if i >= end { - suffix = str[suffixStart:end] - return - } - if !strings.ContainsAny(str[i:i+1], "eEinumkKMGTP") { - pos = i - break - } - } - if pos < end { - switch str[pos] { - case '-', '+': - pos++ - } - } -Suffix: - for i := pos; ; i++ { - if i >= end { - suffix = str[suffixStart:end] - return - } - switch str[i] { - case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - default: - break Suffix - } - } - // we encountered a non decimal in the Suffix loop, but the last character - // was not a valid exponent - err = ErrFormatWrong - return -} - -// ParseQuantity turns str into a Quantity, or returns an error. -func ParseQuantity(str string) (Quantity, error) { - if len(str) == 0 { - return Quantity{}, ErrFormatWrong - } - if str == "0" { - return Quantity{Format: DecimalSI, s: str}, nil - } - - positive, value, num, denom, suf, err := parseQuantityString(str) - if err != nil { - return Quantity{}, err - } - - base, exponent, format, ok := quantitySuffixer.interpret(suffix(suf)) - if !ok { - return Quantity{}, ErrSuffix - } - - precision := int32(0) - scale := int32(0) - mantissa := int64(1) - switch format { - case DecimalExponent, DecimalSI: - scale = exponent - precision = maxInt64Factors - int32(len(num)+len(denom)) - case BinarySI: - scale = 0 - switch { - case exponent >= 0 && len(denom) == 0: - // only handle positive binary numbers with the fast path - mantissa = int64(int64(mantissa) << uint64(exponent)) - // 1Mi (2^20) has ~6 digits of decimal precision, so exponent*3/10 -1 is roughly the precision - precision = 15 - int32(len(num)) - int32(float32(exponent)*3/10) - 1 - default: - precision = -1 - } - } - - if precision >= 0 { - // if we have a denominator, shift the entire value to the left by the number of places in the - // denominator - scale -= int32(len(denom)) - if scale >= int32(Nano) { - shifted := num + denom - - var value int64 - value, err := strconv.ParseInt(shifted, 10, 64) - if err != nil { - return Quantity{}, ErrNumeric - } - if result, ok := int64Multiply(value, int64(mantissa)); ok { - if !positive { - result = -result - } - // if the number is in canonical form, reuse the string - switch format { - case BinarySI: - if exponent%10 == 0 && (value&0x07 != 0) { - return Quantity{i: int64Amount{value: result, scale: Scale(scale)}, Format: format, s: str}, nil - } - default: - if scale%3 == 0 && !strings.HasSuffix(shifted, "000") && shifted[0] != '0' { - return Quantity{i: int64Amount{value: result, scale: Scale(scale)}, Format: format, s: str}, nil - } - } - return Quantity{i: int64Amount{value: result, scale: Scale(scale)}, Format: format}, nil - } - } - } - - amount := new(inf.Dec) - if _, ok := amount.SetString(value); !ok { - return Quantity{}, ErrNumeric - } - - // So that no one but us has to think about suffixes, remove it. - if base == 10 { - amount.SetScale(amount.Scale() + Scale(exponent).infScale()) - } else if base == 2 { - // numericSuffix = 2 ** exponent - numericSuffix := big.NewInt(1).Lsh(bigOne, uint(exponent)) - ub := amount.UnscaledBig() - amount.SetUnscaledBig(ub.Mul(ub, numericSuffix)) - } - - // Cap at min/max bounds. - sign := amount.Sign() - if sign == -1 { - amount.Neg(amount) - } - - // This rounds non-zero values up to the minimum representable value, under the theory that - // if you want some resources, you should get some resources, even if you asked for way too small - // of an amount. Arguably, this should be inf.RoundHalfUp (normal rounding), but that would have - // the side effect of rounding values < .5n to zero. - if v, ok := amount.Unscaled(); v != int64(0) || !ok { - amount.Round(amount, Nano.infScale(), inf.RoundUp) - } - - // The max is just a simple cap. - // TODO: this prevents accumulating quantities greater than int64, for instance quota across a cluster - if format == BinarySI && amount.Cmp(maxAllowed.Dec) > 0 { - amount.Set(maxAllowed.Dec) - } - - if format == BinarySI && amount.Cmp(decOne) < 0 && amount.Cmp(decZero) > 0 { - // This avoids rounding and hopefully confusion, too. - format = DecimalSI - } - if sign == -1 { - amount.Neg(amount) - } - - return Quantity{d: infDecAmount{amount}, Format: format}, nil -} - -// CanonicalizeBytes returns the canonical form of q and its suffix (see comment on Quantity). -// -// Note about BinarySI: -// * If q.Format is set to BinarySI and q.Amount represents a non-zero value between -// -1 and +1, it will be emitted as if q.Format were DecimalSI. -// * Otherwise, if q.Format is set to BinarySI, frational parts of q.Amount will be -// rounded up. (1.1i becomes 2i.) -func (q *Quantity) CanonicalizeBytes(out []byte) (result, suffix []byte) { - if q.IsZero() { - return zeroBytes, nil - } - - var rounded CanonicalValue - format := q.Format - switch format { - case DecimalExponent, DecimalSI: - case BinarySI: - if q.CmpInt64(-1024) > 0 && q.CmpInt64(1024) < 0 { - // This avoids rounding and hopefully confusion, too. - format = DecimalSI - } else { - var exact bool - if rounded, exact = q.AsScale(0); !exact { - // Don't lose precision-- show as DecimalSI - format = DecimalSI - } - } - default: - format = DecimalExponent - } - - // TODO: If BinarySI formatting is requested but would cause rounding, upgrade to - // one of the other formats. - switch format { - case DecimalExponent, DecimalSI: - number, exponent := q.AsCanonicalBytes(out) - suffix, _ := quantitySuffixer.constructBytes(10, exponent, format) - return number, suffix - default: - // format must be BinarySI - number, exponent := rounded.AsCanonicalBase1024Bytes(out) - suffix, _ := quantitySuffixer.constructBytes(2, exponent*10, format) - return number, suffix - } -} - -// AsInt64 returns a representation of the current value as an int64 if a fast conversion -// is possible. If false is returned, callers must use the inf.Dec form of this quantity. -func (q *Quantity) AsInt64() (int64, bool) { - if q.d.Dec != nil { - return 0, false - } - return q.i.AsInt64() -} - -// ToDec promotes the quantity in place to use an inf.Dec representation and returns itself. -func (q *Quantity) ToDec() *Quantity { - if q.d.Dec == nil { - q.d.Dec = q.i.AsDec() - q.i = int64Amount{} - } - return q -} - -// AsDec returns the quantity as represented by a scaled inf.Dec. -func (q *Quantity) AsDec() *inf.Dec { - if q.d.Dec != nil { - return q.d.Dec - } - q.d.Dec = q.i.AsDec() - q.i = int64Amount{} - return q.d.Dec -} - -// AsCanonicalBytes returns the canonical byte representation of this quantity as a mantissa -// and base 10 exponent. The out byte slice may be passed to the method to avoid an extra -// allocation. -func (q *Quantity) AsCanonicalBytes(out []byte) (result []byte, exponent int32) { - if q.d.Dec != nil { - return q.d.AsCanonicalBytes(out) - } - return q.i.AsCanonicalBytes(out) -} - -// IsZero returns true if the quantity is equal to zero. -func (q *Quantity) IsZero() bool { - if q.d.Dec != nil { - return q.d.Dec.Sign() == 0 - } - return q.i.value == 0 -} - -// Sign returns 0 if the quantity is zero, -1 if the quantity is less than zero, or 1 if the -// quantity is greater than zero. -func (q *Quantity) Sign() int { - if q.d.Dec != nil { - return q.d.Dec.Sign() - } - return q.i.Sign() -} - -// AsScaled returns the current value, rounded up to the provided scale, and returns -// false if the scale resulted in a loss of precision. -func (q *Quantity) AsScale(scale Scale) (CanonicalValue, bool) { - if q.d.Dec != nil { - return q.d.AsScale(scale) - } - return q.i.AsScale(scale) -} - -// RoundUp updates the quantity to the provided scale, ensuring that the value is at -// least 1. False is returned if the rounding operation resulted in a loss of precision. -// Negative numbers are rounded away from zero (-9 scale 1 rounds to -10). -func (q *Quantity) RoundUp(scale Scale) bool { - if q.d.Dec != nil { - q.s = "" - d, exact := q.d.AsScale(scale) - q.d = d - return exact - } - // avoid clearing the string value if we have already calculated it - if q.i.scale >= scale { - return true - } - q.s = "" - i, exact := q.i.AsScale(scale) - q.i = i - return exact -} - -// Add adds the provide y quantity to the current value. If the current value is zero, -// the format of the quantity will be updated to the format of y. -func (q *Quantity) Add(y Quantity) { - q.s = "" - if q.d.Dec == nil && y.d.Dec == nil { - if q.i.value == 0 { - q.Format = y.Format - } - if q.i.Add(y.i) { - return - } - } else if q.IsZero() { - q.Format = y.Format - } - q.ToDec().d.Dec.Add(q.d.Dec, y.AsDec()) -} - -// Sub subtracts the provided quantity from the current value in place. If the current -// value is zero, the format of the quantity will be updated to the format of y. -func (q *Quantity) Sub(y Quantity) { - q.s = "" - if q.IsZero() { - q.Format = y.Format - } - if q.d.Dec == nil && y.d.Dec == nil && q.i.Sub(y.i) { - return - } - q.ToDec().d.Dec.Sub(q.d.Dec, y.AsDec()) -} - -// Cmp returns 0 if the quantity is equal to y, -1 if the quantity is less than y, or 1 if the -// quantity is greater than y. -func (q *Quantity) Cmp(y Quantity) int { - if q.d.Dec == nil && y.d.Dec == nil { - return q.i.Cmp(y.i) - } - return q.AsDec().Cmp(y.AsDec()) -} - -// CmpInt64 returns 0 if the quantity is equal to y, -1 if the quantity is less than y, or 1 if the -// quantity is greater than y. -func (q *Quantity) CmpInt64(y int64) int { - if q.d.Dec != nil { - return q.d.Dec.Cmp(inf.NewDec(y, inf.Scale(0))) - } - return q.i.Cmp(int64Amount{value: y}) -} - -// Neg sets quantity to be the negative value of itself. -func (q *Quantity) Neg() { - q.s = "" - if q.d.Dec == nil { - q.i.value = -q.i.value - return - } - q.d.Dec.Neg(q.d.Dec) -} - -// int64QuantityExpectedBytes is the expected width in bytes of the canonical string representation -// of most Quantity values. -const int64QuantityExpectedBytes = 18 - -// String formats the Quantity as a string, caching the result if not calculated. -// String is an expensive operation and caching this result significantly reduces the cost of -// normal parse / marshal operations on Quantity. -func (q *Quantity) String() string { - if len(q.s) == 0 { - result := make([]byte, 0, int64QuantityExpectedBytes) - number, suffix := q.CanonicalizeBytes(result) - number = append(number, suffix...) - q.s = string(number) - } - return q.s -} - -// MarshalJSON implements the json.Marshaller interface. -func (q Quantity) MarshalJSON() ([]byte, error) { - if len(q.s) > 0 { - out := make([]byte, len(q.s)+2) - out[0], out[len(out)-1] = '"', '"' - copy(out[1:], q.s) - return out, nil - } - result := make([]byte, int64QuantityExpectedBytes, int64QuantityExpectedBytes) - result[0] = '"' - number, suffix := q.CanonicalizeBytes(result[1:1]) - // if the same slice was returned to us that we passed in, avoid another allocation by copying number into - // the source slice and returning that - if len(number) > 0 && &number[0] == &result[1] && (len(number)+len(suffix)+2) <= int64QuantityExpectedBytes { - number = append(number, suffix...) - number = append(number, '"') - return result[:1+len(number)], nil - } - // if CanonicalizeBytes needed more space than our slice provided, we may need to allocate again so use - // append - result = result[:1] - result = append(result, number...) - result = append(result, suffix...) - result = append(result, '"') - return result, nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface. -// TODO: Remove support for leading/trailing whitespace -func (q *Quantity) UnmarshalJSON(value []byte) error { - l := len(value) - if l == 4 && bytes.Equal(value, []byte("null")) { - q.d.Dec = nil - q.i = int64Amount{} - return nil - } - if l >= 2 && value[0] == '"' && value[l-1] == '"' { - value = value[1 : l-1] - } - - parsed, err := ParseQuantity(strings.TrimSpace(string(value))) - if err != nil { - return err - } - - // This copy is safe because parsed will not be referred to again. - *q = parsed - return nil -} - -// NewQuantity returns a new Quantity representing the given -// value in the given format. -func NewQuantity(value int64, format Format) *Quantity { - return &Quantity{ - i: int64Amount{value: value}, - Format: format, - } -} - -// NewMilliQuantity returns a new Quantity representing the given -// value * 1/1000 in the given format. Note that BinarySI formatting -// will round fractional values, and will be changed to DecimalSI for -// values x where (-1 < x < 1) && (x != 0). -func NewMilliQuantity(value int64, format Format) *Quantity { - return &Quantity{ - i: int64Amount{value: value, scale: -3}, - Format: format, - } -} - -// NewScaledQuantity returns a new Quantity representing the given -// value * 10^scale in DecimalSI format. -func NewScaledQuantity(value int64, scale Scale) *Quantity { - return &Quantity{ - i: int64Amount{value: value, scale: scale}, - Format: DecimalSI, - } -} - -// Value returns the value of q; any fractional part will be lost. -func (q *Quantity) Value() int64 { - return q.ScaledValue(0) -} - -// MilliValue returns the value of ceil(q * 1000); this could overflow an int64; -// if that's a concern, call Value() first to verify the number is small enough. -func (q *Quantity) MilliValue() int64 { - return q.ScaledValue(Milli) -} - -// ScaledValue returns the value of ceil(q * 10^scale); this could overflow an int64. -// To detect overflow, call Value() first and verify the expected magnitude. -func (q *Quantity) ScaledValue(scale Scale) int64 { - if q.d.Dec == nil { - i, _ := q.i.AsScaledInt64(scale) - return i - } - dec := q.d.Dec - return scaledValue(dec.UnscaledBig(), int(dec.Scale()), int(scale.infScale())) -} - -// Set sets q's value to be value. -func (q *Quantity) Set(value int64) { - q.SetScaled(value, 0) -} - -// SetMilli sets q's value to be value * 1/1000. -func (q *Quantity) SetMilli(value int64) { - q.SetScaled(value, Milli) -} - -// SetScaled sets q's value to be value * 10^scale -func (q *Quantity) SetScaled(value int64, scale Scale) { - q.s = "" - q.d.Dec = nil - q.i = int64Amount{value: value, scale: scale} -} - -// Copy is a convenience function that makes a deep copy for you. Non-deep -// copies of quantities share pointers and you will regret that. -func (q *Quantity) Copy() *Quantity { - if q.d.Dec == nil { - return &Quantity{ - s: q.s, - i: q.i, - Format: q.Format, - } - } - tmp := &inf.Dec{} - return &Quantity{ - s: q.s, - d: infDecAmount{tmp.Set(q.d.Dec)}, - Format: q.Format, - } -} - -// qFlag is a helper type for the Flag function -type qFlag struct { - dest *Quantity -} - -// Sets the value of the internal Quantity. (used by flag & pflag) -func (qf qFlag) Set(val string) error { - q, err := ParseQuantity(val) - if err != nil { - return err - } - // This copy is OK because q will not be referenced again. - *qf.dest = q - return nil -} - -// Converts the value of the internal Quantity to a string. (used by flag & pflag) -func (qf qFlag) String() string { - return qf.dest.String() -} - -// States the type of flag this is (Quantity). (used by pflag) -func (qf qFlag) Type() string { - return "quantity" -} - -// QuantityFlag is a helper that makes a quantity flag (using standard flag package). -// Will panic if defaultValue is not a valid quantity. -func QuantityFlag(flagName, defaultValue, description string) *Quantity { - q := MustParse(defaultValue) - flag.Var(NewQuantityFlagValue(&q), flagName, description) - return &q -} - -// NewQuantityFlagValue returns an object that can be used to back a flag, -// pointing at the given Quantity variable. -func NewQuantityFlagValue(q *Quantity) flag.Value { - return qFlag{q} -} diff --git a/vendor/github.com/appc/spec/schema/types/resource/scale_int.go b/vendor/github.com/appc/spec/schema/types/resource/scale_int.go deleted file mode 100644 index 173de1a2171d..000000000000 --- a/vendor/github.com/appc/spec/schema/types/resource/scale_int.go +++ /dev/null @@ -1,95 +0,0 @@ -/* -Copyright 2015 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package resource - -import ( - "math" - "math/big" - "sync" -) - -var ( - // A sync pool to reduce allocation. - intPool sync.Pool - maxInt64 = big.NewInt(math.MaxInt64) -) - -func init() { - intPool.New = func() interface{} { - return &big.Int{} - } -} - -// scaledValue scales given unscaled value from scale to new Scale and returns -// an int64. It ALWAYS rounds up the result when scale down. The final result might -// overflow. -// -// scale, newScale represents the scale of the unscaled decimal. -// The mathematical value of the decimal is unscaled * 10**(-scale). -func scaledValue(unscaled *big.Int, scale, newScale int) int64 { - dif := scale - newScale - if dif == 0 { - return unscaled.Int64() - } - - // Handle scale up - // This is an easy case, we do not need to care about rounding and overflow. - // If any intermediate operation causes overflow, the result will overflow. - if dif < 0 { - return unscaled.Int64() * int64(math.Pow10(-dif)) - } - - // Handle scale down - // We have to be careful about the intermediate operations. - - // fast path when unscaled < max.Int64 and exp(10,dif) < max.Int64 - const log10MaxInt64 = 19 - if unscaled.Cmp(maxInt64) < 0 && dif < log10MaxInt64 { - divide := int64(math.Pow10(dif)) - result := unscaled.Int64() / divide - mod := unscaled.Int64() % divide - if mod != 0 { - return result + 1 - } - return result - } - - // We should only convert back to int64 when getting the result. - divisor := intPool.Get().(*big.Int) - exp := intPool.Get().(*big.Int) - result := intPool.Get().(*big.Int) - defer func() { - intPool.Put(divisor) - intPool.Put(exp) - intPool.Put(result) - }() - - // divisor = 10^(dif) - // TODO: create loop up table if exp costs too much. - divisor.Exp(bigTen, exp.SetInt64(int64(dif)), nil) - // reuse exp - remainder := exp - - // result = unscaled / divisor - // remainder = unscaled % divisor - result.DivMod(unscaled, divisor, remainder) - if remainder.Sign() != 0 { - return result.Int64() + 1 - } - - return result.Int64() -} diff --git a/vendor/github.com/appc/spec/schema/types/resource/suffix.go b/vendor/github.com/appc/spec/schema/types/resource/suffix.go deleted file mode 100644 index 0aa2ce2bf60e..000000000000 --- a/vendor/github.com/appc/spec/schema/types/resource/suffix.go +++ /dev/null @@ -1,198 +0,0 @@ -/* -Copyright 2014 The Kubernetes Authors All rights reserved. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package resource - -import ( - "strconv" -) - -type suffix string - -// suffixer can interpret and construct suffixes. -type suffixer interface { - interpret(suffix) (base, exponent int32, fmt Format, ok bool) - construct(base, exponent int32, fmt Format) (s suffix, ok bool) - constructBytes(base, exponent int32, fmt Format) (s []byte, ok bool) -} - -// quantitySuffixer handles suffixes for all three formats that quantity -// can handle. -var quantitySuffixer = newSuffixer() - -type bePair struct { - base, exponent int32 -} - -type listSuffixer struct { - suffixToBE map[suffix]bePair - beToSuffix map[bePair]suffix - beToSuffixBytes map[bePair][]byte -} - -func (ls *listSuffixer) addSuffix(s suffix, pair bePair) { - if ls.suffixToBE == nil { - ls.suffixToBE = map[suffix]bePair{} - } - if ls.beToSuffix == nil { - ls.beToSuffix = map[bePair]suffix{} - } - if ls.beToSuffixBytes == nil { - ls.beToSuffixBytes = map[bePair][]byte{} - } - ls.suffixToBE[s] = pair - ls.beToSuffix[pair] = s - ls.beToSuffixBytes[pair] = []byte(s) -} - -func (ls *listSuffixer) lookup(s suffix) (base, exponent int32, ok bool) { - pair, ok := ls.suffixToBE[s] - if !ok { - return 0, 0, false - } - return pair.base, pair.exponent, true -} - -func (ls *listSuffixer) construct(base, exponent int32) (s suffix, ok bool) { - s, ok = ls.beToSuffix[bePair{base, exponent}] - return -} - -func (ls *listSuffixer) constructBytes(base, exponent int32) (s []byte, ok bool) { - s, ok = ls.beToSuffixBytes[bePair{base, exponent}] - return -} - -type suffixHandler struct { - decSuffixes listSuffixer - binSuffixes listSuffixer -} - -type fastLookup struct { - *suffixHandler -} - -func (l fastLookup) interpret(s suffix) (base, exponent int32, format Format, ok bool) { - switch s { - case "": - return 10, 0, DecimalSI, true - case "n": - return 10, -9, DecimalSI, true - case "u": - return 10, -6, DecimalSI, true - case "m": - return 10, -3, DecimalSI, true - case "k": - return 10, 3, DecimalSI, true - case "M": - return 10, 6, DecimalSI, true - case "G": - return 10, 9, DecimalSI, true - } - return l.suffixHandler.interpret(s) -} - -func newSuffixer() suffixer { - sh := &suffixHandler{} - - // IMPORTANT: if you change this section you must change fastLookup - - sh.binSuffixes.addSuffix("Ki", bePair{2, 10}) - sh.binSuffixes.addSuffix("Mi", bePair{2, 20}) - sh.binSuffixes.addSuffix("Gi", bePair{2, 30}) - sh.binSuffixes.addSuffix("Ti", bePair{2, 40}) - sh.binSuffixes.addSuffix("Pi", bePair{2, 50}) - sh.binSuffixes.addSuffix("Ei", bePair{2, 60}) - // Don't emit an error when trying to produce - // a suffix for 2^0. - sh.decSuffixes.addSuffix("", bePair{2, 0}) - - sh.decSuffixes.addSuffix("n", bePair{10, -9}) - sh.decSuffixes.addSuffix("u", bePair{10, -6}) - sh.decSuffixes.addSuffix("m", bePair{10, -3}) - sh.decSuffixes.addSuffix("", bePair{10, 0}) - sh.decSuffixes.addSuffix("k", bePair{10, 3}) - sh.decSuffixes.addSuffix("M", bePair{10, 6}) - sh.decSuffixes.addSuffix("G", bePair{10, 9}) - sh.decSuffixes.addSuffix("T", bePair{10, 12}) - sh.decSuffixes.addSuffix("P", bePair{10, 15}) - sh.decSuffixes.addSuffix("E", bePair{10, 18}) - - return fastLookup{sh} -} - -func (sh *suffixHandler) construct(base, exponent int32, fmt Format) (s suffix, ok bool) { - switch fmt { - case DecimalSI: - return sh.decSuffixes.construct(base, exponent) - case BinarySI: - return sh.binSuffixes.construct(base, exponent) - case DecimalExponent: - if base != 10 { - return "", false - } - if exponent == 0 { - return "", true - } - return suffix("e" + strconv.FormatInt(int64(exponent), 10)), true - } - return "", false -} - -func (sh *suffixHandler) constructBytes(base, exponent int32, format Format) (s []byte, ok bool) { - switch format { - case DecimalSI: - return sh.decSuffixes.constructBytes(base, exponent) - case BinarySI: - return sh.binSuffixes.constructBytes(base, exponent) - case DecimalExponent: - if base != 10 { - return nil, false - } - if exponent == 0 { - return nil, true - } - result := make([]byte, 8, 8) - result[0] = 'e' - number := strconv.AppendInt(result[1:1], int64(exponent), 10) - if &result[1] == &number[0] { - return result[:1+len(number)], true - } - result = append(result[:1], number...) - return result, true - } - return nil, false -} - -func (sh *suffixHandler) interpret(suffix suffix) (base, exponent int32, fmt Format, ok bool) { - // Try lookup tables first - if b, e, ok := sh.decSuffixes.lookup(suffix); ok { - return b, e, DecimalSI, true - } - if b, e, ok := sh.binSuffixes.lookup(suffix); ok { - return b, e, BinarySI, true - } - - if len(suffix) > 1 && (suffix[0] == 'E' || suffix[0] == 'e') { - parsed, err := strconv.ParseInt(string(suffix[1:]), 10, 64) - if err != nil { - return 0, 0, DecimalExponent, false - } - return 10, int32(parsed), DecimalExponent, true - } - - return 0, 0, DecimalExponent, false -} diff --git a/vendor/github.com/appc/spec/schema/types/semver.go b/vendor/github.com/appc/spec/schema/types/semver.go deleted file mode 100644 index 0008181a5ec3..000000000000 --- a/vendor/github.com/appc/spec/schema/types/semver.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - - "github.com/coreos/go-semver/semver" -) - -var ( - ErrNoZeroSemVer = ACVersionError("SemVer cannot be zero") - ErrBadSemVer = ACVersionError("SemVer is bad") -) - -// SemVer implements the Unmarshaler interface to define a field that must be -// a semantic version string -// TODO(jonboulle): extend upstream instead of wrapping? -type SemVer semver.Version - -// NewSemVer generates a new SemVer from a string. If the given string does -// not represent a valid SemVer, nil and an error are returned. -func NewSemVer(s string) (*SemVer, error) { - nsv, err := semver.NewVersion(s) - if err != nil { - return nil, ErrBadSemVer - } - v := SemVer(*nsv) - if v.Empty() { - return nil, ErrNoZeroSemVer - } - return &v, nil -} - -func (sv SemVer) LessThanMajor(versionB SemVer) bool { - majorA := semver.Version(sv).Major - majorB := semver.Version(versionB).Major - if majorA < majorB { - return true - } - return false -} - -func (sv SemVer) LessThanExact(versionB SemVer) bool { - vA := semver.Version(sv) - vB := semver.Version(versionB) - return vA.LessThan(vB) -} - -func (sv SemVer) String() string { - s := semver.Version(sv) - return s.String() -} - -func (sv SemVer) Empty() bool { - return semver.Version(sv) == semver.Version{} -} - -// UnmarshalJSON implements the json.Unmarshaler interface -func (sv *SemVer) UnmarshalJSON(data []byte) error { - var s string - if err := json.Unmarshal(data, &s); err != nil { - return err - } - v, err := NewSemVer(s) - if err != nil { - return err - } - *sv = *v - return nil -} - -// MarshalJSON implements the json.Marshaler interface -func (sv SemVer) MarshalJSON() ([]byte, error) { - if sv.Empty() { - return nil, ErrNoZeroSemVer - } - return json.Marshal(sv.String()) -} diff --git a/vendor/github.com/appc/spec/schema/types/url.go b/vendor/github.com/appc/spec/schema/types/url.go deleted file mode 100644 index d4f8f337da46..000000000000 --- a/vendor/github.com/appc/spec/schema/types/url.go +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "fmt" - "net/url" -) - -// URL wraps url.URL to marshal/unmarshal to/from JSON strings and enforce -// that the scheme is HTTP/HTTPS only -type URL url.URL - -func NewURL(s string) (*URL, error) { - uu, err := url.Parse(s) - if err != nil { - return nil, fmt.Errorf("bad URL: %v", err) - } - nu := URL(*uu) - if err := nu.assertValidScheme(); err != nil { - return nil, err - } - return &nu, nil -} - -func (u URL) String() string { - uu := url.URL(u) - return uu.String() -} - -func (u URL) assertValidScheme() error { - switch u.Scheme { - case "http", "https": - return nil - default: - return fmt.Errorf("bad URL scheme, must be http/https") - } -} - -func (u *URL) UnmarshalJSON(data []byte) error { - var s string - if err := json.Unmarshal(data, &s); err != nil { - return err - } - nu, err := NewURL(s) - if err != nil { - return err - } - *u = *nu - return nil -} - -func (u URL) MarshalJSON() ([]byte, error) { - if err := u.assertValidScheme(); err != nil { - return nil, err - } - return json.Marshal(u.String()) -} diff --git a/vendor/github.com/appc/spec/schema/types/user_annotations.go b/vendor/github.com/appc/spec/schema/types/user_annotations.go deleted file mode 100644 index 63ba434ea5d7..000000000000 --- a/vendor/github.com/appc/spec/schema/types/user_annotations.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The appc 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 types - -// UserAnnotations are arbitrary key-value pairs, to be supplied and interpreted by the user -type UserAnnotations map[string]string diff --git a/vendor/github.com/appc/spec/schema/types/user_labels.go b/vendor/github.com/appc/spec/schema/types/user_labels.go deleted file mode 100644 index 5ed927c9e8eb..000000000000 --- a/vendor/github.com/appc/spec/schema/types/user_labels.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The appc 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 types - -// UserLabels are arbitrary key-value pairs, to be supplied and interpreted by the user -type UserLabels map[string]string diff --git a/vendor/github.com/appc/spec/schema/types/uuid.go b/vendor/github.com/appc/spec/schema/types/uuid.go deleted file mode 100644 index 4925b7606d39..000000000000 --- a/vendor/github.com/appc/spec/schema/types/uuid.go +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/hex" - "encoding/json" - "errors" - "fmt" - "reflect" - "strings" -) - -var ( - ErrNoEmptyUUID = errors.New("UUID cannot be empty") -) - -// UUID encodes an RFC4122-compliant UUID, marshaled to/from a string -// TODO(jonboulle): vendor a package for this? -// TODO(jonboulle): consider more flexibility in input string formats. -// Right now, we only accept: -// "6733C088-A507-4694-AABF-EDBE4FC5266F" -// "6733C088A5074694AABFEDBE4FC5266F" -type UUID [16]byte - -func (u UUID) String() string { - return fmt.Sprintf("%x-%x-%x-%x-%x", u[0:4], u[4:6], u[6:8], u[8:10], u[10:16]) -} - -func (u *UUID) Set(s string) error { - nu, err := NewUUID(s) - if err == nil { - *u = *nu - } - return err -} - -// NewUUID generates a new UUID from the given string. If the string does not -// represent a valid UUID, nil and an error are returned. -func NewUUID(s string) (*UUID, error) { - s = strings.Replace(s, "-", "", -1) - if len(s) != 32 { - return nil, errors.New("bad UUID length != 32") - } - dec, err := hex.DecodeString(s) - if err != nil { - return nil, err - } - var u UUID - for i, b := range dec { - u[i] = b - } - return &u, nil -} - -func (u UUID) Empty() bool { - return reflect.DeepEqual(u, UUID{}) -} - -func (u *UUID) UnmarshalJSON(data []byte) error { - var s string - if err := json.Unmarshal(data, &s); err != nil { - return err - } - uu, err := NewUUID(s) - if uu.Empty() { - return ErrNoEmptyUUID - } - if err == nil { - *u = *uu - } - return err -} - -func (u UUID) MarshalJSON() ([]byte, error) { - if u.Empty() { - return nil, ErrNoEmptyUUID - } - return json.Marshal(u.String()) -} diff --git a/vendor/github.com/appc/spec/schema/types/volume.go b/vendor/github.com/appc/spec/schema/types/volume.go deleted file mode 100644 index 0986a61d25f6..000000000000 --- a/vendor/github.com/appc/spec/schema/types/volume.go +++ /dev/null @@ -1,249 +0,0 @@ -// Copyright 2015 The appc 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 types - -import ( - "encoding/json" - "errors" - "fmt" - "net/url" - "path/filepath" - "strconv" - "strings" - - "github.com/appc/spec/schema/common" -) - -const ( - emptyVolumeDefaultMode = "0755" - emptyVolumeDefaultUID = 0 - emptyVolumeDefaultGID = 0 -) - -// Volume encapsulates a volume which should be mounted into the filesystem -// of all apps in a PodManifest -type Volume struct { - Name ACName `json:"name"` - Kind string `json:"kind"` - - // currently used only by "host" - // TODO(jonboulle): factor out? - Source string `json:"source,omitempty"` - ReadOnly *bool `json:"readOnly,omitempty"` - Recursive *bool `json:"recursive,omitempty"` - - // currently used only by "empty" - Mode *string `json:"mode,omitempty"` - UID *int `json:"uid,omitempty"` - GID *int `json:"gid,omitempty"` -} - -type volume Volume - -func (v Volume) assertValid() error { - if v.Name.Empty() { - return errors.New("name must be set") - } - - switch v.Kind { - case "empty": - if v.Source != "" { - return errors.New("source for empty volume must be empty") - } - if v.Mode == nil { - return errors.New("mode for empty volume must be set") - } - if v.UID == nil { - return errors.New("uid for empty volume must be set") - } - if v.GID == nil { - return errors.New("gid for empty volume must be set") - } - return nil - case "host": - if v.Source == "" { - return errors.New("source for host volume cannot be empty") - } - if v.Mode != nil { - return errors.New("mode for host volume cannot be set") - } - if v.UID != nil { - return errors.New("uid for host volume cannot be set") - } - if v.GID != nil { - return errors.New("gid for host volume cannot be set") - } - if !filepath.IsAbs(v.Source) { - return errors.New("source for host volume must be absolute path") - } - return nil - default: - return errors.New(`unrecognized volume kind: should be one of "empty", "host"`) - } -} - -func (v *Volume) UnmarshalJSON(data []byte) error { - var vv volume - if err := json.Unmarshal(data, &vv); err != nil { - return err - } - nv := Volume(vv) - maybeSetDefaults(&nv) - if err := nv.assertValid(); err != nil { - return err - } - *v = nv - return nil -} - -func (v Volume) MarshalJSON() ([]byte, error) { - if err := v.assertValid(); err != nil { - return nil, err - } - return json.Marshal(volume(v)) -} - -func (v Volume) String() string { - s := []string{ - v.Name.String(), - ",kind=", - v.Kind, - } - if v.Source != "" { - s = append(s, ",source=") - s = append(s, v.Source) - } - if v.ReadOnly != nil { - s = append(s, ",readOnly=") - s = append(s, strconv.FormatBool(*v.ReadOnly)) - } - if v.Recursive != nil { - s = append(s, ",recursive=") - s = append(s, strconv.FormatBool(*v.Recursive)) - } - switch v.Kind { - case "empty": - if *v.Mode != emptyVolumeDefaultMode { - s = append(s, ",mode=") - s = append(s, *v.Mode) - } - if *v.UID != emptyVolumeDefaultUID { - s = append(s, ",uid=") - s = append(s, strconv.Itoa(*v.UID)) - } - if *v.GID != emptyVolumeDefaultGID { - s = append(s, ",gid=") - s = append(s, strconv.Itoa(*v.GID)) - } - } - return strings.Join(s, "") -} - -// VolumeFromString takes a command line volume parameter and returns a volume -// -// Example volume parameters: -// database,kind=host,source=/tmp,readOnly=true,recursive=true -func VolumeFromString(vp string) (*Volume, error) { - vp = "name=" + vp - vpQuery, err := common.MakeQueryString(vp) - if err != nil { - return nil, err - } - - v, err := url.ParseQuery(vpQuery) - if err != nil { - return nil, err - } - return VolumeFromParams(v) -} - -func VolumeFromParams(params map[string][]string) (*Volume, error) { - var vol Volume - for key, val := range params { - val := val - if len(val) > 1 { - return nil, fmt.Errorf("label %s with multiple values %q", key, val) - } - - switch key { - case "name": - acn, err := NewACName(val[0]) - if err != nil { - return nil, err - } - vol.Name = *acn - case "kind": - vol.Kind = val[0] - case "source": - vol.Source = val[0] - case "readOnly": - ro, err := strconv.ParseBool(val[0]) - if err != nil { - return nil, err - } - vol.ReadOnly = &ro - case "recursive": - rec, err := strconv.ParseBool(val[0]) - if err != nil { - return nil, err - } - vol.Recursive = &rec - case "mode": - vol.Mode = &val[0] - case "uid": - u, err := strconv.Atoi(val[0]) - if err != nil { - return nil, err - } - vol.UID = &u - case "gid": - g, err := strconv.Atoi(val[0]) - if err != nil { - return nil, err - } - vol.GID = &g - default: - return nil, fmt.Errorf("unknown volume parameter %q", key) - } - } - - maybeSetDefaults(&vol) - - if err := vol.assertValid(); err != nil { - return nil, err - } - - return &vol, nil -} - -// maybeSetDefaults sets the correct default values for certain fields on a -// Volume if they are not already been set. These fields are not -// pre-populated on all Volumes as the Volume type is polymorphic. -func maybeSetDefaults(vol *Volume) { - if vol.Kind == "empty" { - if vol.Mode == nil { - m := emptyVolumeDefaultMode - vol.Mode = &m - } - if vol.UID == nil { - u := emptyVolumeDefaultUID - vol.UID = &u - } - if vol.GID == nil { - g := emptyVolumeDefaultGID - vol.GID = &g - } - } -} diff --git a/vendor/github.com/appc/spec/schema/version.go b/vendor/github.com/appc/spec/schema/version.go deleted file mode 100644 index 2b55b7cfc7fe..000000000000 --- a/vendor/github.com/appc/spec/schema/version.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The appc 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 schema - -import ( - "github.com/appc/spec/schema/types" -) - -const ( - // version represents the canonical version of the appc spec and tooling. - // For now, the schema and tooling is coupled with the spec itself, so - // this must be kept in sync with the VERSION file in the root of the repo. - version string = "0.8.11" -) - -var ( - // AppContainerVersion is the SemVer representation of version - AppContainerVersion types.SemVer -) - -func init() { - v, err := types.NewSemVer(version) - if err != nil { - panic(err) - } - AppContainerVersion = *v -} diff --git a/vendor/github.com/armon/circbuf/.gitignore b/vendor/github.com/armon/circbuf/.gitignore new file mode 100644 index 000000000000..00268614f045 --- /dev/null +++ b/vendor/github.com/armon/circbuf/.gitignore @@ -0,0 +1,22 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe diff --git a/vendor/github.com/armon/circbuf/LICENSE b/vendor/github.com/armon/circbuf/LICENSE old mode 100755 new mode 100644 diff --git a/vendor/github.com/armon/go-metrics/.gitignore b/vendor/github.com/armon/go-metrics/.gitignore new file mode 100644 index 000000000000..8c03ec112a48 --- /dev/null +++ b/vendor/github.com/armon/go-metrics/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe + +/metrics.out diff --git a/vendor/github.com/armon/go-metrics/.travis.yml b/vendor/github.com/armon/go-metrics/.travis.yml new file mode 100644 index 000000000000..87d230c8d78e --- /dev/null +++ b/vendor/github.com/armon/go-metrics/.travis.yml @@ -0,0 +1,13 @@ +language: go + +go: + - "1.x" + +env: + - GO111MODULE=on + +install: + - go get ./... + +script: + - go test ./... diff --git a/vendor/github.com/armon/go-radix/.gitignore b/vendor/github.com/armon/go-radix/.gitignore new file mode 100644 index 000000000000..00268614f045 --- /dev/null +++ b/vendor/github.com/armon/go-radix/.gitignore @@ -0,0 +1,22 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe diff --git a/vendor/github.com/armon/go-radix/.travis.yml b/vendor/github.com/armon/go-radix/.travis.yml new file mode 100644 index 000000000000..1a0bbea6c774 --- /dev/null +++ b/vendor/github.com/armon/go-radix/.travis.yml @@ -0,0 +1,3 @@ +language: go +go: + - tip diff --git a/vendor/github.com/armon/go-radix/go.mod b/vendor/github.com/armon/go-radix/go.mod new file mode 100644 index 000000000000..4336aa29ea23 --- /dev/null +++ b/vendor/github.com/armon/go-radix/go.mod @@ -0,0 +1 @@ +module github.com/armon/go-radix diff --git a/vendor/github.com/armon/go-radix/radix.go b/vendor/github.com/armon/go-radix/radix.go index d2914c13bf7c..e2bb22eb91d3 100644 --- a/vendor/github.com/armon/go-radix/radix.go +++ b/vendor/github.com/armon/go-radix/radix.go @@ -44,13 +44,13 @@ func (n *node) addEdge(e edge) { n.edges.Sort() } -func (n *node) replaceEdge(e edge) { +func (n *node) updateEdge(label byte, node *node) { num := len(n.edges) idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= e.label + return n.edges[i].label >= label }) - if idx < num && n.edges[idx].label == e.label { - n.edges[idx].node = e.node + if idx < num && n.edges[idx].label == label { + n.edges[idx].node = node return } panic("replacing missing edge") @@ -198,10 +198,7 @@ func (t *Tree) Insert(s string, v interface{}) (interface{}, bool) { child := &node{ prefix: search[:commonPrefix], } - parent.replaceEdge(edge{ - label: search[0], - node: child, - }) + parent.updateEdge(search[0], child) // Restore the existing node child.addEdge(edge{ @@ -292,6 +289,53 @@ DELETE: return leaf.val, true } +// DeletePrefix is used to delete the subtree under a prefix +// Returns how many nodes were deleted +// Use this to delete large subtrees efficiently +func (t *Tree) DeletePrefix(s string) int { + return t.deletePrefix(nil, t.root, s) +} + +// delete does a recursive deletion +func (t *Tree) deletePrefix(parent, n *node, prefix string) int { + // Check for key exhaustion + if len(prefix) == 0 { + // Remove the leaf node + subTreeSize := 0 + //recursively walk from all edges of the node to be deleted + recursiveWalk(n, func(s string, v interface{}) bool { + subTreeSize++ + return false + }) + if n.isLeaf() { + n.leaf = nil + } + n.edges = nil // deletes the entire subtree + + // Check if we should merge the parent's other child + if parent != nil && parent != t.root && len(parent.edges) == 1 && !parent.isLeaf() { + parent.mergeChild() + } + t.size -= subTreeSize + return subTreeSize + } + + // Look for an edge + label := prefix[0] + child := n.getEdge(label) + if child == nil || (!strings.HasPrefix(child.prefix, prefix) && !strings.HasPrefix(prefix, child.prefix)) { + return 0 + } + + // Consume the search prefix + if len(child.prefix) > len(prefix) { + prefix = prefix[len(prefix):] + } else { + prefix = prefix[len(child.prefix):] + } + return t.deletePrefix(n, child, prefix) +} + func (n *node) mergeChild() { e := n.edges[0] child := e.node 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 index e62483600299..1980c8c140a9 100644 --- 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 @@ -90,7 +90,6 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/internal/sdkio" ) const ( @@ -143,7 +142,7 @@ const ( // DefaultBufSize limits buffer size from growing to an enormous // amount due to a faulty process. - DefaultBufSize = int(8 * sdkio.KibiByte) + DefaultBufSize = 1024 // DefaultTimeout default limit on time a process can run. DefaultTimeout = time.Duration(1) * time.Minute 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 12897eef6265..fe25edf88819 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 @@ -31,7 +31,7 @@ func (c *EC2Metadata) getToken(duration time.Duration) (tokenOutput, error) { // Swap the unmarshalMetadataHandler with unmarshalTokenHandler on this request. req.Handlers.Unmarshal.Swap(unmarshalMetadataHandlerName, unmarshalTokenHandler) - ttl := strconv.FormatInt(int64(duration/time.Second), 10) + ttl := strconv.FormatInt(int64(duration / time.Second),10) req.HTTPRequest.Header.Set(ttlHeader, ttl) err := req.Send() @@ -145,17 +145,17 @@ func (c *EC2Metadata) IAMInfo() (EC2IAMInfo, error) { // Region returns the region the instance is running in. func (c *EC2Metadata) Region() (string, error) { - ec2InstanceIdentityDocument, err := c.GetInstanceIdentityDocument() + resp, err := c.GetMetadata("placement/availability-zone") if err != nil { return "", err } - // extract region from the ec2InstanceIdentityDocument - region := ec2InstanceIdentityDocument.Region - if len(region) == 0 { - return "", awserr.New("EC2MetadataError", "invalid region received for ec2metadata instance", nil) + + if len(resp) == 0 { + return "", awserr.New("EC2MetadataError", "invalid Region response", nil) } - // returns region - return region, nil + + // returns region without the suffix. Eg: us-west-2a becomes us-west-2 + return resp[:len(resp)-1], nil } // Available returns if the application has access to the EC2 Metadata service. 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 5eb99c1020d5..0f77e9caeab8 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 @@ -2077,27 +2077,6 @@ var awsPartition = partition{ }, }, }, - "iotsecuredtunneling": 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{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, "iotthingsgraph": service{ Defaults: endpoint{ CredentialScope: credentialScope{ @@ -2754,30 +2733,8 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, - "fips-us-east-1": endpoint{ - Hostname: "pinpoint-fips.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "fips-us-west-2": endpoint{ - Hostname: "pinpoint-fips.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, - "us-east-1": endpoint{ - Hostname: "pinpoint.us-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-east-1", - }, - }, - "us-west-2": endpoint{ - Hostname: "pinpoint.us-west-2.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-west-2", - }, - }, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "polly": service{ @@ -2900,7 +2857,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{}, @@ -3971,7 +3927,6 @@ 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{}, @@ -4026,18 +3981,13 @@ var awsPartition = partition{ Protocols: []string{"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{}, "us-east-1": endpoint{}, "us-east-1-fips": endpoint{ Hostname: "translate-fips.us-east-1.amazonaws.com", @@ -4052,7 +4002,6 @@ var awsPartition = partition{ Region: "us-east-2", }, }, - "us-west-1": endpoint{}, "us-west-2": endpoint{}, "us-west-2-fips": endpoint{ Hostname: "translate-fips.us-west-2.amazonaws.com", 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 9df3ff69327d..f094e263e180 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.25.44" +const SDKVersion = "1.25.41" diff --git a/vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go rename to vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/build.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go rename to vendor/github.com/aws/aws-sdk-go/private/protocol/ec2query/unmarshal.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/ec2/api.go rename to vendor/github.com/aws/aws-sdk-go/service/ec2/api.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/ec2/customizations.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/customizations.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/ec2/customizations.go rename to vendor/github.com/aws/aws-sdk-go/service/ec2/customizations.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/ec2/doc.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/doc.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/ec2/doc.go rename to vendor/github.com/aws/aws-sdk-go/service/ec2/doc.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/ec2/errors.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/errors.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/ec2/errors.go rename to vendor/github.com/aws/aws-sdk-go/service/ec2/errors.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/ec2/service.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/service.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/ec2/service.go rename to vendor/github.com/aws/aws-sdk-go/service/ec2/service.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aws/vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go rename to vendor/github.com/aws/aws-sdk-go/service/ec2/waiters.go diff --git a/vendor/github.com/beorn7/perks/quantile/stream.go b/vendor/github.com/beorn7/perks/quantile/stream.go index f4cabd669567..d7d14f8eb63d 100644 --- a/vendor/github.com/beorn7/perks/quantile/stream.go +++ b/vendor/github.com/beorn7/perks/quantile/stream.go @@ -77,15 +77,20 @@ func NewHighBiased(epsilon float64) *Stream { // is guaranteed to be within (Quantile±Epsilon). // // See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error properties. -func NewTargeted(targets map[float64]float64) *Stream { +func NewTargeted(targetMap map[float64]float64) *Stream { + // Convert map to slice to avoid slow iterations on a map. + // Æ’ is called on the hot path, so converting the map to a slice + // beforehand results in significant CPU savings. + targets := targetMapToSlice(targetMap) + Æ’ := func(s *stream, r float64) float64 { var m = math.MaxFloat64 var f float64 - for quantile, epsilon := range targets { - if quantile*s.n <= r { - f = (2 * epsilon * r) / quantile + for _, t := range targets { + if t.quantile*s.n <= r { + f = (2 * t.epsilon * r) / t.quantile } else { - f = (2 * epsilon * (s.n - r)) / (1 - quantile) + f = (2 * t.epsilon * (s.n - r)) / (1 - t.quantile) } if f < m { m = f @@ -96,6 +101,25 @@ func NewTargeted(targets map[float64]float64) *Stream { return newStream(Æ’) } +type target struct { + quantile float64 + epsilon float64 +} + +func targetMapToSlice(targetMap map[float64]float64) []target { + targets := make([]target, 0, len(targetMap)) + + for quantile, epsilon := range targetMap { + t := target{ + quantile: quantile, + epsilon: epsilon, + } + targets = append(targets, t) + } + + return targets +} + // Stream computes quantiles for a stream of float64s. It is not thread-safe by // design. Take care when using across multiple goroutines. type Stream struct { diff --git a/vendor/github.com/bgentry/speakeasy/.gitignore b/vendor/github.com/bgentry/speakeasy/.gitignore new file mode 100644 index 000000000000..9e1311461eb0 --- /dev/null +++ b/vendor/github.com/bgentry/speakeasy/.gitignore @@ -0,0 +1,2 @@ +example/example +example/example.exe diff --git a/vendor/github.com/bgentry/speakeasy/LICENSE b/vendor/github.com/bgentry/speakeasy/LICENSE new file mode 100644 index 000000000000..37d60fc3541a --- /dev/null +++ b/vendor/github.com/bgentry/speakeasy/LICENSE @@ -0,0 +1,24 @@ +MIT License + +Copyright (c) 2017 Blake Gentry + +This license applies to the non-Windows portions of this library. The Windows +portion maintains its own Apache 2.0 license. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/bgentry/speakeasy/speakeasy.go b/vendor/github.com/bgentry/speakeasy/speakeasy.go index d16233a1a4fb..71c1dd1b969d 100644 --- a/vendor/github.com/bgentry/speakeasy/speakeasy.go +++ b/vendor/github.com/bgentry/speakeasy/speakeasy.go @@ -14,16 +14,18 @@ func Ask(prompt string) (password string, err error) { return FAsk(os.Stdout, prompt) } -// Same as the Ask function, except it is possible to specify the file to write -// the prompt to. -func FAsk(file *os.File, prompt string) (password string, err error) { - if prompt != "" { - fmt.Fprint(file, prompt) // Display the prompt. +// FAsk is the same as Ask, except it is possible to specify the file to write +// the prompt to. If 'nil' is passed as the writer, no prompt will be written. +func FAsk(wr io.Writer, prompt string) (password string, err error) { + if wr != nil && prompt != "" { + fmt.Fprint(wr, prompt) // Display the prompt. } password, err = getPassword() // Carriage return after the user input. - fmt.Fprintln(file, "") + if wr != nil { + fmt.Fprintln(wr, "") + } return } diff --git a/vendor/github.com/bgentry/speakeasy/speakeasy_unix.go b/vendor/github.com/bgentry/speakeasy/speakeasy_unix.go index dca74bd995fc..d99fda191901 100644 --- a/vendor/github.com/bgentry/speakeasy/speakeasy_unix.go +++ b/vendor/github.com/bgentry/speakeasy/speakeasy_unix.go @@ -4,7 +4,7 @@ // Original code is based on code by RogerV in the golang-nuts thread: // https://groups.google.com/group/golang-nuts/browse_thread/thread/40cc41e9d9fc9247 -// +build darwin freebsd linux netbsd openbsd solaris +// +build darwin dragonfly freebsd linux netbsd openbsd solaris package speakeasy diff --git a/vendor/github.com/bgentry/speakeasy/speakeasy_windows.go b/vendor/github.com/bgentry/speakeasy/speakeasy_windows.go index fc4177c44db8..c2093a8091fb 100644 --- a/vendor/github.com/bgentry/speakeasy/speakeasy_windows.go +++ b/vendor/github.com/bgentry/speakeasy/speakeasy_windows.go @@ -3,7 +3,6 @@ package speakeasy import ( - "os" "syscall" ) @@ -12,18 +11,17 @@ import ( const ENABLE_ECHO_INPUT = 0x0004 func getPassword() (password string, err error) { - hStdin := syscall.Handle(os.Stdin.Fd()) var oldMode uint32 - err = syscall.GetConsoleMode(hStdin, &oldMode) + err = syscall.GetConsoleMode(syscall.Stdin, &oldMode) if err != nil { return } var newMode uint32 = (oldMode &^ ENABLE_ECHO_INPUT) - err = setConsoleMode(hStdin, newMode) - defer setConsoleMode(hStdin, oldMode) + err = setConsoleMode(syscall.Stdin, newMode) + defer setConsoleMode(syscall.Stdin, oldMode) if err != nil { return } diff --git a/vendor/github.com/boltdb/bolt/.gitignore b/vendor/github.com/boltdb/bolt/.gitignore new file mode 100644 index 000000000000..c7bd2b7a5b84 --- /dev/null +++ b/vendor/github.com/boltdb/bolt/.gitignore @@ -0,0 +1,4 @@ +*.prof +*.test +*.swp +/bin/ 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 000000000000..e068e731ea78 --- /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/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/LICENSE b/vendor/github.com/census-instrumentation/opencensus-proto/LICENSE similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/gce/vendor/google.golang.org/appengine/LICENSE rename to vendor/github.com/census-instrumentation/opencensus-proto/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 000000000000..a6f0febe251d --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1/common.pb.go @@ -0,0 +1,361 @@ +// 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 + LibraryInfo_WEB_JS LibraryInfo_Language = 10 +) + +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", + 10: "WEB_JS", +} + +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, + "WEB_JS": 10, +} + +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{ + // 618 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x4f, 0x6e, 0xda, 0x4e, + 0x14, 0xc7, 0x7f, 0xc6, 0x24, 0x81, 0xe7, 0x5f, 0x13, 0x77, 0x94, 0x05, 0x4a, 0x17, 0xa5, 0x74, + 0x93, 0x2e, 0xb0, 0x9b, 0x44, 0xaa, 0xaa, 0x4a, 0x5d, 0x18, 0xe2, 0x26, 0x44, 0x11, 0x58, 0x26, + 0xa1, 0x4a, 0x37, 0x96, 0x21, 0x83, 0x33, 0x2a, 0x9e, 0x41, 0xe3, 0x31, 0x2a, 0x27, 0xe8, 0x09, + 0xda, 0x03, 0xf4, 0x50, 0x3d, 0x44, 0x4f, 0x51, 0xcd, 0x8c, 0x01, 0xab, 0x59, 0x90, 0xdd, 0xfb, + 0xf3, 0xfd, 0x7e, 0x9e, 0xf5, 0xe6, 0xc9, 0xd0, 0x66, 0x73, 0x4c, 0x27, 0x98, 0x66, 0x79, 0xe6, + 0xce, 0x39, 0x13, 0xcc, 0x8d, 0x13, 0x4c, 0x85, 0x3b, 0x61, 0x69, 0xca, 0xa8, 0xbb, 0x38, 0x29, + 0x22, 0x47, 0x35, 0x51, 0x73, 0x23, 0xd7, 0x15, 0x47, 0xc9, 0x9d, 0x42, 0xb4, 0x38, 0x39, 0x7a, + 0x99, 0x30, 0x96, 0xcc, 0xb0, 0x86, 0x8d, 0xf3, 0xa9, 0x2b, 0x48, 0x8a, 0x33, 0x11, 0xa7, 0x73, + 0x6d, 0x68, 0xfd, 0x34, 0xa1, 0xda, 0x67, 0xf7, 0x18, 0x0d, 0x01, 0xc8, 0x3d, 0xa6, 0x82, 0x4c, + 0x09, 0xe6, 0x0d, 0xa3, 0x69, 0x1c, 0x5b, 0xa7, 0x67, 0xce, 0xb6, 0x01, 0x4e, 0xc0, 0xd9, 0x04, + 0x67, 0x59, 0x6f, 0x6d, 0x0d, 0x4b, 0x18, 0x14, 0xc0, 0xff, 0x33, 0x32, 0xe6, 0x31, 0x5f, 0x46, + 0x84, 0x4e, 0x59, 0xa3, 0xa2, 0xb0, 0xed, 0xed, 0xd8, 0x6b, 0xed, 0xea, 0xd1, 0x29, 0x0b, 0xad, + 0xd9, 0x26, 0x91, 0xc4, 0x0c, 0xf3, 0x05, 0x99, 0x60, 0x4d, 0x34, 0x9f, 0x4a, 0x1c, 0x6a, 0x97, + 0x26, 0x66, 0x9b, 0x04, 0x8d, 0x00, 0x62, 0x21, 0x38, 0x19, 0xe7, 0x02, 0x67, 0x8d, 0x6a, 0xd3, + 0x3c, 0xb6, 0x4e, 0xdf, 0x6d, 0xe7, 0xc9, 0xa5, 0x39, 0xde, 0xda, 0xe8, 0x53, 0xc1, 0x97, 0x61, + 0x89, 0x74, 0xf4, 0x11, 0x0e, 0xfe, 0x69, 0x23, 0x1b, 0xcc, 0xaf, 0x78, 0xa9, 0x96, 0x5b, 0x0f, + 0x65, 0x88, 0x0e, 0x61, 0x67, 0x11, 0xcf, 0x72, 0xac, 0x36, 0x53, 0x0f, 0x75, 0xf2, 0xa1, 0xf2, + 0xde, 0x68, 0x7d, 0x37, 0xe0, 0xf9, 0xa3, 0xe5, 0xa2, 0x17, 0x50, 0x7f, 0x60, 0x99, 0x88, 0x68, + 0x9c, 0xe2, 0x82, 0x53, 0x93, 0x85, 0x7e, 0x9c, 0x62, 0x89, 0x9f, 0x93, 0x7b, 0x85, 0x7a, 0x16, + 0xca, 0x10, 0x75, 0xe1, 0x20, 0x13, 0x31, 0x17, 0xd1, 0xfa, 0xd9, 0x8b, 0x85, 0x1d, 0x39, 0xfa, + 0x30, 0x9c, 0xd5, 0x61, 0x38, 0x37, 0x2b, 0x45, 0xb8, 0xaf, 0x2c, 0xeb, 0xbc, 0xf5, 0xbb, 0x02, + 0x56, 0xe9, 0x3d, 0x50, 0x08, 0xb5, 0x59, 0x4c, 0x93, 0x3c, 0x4e, 0xf4, 0x27, 0xec, 0x3f, 0x65, + 0x5d, 0x25, 0x80, 0x73, 0x5d, 0xb8, 0xc3, 0x35, 0x07, 0xbd, 0x01, 0x1b, 0x7f, 0x9b, 0x33, 0x2e, + 0x30, 0x8f, 0x16, 0x98, 0x67, 0x84, 0xd1, 0x62, 0x25, 0x07, 0xab, 0xfa, 0x48, 0x97, 0xd1, 0x5b, + 0x38, 0x9c, 0x30, 0x8e, 0xa3, 0xd5, 0x61, 0xad, 0xe4, 0xa6, 0x92, 0x23, 0xd9, 0x2b, 0x86, 0x15, + 0x8e, 0xd6, 0x0f, 0x03, 0x6a, 0xab, 0x99, 0xa8, 0x01, 0x87, 0xd7, 0x5e, 0xff, 0xe2, 0xd6, 0xbb, + 0xf0, 0xa3, 0xdb, 0xfe, 0x30, 0xf0, 0xbb, 0xbd, 0x4f, 0x3d, 0xff, 0xdc, 0xfe, 0x0f, 0xed, 0x81, + 0xd9, 0x0d, 0x02, 0xdb, 0x40, 0x16, 0xec, 0x75, 0xa3, 0xe1, 0xa5, 0x17, 0x06, 0x76, 0x05, 0x01, + 0xec, 0xfa, 0xa1, 0x74, 0xd8, 0xa6, 0x6c, 0x5c, 0x0c, 0x22, 0x95, 0x54, 0x51, 0x0d, 0xaa, 0x57, + 0xde, 0xc8, 0xb3, 0x77, 0x64, 0xb9, 0x3f, 0x38, 0xf7, 0xa3, 0xab, 0xa1, 0xbd, 0x2b, 0x29, 0xc1, + 0x65, 0x60, 0xef, 0x49, 0x63, 0x70, 0x77, 0x73, 0x39, 0xe8, 0xdb, 0x35, 0xa9, 0x0d, 0x6f, 0x3b, + 0x77, 0x76, 0x5d, 0x56, 0x3f, 0xfb, 0x1d, 0x29, 0x85, 0xd6, 0x2b, 0xb0, 0x4a, 0x57, 0x89, 0x10, + 0x54, 0x4b, 0xcf, 0xaa, 0xe2, 0xce, 0x2f, 0x03, 0x5e, 0x13, 0xb6, 0x75, 0xbd, 0x1d, 0xab, 0xab, + 0xc2, 0x40, 0x36, 0x03, 0xe3, 0x4b, 0x2f, 0x21, 0xe2, 0x21, 0x1f, 0x4b, 0x81, 0xab, 0x7d, 0x6d, + 0x42, 0x33, 0xc1, 0xf3, 0x14, 0x53, 0x11, 0x0b, 0xc2, 0xa8, 0xbb, 0x41, 0xb6, 0xf5, 0x9f, 0x26, + 0xc1, 0xb4, 0x9d, 0x3c, 0xfa, 0xe1, 0xfc, 0xa9, 0x34, 0x07, 0x73, 0x4c, 0xbb, 0x7a, 0xb8, 0xe2, + 0x3b, 0x9e, 0x1a, 0xae, 0x27, 0x3a, 0xa3, 0x93, 0xf1, 0xae, 0x02, 0x9c, 0xfd, 0x0d, 0x00, 0x00, + 0xff, 0xff, 0xe3, 0x53, 0x74, 0x5e, 0xbe, 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 000000000000..5f222b473e8c --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1/metrics_service.pb.go @@ -0,0 +1,275 @@ +// 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" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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{ + // 361 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0x41, 0x4a, 0xc3, 0x40, + 0x14, 0x86, 0x9d, 0x56, 0xaa, 0x4c, 0xc1, 0x45, 0xdc, 0x94, 0x2a, 0xd2, 0x56, 0x91, 0x8a, 0x64, + 0x62, 0xea, 0x42, 0x10, 0x54, 0xac, 0xb8, 0x11, 0xd4, 0x12, 0xc1, 0x85, 0x1b, 0x69, 0xd3, 0x47, + 0xcc, 0x22, 0x33, 0x71, 0x66, 0x12, 0xbc, 0x85, 0x77, 0x70, 0xef, 0x8d, 0x3c, 0x81, 0xa7, 0x90, + 0xe4, 0x4d, 0x5a, 0x4a, 0x8c, 0x05, 0x77, 0x8f, 0xe4, 0xff, 0xfe, 0xf7, 0xff, 0x33, 0x43, 0x4f, + 0x44, 0x0c, 0xdc, 0x07, 0xae, 0x12, 0xe5, 0xc4, 0x52, 0x68, 0xe1, 0x8c, 0x03, 0xe0, 0xda, 0x89, + 0x40, 0xcb, 0xd0, 0x57, 0x4e, 0xea, 0x16, 0xe3, 0xb3, 0x02, 0x99, 0x86, 0x3e, 0xb0, 0x5c, 0x66, + 0x75, 0xe7, 0x20, 0x7e, 0x61, 0x39, 0xc8, 0x8c, 0x9a, 0xa5, 0x6e, 0xdb, 0xae, 0xf0, 0xf6, 0x45, + 0x14, 0x09, 0x9e, 0x59, 0xe3, 0x84, 0x7c, 0xfb, 0xa0, 0x24, 0x2f, 0x87, 0x30, 0xd2, 0xc3, 0x92, + 0x54, 0x82, 0x12, 0x89, 0xf4, 0x21, 0xd3, 0x16, 0x33, 0x8a, 0x7b, 0x5f, 0x84, 0x6e, 0x5d, 0xbf, + 0xc5, 0x42, 0xea, 0x5b, 0x34, 0x79, 0xc0, 0x22, 0x1e, 0xbc, 0x26, 0xa0, 0xb4, 0x75, 0x4a, 0x57, + 0xb9, 0x98, 0x42, 0x8b, 0x74, 0x48, 0xbf, 0x39, 0xd8, 0x67, 0x15, 0xc5, 0x4c, 0xd6, 0xd4, 0x65, + 0x77, 0x62, 0x0a, 0x5e, 0xce, 0x58, 0x67, 0x74, 0xcd, 0x24, 0x6b, 0xd5, 0x3a, 0xf5, 0x7e, 0x73, + 0xb0, 0x5b, 0xc6, 0xe7, 0x27, 0xc2, 0x30, 0x80, 0x57, 0x30, 0xd6, 0x90, 0xae, 0x17, 0x61, 0x5b, + 0xf5, 0xaa, 0xf5, 0xb3, 0x3a, 0xa9, 0xcb, 0x3c, 0x33, 0x7b, 0x33, 0xae, 0xb7, 0x43, 0xb7, 0x7f, + 0x6f, 0xa7, 0x62, 0xc1, 0x15, 0x0c, 0x3e, 0x08, 0xdd, 0x58, 0xfc, 0x65, 0xbd, 0x13, 0xda, 0x40, + 0xc6, 0x3a, 0x67, 0x4b, 0xef, 0x91, 0xfd, 0x71, 0x78, 0xed, 0x8b, 0x7f, 0xf3, 0x18, 0xaf, 0xb7, + 0xd2, 0x27, 0x47, 0x64, 0xf8, 0x49, 0xe8, 0x5e, 0x28, 0x96, 0x7b, 0x0d, 0x37, 0x17, 0x6d, 0x46, + 0x99, 0x6a, 0x44, 0x9e, 0x6e, 0x82, 0x50, 0xbf, 0x24, 0x93, 0xec, 0x92, 0x1c, 0x34, 0xb0, 0x43, + 0xae, 0xb4, 0x4c, 0x22, 0xe0, 0x7a, 0xac, 0x43, 0xc1, 0x9d, 0xb9, 0xb7, 0x8d, 0x4f, 0x26, 0x00, + 0x6e, 0x07, 0xe5, 0xf7, 0xfe, 0x5d, 0xeb, 0xde, 0xc7, 0xc0, 0xaf, 0x30, 0x46, 0xbe, 0x80, 0x5d, + 0xe6, 0x31, 0xcc, 0x6a, 0xf6, 0xe8, 0x4e, 0x1a, 0xb9, 0xc5, 0xf1, 0x4f, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x19, 0x28, 0xa4, 0x50, 0x3f, 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 +} + +// UnimplementedMetricsServiceServer can be embedded to have forward compatible implementations. +type UnimplementedMetricsServiceServer struct { +} + +func (*UnimplementedMetricsServiceServer) Export(srv MetricsService_ExportServer) error { + return status.Errorf(codes.Unimplemented, "method Export not implemented") +} + +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/metrics/v1/metrics_service.pb.gw.go b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1/metrics_service.pb.gw.go new file mode 100644 index 000000000000..158c1608912a --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1/metrics_service.pb.gw.go @@ -0,0 +1,150 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: opencensus/proto/agent/metrics/v1/metrics_service.proto + +/* +Package v1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package v1 + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "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_MetricsService_Export_0(ctx context.Context, marshaler runtime.Marshaler, client MetricsServiceClient, req *http.Request, pathParams map[string]string) (MetricsService_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 + } + dec := marshaler.NewDecoder(req.Body) + handleSend := func() error { + var protoReq ExportMetricsServiceRequest + 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 +} + +// RegisterMetricsServiceHandlerFromEndpoint is same as RegisterMetricsServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterMetricsServiceHandlerFromEndpoint(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 RegisterMetricsServiceHandler(ctx, mux, conn) +} + +// RegisterMetricsServiceHandler registers the http handlers for service MetricsService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterMetricsServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterMetricsServiceHandlerClient(ctx, mux, NewMetricsServiceClient(conn)) +} + +// RegisterMetricsServiceHandlerClient registers the http handlers for service MetricsService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MetricsServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MetricsServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "MetricsServiceClient" to call the correct interceptors. +func RegisterMetricsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MetricsServiceClient) error { + + mux.Handle("POST", pattern_MetricsService_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_MetricsService_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_MetricsService_Export_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_MetricsService_Export_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "metrics"}, "")) +) + +var ( + forward_MetricsService_Export_0 = runtime.ForwardResponseStream +) 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 000000000000..a0a3504ddd6c --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.go @@ -0,0 +1,457 @@ +// 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" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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{ + // 442 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0xcf, 0xaa, 0xd4, 0x30, + 0x14, 0xc6, 0x4d, 0xaf, 0x16, 0xc9, 0x75, 0x63, 0x71, 0x51, 0x8b, 0x30, 0x97, 0x82, 0x32, 0xa0, + 0x4d, 0xed, 0x5c, 0xee, 0xe6, 0x0a, 0x82, 0x33, 0x08, 0x2e, 0x44, 0x2f, 0x1d, 0x75, 0xe1, 0x66, + 0xe8, 0xb4, 0xc7, 0xda, 0xc5, 0x24, 0x31, 0x49, 0x8b, 0x82, 0x7b, 0xf7, 0x2e, 0x7c, 0x03, 0x5f, + 0xc8, 0xc7, 0xf0, 0x29, 0xa4, 0x39, 0x9d, 0x3f, 0x3a, 0x53, 0x0b, 0xba, 0xb9, 0xbb, 0x43, 0xf3, + 0xfd, 0xbe, 0xf3, 0x25, 0x39, 0x29, 0x3d, 0x15, 0x12, 0x78, 0x0e, 0x5c, 0xd7, 0x3a, 0x96, 0x4a, + 0x18, 0x11, 0x67, 0x25, 0x70, 0x13, 0x1b, 0x95, 0xe5, 0x10, 0x37, 0x09, 0x16, 0x0b, 0x0d, 0xaa, + 0xa9, 0x72, 0x60, 0x56, 0xe2, 0x8d, 0xb6, 0x10, 0x7e, 0x61, 0x16, 0x62, 0x56, 0xcb, 0x9a, 0x24, + 0x88, 0x7a, 0x5c, 0x73, 0xb1, 0x5a, 0x09, 0xde, 0xda, 0x62, 0x85, 0x74, 0x70, 0x7f, 0x4f, 0xae, + 0x40, 0x8b, 0x5a, 0x61, 0x82, 0x75, 0xdd, 0x89, 0xef, 0xee, 0x89, 0x7f, 0xcf, 0xda, 0xc9, 0x1e, + 0x0c, 0xc8, 0x16, 0xb9, 0xe0, 0xef, 0xaa, 0x12, 0xd5, 0xe1, 0x57, 0x42, 0x6f, 0xcd, 0x6a, 0xa5, + 0x80, 0x9b, 0xe7, 0xd5, 0x52, 0x65, 0xea, 0xd3, 0xcc, 0x2e, 0x7b, 0xe7, 0xf4, 0x2a, 0x17, 0x05, + 0xf8, 0xe4, 0x84, 0x8c, 0x8f, 0x27, 0xf7, 0x58, 0xcf, 0xce, 0xbb, 0xed, 0x34, 0x09, 0x7b, 0x21, + 0x0a, 0x48, 0x2d, 0xe3, 0x3d, 0xa6, 0x2e, 0x36, 0xf1, 0x9d, 0x3e, 0x7a, 0x7d, 0x62, 0xec, 0x55, + 0x5b, 0x60, 0xcf, 0xb4, 0xa3, 0x6c, 0xa8, 0xd7, 0xb2, 0xc8, 0x0c, 0x14, 0x97, 0x27, 0xd4, 0x0f, + 0x42, 0x6f, 0x3f, 0xfd, 0x28, 0x85, 0x32, 0x76, 0x75, 0x8e, 0x83, 0x91, 0xc2, 0x87, 0x1a, 0xb4, + 0xf9, 0xaf, 0x64, 0x67, 0xf4, 0x9a, 0x96, 0x19, 0xd7, 0xbe, 0x73, 0x72, 0x34, 0x3e, 0x9e, 0x8c, + 0xfe, 0x12, 0x6c, 0x2e, 0x33, 0x9e, 0xa2, 0xda, 0x9b, 0xd2, 0xeb, 0xeb, 0x09, 0xf1, 0x8f, 0xfa, + 0xda, 0x6e, 0x66, 0xa8, 0x49, 0x58, 0xda, 0xd5, 0xe9, 0x86, 0x0b, 0xef, 0xd0, 0xe0, 0xd0, 0x9e, + 0xb4, 0x14, 0x5c, 0xc3, 0xe4, 0x9b, 0x43, 0x6f, 0xec, 0x2e, 0x78, 0x9f, 0xa9, 0xdb, 0xdd, 0xc4, + 0x19, 0x1b, 0x78, 0x0a, 0xec, 0xd0, 0x54, 0x05, 0xc3, 0xd8, 0xa1, 0x7b, 0x0f, 0xaf, 0x8c, 0xc9, + 0x43, 0xe2, 0x7d, 0x21, 0xd4, 0xc5, 0xb4, 0xde, 0xf9, 0xa0, 0x4f, 0xef, 0x55, 0x05, 0x8f, 0xfe, + 0x89, 0xc5, 0x23, 0xc1, 0x24, 0xd3, 0xef, 0x84, 0x86, 0x95, 0x18, 0xf2, 0x99, 0xde, 0xdc, 0xb5, + 0xb8, 0x68, 0x15, 0x17, 0xe4, 0xed, 0xb3, 0xb2, 0x32, 0xef, 0xeb, 0x65, 0x3b, 0x0a, 0x31, 0xc2, + 0x51, 0xc5, 0xb5, 0x51, 0xf5, 0x0a, 0xb8, 0xc9, 0x4c, 0x25, 0x78, 0xbc, 0xf5, 0x8d, 0xf0, 0x05, + 0x97, 0xc0, 0xa3, 0xf2, 0xcf, 0x3f, 0xd4, 0x4f, 0x67, 0xf4, 0x52, 0x02, 0x9f, 0x61, 0x00, 0x6b, + 0xcf, 0x9e, 0xd8, 0x00, 0xb6, 0x2d, 0x7b, 0x93, 0x2c, 0x5d, 0x8b, 0x9f, 0xfe, 0x0a, 0x00, 0x00, + 0xff, 0xff, 0x65, 0x76, 0xd7, 0xb9, 0xed, 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 +} + +// UnimplementedTraceServiceServer can be embedded to have forward compatible implementations. +type UnimplementedTraceServiceServer struct { +} + +func (*UnimplementedTraceServiceServer) Config(srv TraceService_ConfigServer) error { + return status.Errorf(codes.Unimplemented, "method Config not implemented") +} +func (*UnimplementedTraceServiceServer) Export(srv TraceService_ExportServer) error { + return status.Errorf(codes.Unimplemented, "method Export not implemented") +} + +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 000000000000..334331b0dd11 --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.gw.go @@ -0,0 +1,150 @@ +// 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 ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "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 + } + dec := marshaler.NewDecoder(req.Body) + 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 000000000000..466b2342854d --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1/metrics.pb.go @@ -0,0 +1,1127 @@ +// 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{ + // 1118 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, 0xd2, 0xf5, 0xa8, 0xed, 0xdf, 0x72, 0xfe, 0x0a, 0x61, + 0x11, 0x90, 0x0a, 0x65, 0xad, 0x98, 0xd2, 0x56, 0x15, 0x2a, 0x8a, 0x63, 0x37, 0x31, 0x24, 0xb1, + 0x35, 0xb6, 0x23, 0xd1, 0x1b, 0x6b, 0xbd, 0x9e, 0x24, 0x4b, 0xbc, 0x1f, 0xdd, 0x99, 0x0d, 0xf8, + 0x05, 0x78, 0x02, 0xc4, 0x35, 0xb7, 0x88, 0xe7, 0xe0, 0x8a, 0x27, 0xe0, 0x15, 0xb8, 0x41, 0xbc, + 0x01, 0xda, 0x99, 0xd9, 0x8f, 0xc4, 0x60, 0xea, 0x22, 0x71, 0x77, 0xe6, 0xcc, 0x39, 0xbf, 0xfd, + 0x9d, 0xcf, 0x1d, 0x78, 0xe4, 0xf9, 0xc4, 0xb5, 0x88, 0x4b, 0x43, 0x5a, 0xf7, 0x03, 0x8f, 0x79, + 0x75, 0x87, 0xb0, 0xc0, 0xb6, 0x68, 0xfd, 0x66, 0x3f, 0x16, 0x0d, 0x7e, 0x81, 0xb6, 0x52, 0x53, + 0xa1, 0x31, 0xe2, 0xfb, 0x9b, 0xfd, 0xda, 0x3b, 0x97, 0x9e, 0x77, 0x39, 0x25, 0x02, 0x63, 0x1c, + 0x5e, 0xd4, 0x99, 0xed, 0x10, 0xca, 0x4c, 0xc7, 0x17, 0xb6, 0xb5, 0xed, 0xbb, 0x06, 0x5f, 0x07, + 0xa6, 0xef, 0x93, 0x40, 0x62, 0xd5, 0x3e, 0x9a, 0x23, 0x12, 0x10, 0xea, 0x85, 0x81, 0x45, 0x22, + 0x26, 0xb1, 0x2c, 0x8c, 0xf5, 0x3f, 0x14, 0x28, 0x9e, 0xf2, 0x8f, 0xa3, 0x57, 0x50, 0x11, 0x34, + 0x46, 0x13, 0x42, 0xad, 0xc0, 0xf6, 0x99, 0x17, 0x54, 0x95, 0x1d, 0x65, 0x57, 0x6d, 0xec, 0x19, + 0x0b, 0x18, 0x1b, 0xc2, 0xbf, 0x95, 0x38, 0x61, 0xcd, 0xb9, 0xa3, 0x41, 0x47, 0x00, 0x3c, 0x0c, + 0x12, 0xd8, 0x84, 0x56, 0x73, 0x3b, 0xf9, 0x5d, 0xb5, 0xf1, 0xe1, 0x42, 0xd0, 0x81, 0xed, 0x90, + 0x3e, 0x37, 0xc7, 0x19, 0x57, 0xd4, 0x84, 0x52, 0x1c, 0x41, 0x35, 0xcf, 0xb9, 0x7d, 0x30, 0x0f, + 0x93, 0xc4, 0x78, 0xb3, 0x6f, 0x60, 0x29, 0xe3, 0xc4, 0x4f, 0xff, 0x3e, 0x0f, 0xda, 0x5d, 0xce, + 0x08, 0x41, 0xc1, 0x35, 0x1d, 0xc2, 0x03, 0x5e, 0xc7, 0x5c, 0x46, 0x3b, 0xa0, 0xc6, 0xa9, 0xb0, + 0x3d, 0xb7, 0x9a, 0xe3, 0x57, 0x59, 0x55, 0xe4, 0x15, 0xba, 0x36, 0xe3, 0x54, 0xd6, 0x31, 0x97, + 0xd1, 0x4b, 0x28, 0xb0, 0x99, 0x4f, 0xaa, 0x85, 0x1d, 0x65, 0x77, 0xb3, 0xd1, 0x58, 0x2a, 0x75, + 0xc6, 0x60, 0xe6, 0x13, 0xcc, 0xfd, 0x51, 0x0b, 0x60, 0x6a, 0x8e, 0xc9, 0x74, 0x74, 0x4d, 0x66, + 0xb4, 0xba, 0xca, 0x73, 0xf6, 0xfe, 0x42, 0xb4, 0x93, 0xc8, 0xfc, 0x0b, 0x32, 0xc3, 0xeb, 0x53, + 0x29, 0x51, 0xfd, 0x47, 0x05, 0x0a, 0x11, 0x28, 0xba, 0x07, 0xea, 0xf0, 0xac, 0xdf, 0x6b, 0x1f, + 0x76, 0x5e, 0x76, 0xda, 0x2d, 0x6d, 0x25, 0x52, 0x1c, 0x1d, 0x0c, 0x8f, 0xda, 0xa3, 0xce, 0xd9, + 0xe0, 0xc9, 0x63, 0x4d, 0x41, 0x1a, 0x94, 0x85, 0xa2, 0xd5, 0x1d, 0x36, 0x4f, 0xda, 0x5a, 0x0e, + 0x3d, 0x04, 0x24, 0x35, 0x9d, 0xfe, 0x00, 0x77, 0x9a, 0xc3, 0x41, 0xa7, 0x7b, 0xa6, 0xe5, 0xd1, + 0x7d, 0xd0, 0x0e, 0x87, 0xa7, 0xc3, 0x93, 0x83, 0x41, 0xe7, 0x3c, 0xf6, 0x2f, 0xa0, 0x07, 0x50, + 0xc9, 0x68, 0x25, 0xc8, 0x2a, 0xda, 0x82, 0xff, 0x65, 0xd5, 0x59, 0xa4, 0x22, 0x52, 0x61, 0xad, + 0x3f, 0x3c, 0x3d, 0x3d, 0xc0, 0x5f, 0x6a, 0x6b, 0xfa, 0x0b, 0x28, 0xc5, 0x21, 0x20, 0x0d, 0xf2, + 0xd7, 0x64, 0x26, 0xcb, 0x11, 0x89, 0xff, 0x5c, 0x0d, 0xfd, 0x57, 0x05, 0x20, 0xed, 0x1b, 0x74, + 0x08, 0xf7, 0x28, 0x33, 0x03, 0x36, 0x4a, 0x26, 0x48, 0xb6, 0x73, 0xcd, 0x10, 0x23, 0x64, 0xc4, + 0x23, 0xc4, 0xbb, 0x8d, 0x5b, 0xe0, 0x4d, 0xee, 0x92, 0x9c, 0xd1, 0xe7, 0x50, 0x16, 0x55, 0xb8, + 0x31, 0xa7, 0xe1, 0x1b, 0xf6, 0x2e, 0x0f, 0xe2, 0x3c, 0xb2, 0xc7, 0xea, 0x34, 0x91, 0x29, 0x7a, + 0x0e, 0x45, 0xdf, 0xb3, 0x5d, 0x46, 0xab, 0x79, 0x8e, 0xa2, 0x2f, 0x44, 0xe9, 0x45, 0xa6, 0x58, + 0x7a, 0xe8, 0x9f, 0x01, 0xa4, 0xb0, 0xe8, 0x3e, 0xac, 0x72, 0x3e, 0x32, 0x3f, 0xe2, 0x80, 0xb6, + 0x60, 0xfd, 0xca, 0xa4, 0x82, 0x29, 0xcf, 0x4f, 0x09, 0x97, 0xae, 0x4c, 0xca, 0x5d, 0xf4, 0x9f, + 0x73, 0xb0, 0xca, 0x21, 0xd1, 0x33, 0x58, 0x5f, 0x26, 0x23, 0xa9, 0x31, 0x7a, 0x17, 0x54, 0xdb, + 0x65, 0x4f, 0x1e, 0x67, 0x3e, 0x91, 0x3f, 0x5e, 0xc1, 0xc0, 0x95, 0x82, 0xd9, 0x7b, 0x50, 0x9e, + 0x78, 0xe1, 0x78, 0x4a, 0xa4, 0x4d, 0x34, 0x19, 0xca, 0xf1, 0x0a, 0x56, 0x85, 0x56, 0x18, 0x8d, + 0x00, 0x4d, 0x6c, 0xca, 0x02, 0x7b, 0x1c, 0x46, 0x85, 0x93, 0xa6, 0x05, 0x4e, 0xc5, 0x58, 0x98, + 0x94, 0x56, 0xc6, 0x8d, 0x63, 0x1d, 0xaf, 0xe0, 0xca, 0xe4, 0xae, 0x12, 0xf5, 0x60, 0x83, 0x86, + 0x8e, 0x63, 0x06, 0x33, 0x89, 0xbd, 0xca, 0xb1, 0x1f, 0x2d, 0xc4, 0xee, 0x0b, 0x8f, 0x18, 0xb6, + 0x4c, 0x33, 0xe7, 0xe6, 0x9a, 0xcc, 0xb8, 0xfe, 0x4b, 0x11, 0x2a, 0x73, 0x2c, 0xa2, 0x82, 0x58, + 0x5e, 0xe8, 0x32, 0x9e, 0xcf, 0x3c, 0x16, 0x87, 0xa8, 0x89, 0x69, 0xe8, 0xf0, 0x3c, 0x29, 0x38, + 0x12, 0xd1, 0x53, 0xa8, 0xd2, 0xd0, 0x19, 0x79, 0x17, 0x23, 0xfa, 0x3a, 0x34, 0x03, 0x32, 0x19, + 0x4d, 0xc8, 0x8d, 0x6d, 0xf2, 0x8e, 0xe6, 0xa9, 0xc2, 0x0f, 0x68, 0xe8, 0x74, 0x2f, 0xfa, 0xe2, + 0xb6, 0x15, 0x5f, 0x22, 0x0b, 0x36, 0xc7, 0xa1, 0x75, 0x4d, 0xd8, 0xc8, 0xe3, 0xcd, 0x4e, 0x65, + 0xba, 0x3e, 0x5d, 0x2e, 0x5d, 0x46, 0x93, 0x83, 0x74, 0x05, 0x06, 0xde, 0x18, 0x67, 0x8f, 0xa8, + 0x0b, 0x6b, 0x42, 0x11, 0xef, 0x9b, 0x4f, 0xde, 0x0a, 0x1d, 0xc7, 0x28, 0xb5, 0x1f, 0x14, 0xd8, + 0xb8, 0xf5, 0x45, 0x64, 0x41, 0x89, 0x7c, 0xe3, 0x4f, 0x6d, 0xcb, 0x66, 0xb2, 0xf7, 0xda, 0xff, + 0x26, 0x02, 0xa3, 0x2d, 0xc1, 0x8e, 0x57, 0x70, 0x02, 0x5c, 0xd3, 0xa1, 0x14, 0xeb, 0xd1, 0x43, + 0x28, 0x8e, 0xbd, 0xd0, 0x9d, 0xd0, 0xaa, 0xb2, 0x93, 0xdf, 0x55, 0xb0, 0x3c, 0x35, 0x8b, 0x62, + 0x4d, 0xd7, 0x28, 0x14, 0x05, 0xe2, 0xdf, 0xd4, 0xb0, 0x1f, 0x11, 0x26, 0x8e, 0x3f, 0x35, 0x03, + 0x5e, 0x48, 0xb5, 0xf1, 0x74, 0x49, 0xc2, 0x6d, 0xe9, 0x8e, 0x13, 0xa0, 0xda, 0xb7, 0xb9, 0x88, + 0xa1, 0x38, 0xdc, 0x1e, 0x66, 0x25, 0x1e, 0xe6, 0x5b, 0x53, 0x9a, 0x5b, 0x66, 0x4a, 0xbf, 0x02, + 0xd5, 0x64, 0xcc, 0xb4, 0xae, 0x1c, 0x92, 0xee, 0x9a, 0xe3, 0xb7, 0x24, 0x6d, 0x1c, 0xa4, 0x50, + 0x6d, 0x97, 0x05, 0x33, 0x9c, 0x05, 0xaf, 0xbd, 0x00, 0xed, 0xae, 0xc1, 0x5f, 0xac, 0xee, 0x24, + 0xc2, 0x5c, 0x66, 0x5d, 0x3d, 0xcf, 0x3d, 0x53, 0xf4, 0xdf, 0xf3, 0x50, 0xce, 0xce, 0x1d, 0xda, + 0xcf, 0x16, 0x41, 0x6d, 0x6c, 0xcd, 0x85, 0xdc, 0x49, 0x76, 0x4d, 0x5c, 0x21, 0x23, 0x9d, 0x32, + 0xb5, 0xf1, 0xff, 0x39, 0x87, 0x56, 0xba, 0x78, 0xc4, 0x0c, 0x9e, 0x41, 0x89, 0xba, 0xa6, 0x4f, + 0xaf, 0x3c, 0x26, 0xdf, 0x10, 0x8d, 0x37, 0xde, 0x0b, 0x46, 0x5f, 0x7a, 0xe2, 0x04, 0xa3, 0xf6, + 0x53, 0x0e, 0x4a, 0xb1, 0xfa, 0xbf, 0xe0, 0xff, 0x1a, 0x2a, 0x3e, 0x09, 0x2c, 0xe2, 0x32, 0x3b, + 0x5e, 0xb3, 0x71, 0x95, 0x5b, 0xcb, 0x07, 0x62, 0xf0, 0xe3, 0x01, 0xeb, 0x25, 0x90, 0x58, 0x4b, + 0xe1, 0xc5, 0x9f, 0xab, 0xd6, 0x81, 0xca, 0x9c, 0x19, 0xda, 0x06, 0x48, 0x0d, 0x65, 0xf3, 0x66, + 0x34, 0xb7, 0xab, 0x1e, 0xf7, 0x75, 0xf3, 0x3b, 0x05, 0xb6, 0x6d, 0x6f, 0x11, 0xcf, 0x66, 0x59, + 0x3c, 0x8b, 0x68, 0x2f, 0xba, 0xe8, 0x29, 0xaf, 0x5a, 0x97, 0x36, 0xbb, 0x0a, 0xc7, 0x86, 0xe5, + 0x39, 0x75, 0xe1, 0xb3, 0x67, 0xbb, 0x94, 0x05, 0x61, 0xd4, 0x74, 0x7c, 0x3d, 0xd6, 0x53, 0xb8, + 0x3d, 0xf1, 0xe6, 0xbd, 0x24, 0xee, 0xde, 0x65, 0xf6, 0x0d, 0xfe, 0x5b, 0x6e, 0xab, 0xeb, 0x13, + 0xf7, 0x50, 0x7c, 0x93, 0x43, 0xcb, 0xe7, 0x17, 0x35, 0xce, 0xf7, 0xc7, 0x45, 0xee, 0xf6, 0xf1, + 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf8, 0xd0, 0xb4, 0x8d, 0xc7, 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 000000000000..5dba6a2a0aa0 --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1/resource.pb.go @@ -0,0 +1,100 @@ +// 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{ + // 251 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, 0x69, 0x06, 0x23, 0x97, 0x7c, 0x66, 0x3e, + 0x5e, 0xbb, 0x9d, 0x78, 0x61, 0x96, 0x07, 0x80, 0xa4, 0x02, 0x18, 0xa3, 0x5c, 0xd3, 0x33, 0x4b, + 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x21, 0xba, 0x74, 0x33, 0xf3, 0x8a, 0x4b, 0x8a, + 0x4a, 0x73, 0x53, 0xf3, 0x4a, 0x12, 0x4b, 0x32, 0xf3, 0xf3, 0xf4, 0x11, 0x06, 0xea, 0x42, 0x42, + 0x32, 0x3d, 0x35, 0x4f, 0x37, 0x1d, 0x25, 0x40, 0x5f, 0x31, 0xc9, 0xf8, 0x17, 0xa4, 0xe6, 0x39, + 0x43, 0xac, 0x05, 0x9b, 0x8d, 0xf0, 0x66, 0x98, 0x61, 0x12, 0x1b, 0x58, 0xa3, 0x31, 0x20, 0x00, + 0x00, 0xff, 0xff, 0xcf, 0x32, 0xff, 0x46, 0x96, 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 000000000000..2f4ab19b5e55 --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace.pb.go @@ -0,0 +1,1553 @@ +// 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"` + // The Tracestate associated with the link. + Tracestate *Span_Tracestate `protobuf:"bytes,5,opt,name=tracestate,proto3" json:"tracestate,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 +} + +func (m *Span_Link) GetTracestate() *Span_Tracestate { + if m != nil { + return m.Tracestate + } + 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{ + // 1581 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x58, 0xdb, 0x6e, 0x1b, 0x41, + 0x19, 0xce, 0xfa, 0xec, 0xdf, 0x8e, 0xeb, 0x4c, 0xd3, 0x74, 0x63, 0x0a, 0x0d, 0x6e, 0x0b, 0x29, + 0x25, 0x9b, 0x26, 0x2d, 0x55, 0x8f, 0x2a, 0x71, 0xe2, 0x60, 0x37, 0xa9, 0xeb, 0x8e, 0xdd, 0x88, + 0x83, 0xd0, 0x6a, 0xed, 0x9d, 0x38, 0x4b, 0xec, 0xd9, 0x65, 0x77, 0x36, 0x28, 0x7d, 0x01, 0x84, + 0xe0, 0x86, 0x0b, 0xc4, 0x0b, 0x70, 0xc1, 0xeb, 0x20, 0xee, 0x79, 0x00, 0x24, 0x9e, 0x80, 0x1b, + 0x34, 0x33, 0x7b, 0x72, 0xd2, 0x26, 0xc6, 0xbd, 0xb1, 0xe6, 0xf0, 0x7f, 0xdf, 0x3f, 0xff, 0xcc, + 0x7f, 0x5a, 0xc3, 0x03, 0xdb, 0x21, 0x74, 0x48, 0xa8, 0xe7, 0x7b, 0x9b, 0x8e, 0x6b, 0x33, 0x7b, + 0x93, 0xb9, 0xc6, 0x90, 0x6c, 0x9e, 0x6d, 0xc9, 0x81, 0x26, 0x16, 0xd1, 0x6a, 0x2c, 0x26, 0x57, + 0x34, 0xb9, 0x7b, 0xb6, 0x55, 0x7b, 0x74, 0x89, 0xc1, 0x25, 0x9e, 0xed, 0xbb, 0x92, 0x24, 0x1c, + 0x4b, 0x54, 0xed, 0xee, 0xc8, 0xb6, 0x47, 0x63, 0x22, 0x05, 0x07, 0xfe, 0xf1, 0x26, 0xb3, 0x26, + 0xc4, 0x63, 0xc6, 0xc4, 0x09, 0x04, 0xbe, 0x77, 0x51, 0xe0, 0x77, 0xae, 0xe1, 0x38, 0xc4, 0x0d, + 0xd4, 0xd6, 0xff, 0xbc, 0x02, 0x99, 0x9e, 0x63, 0x50, 0xb4, 0x0a, 0x05, 0x71, 0x04, 0xdd, 0x32, + 0x55, 0x65, 0x4d, 0x59, 0x2f, 0xe3, 0xbc, 0x98, 0xb7, 0x4d, 0x74, 0x1b, 0xf2, 0x9e, 0x63, 0x50, + 0xbe, 0x93, 0x12, 0x3b, 0x39, 0x3e, 0x6d, 0x9b, 0xe8, 0x1d, 0x80, 0x90, 0xf1, 0x98, 0xc1, 0x88, + 0x7a, 0x63, 0x4d, 0x59, 0x2f, 0x6d, 0xff, 0x48, 0xfb, 0xaa, 0x69, 0x1a, 0x57, 0xa4, 0xf5, 0x23, + 0x04, 0x4e, 0xa0, 0xd1, 0x7d, 0xa8, 0x38, 0x86, 0x4b, 0x28, 0xd3, 0x43, 0x5d, 0x69, 0xa1, 0xab, + 0x2c, 0x57, 0x7b, 0x52, 0xe3, 0x4f, 0x21, 0x43, 0x8d, 0x09, 0x51, 0x33, 0x42, 0xd7, 0x8f, 0xaf, + 0xd0, 0xd5, 0x77, 0x7d, 0x3a, 0x34, 0x98, 0x31, 0x18, 0x93, 0x1e, 0x73, 0x2d, 0x3a, 0xc2, 0x02, + 0x89, 0x5e, 0x43, 0xe6, 0xd4, 0xa2, 0xa6, 0x5a, 0x59, 0x53, 0xd6, 0x2b, 0xdb, 0xeb, 0xd7, 0x9d, + 0x96, 0xff, 0x1c, 0x58, 0xd4, 0xc4, 0x02, 0x85, 0x5e, 0x00, 0x78, 0xcc, 0x70, 0x99, 0xce, 0xef, + 0x59, 0xcd, 0x8a, 0x53, 0xd4, 0x34, 0x79, 0xc7, 0x5a, 0x78, 0xc7, 0x5a, 0x3f, 0x7c, 0x04, 0x5c, + 0x14, 0xd2, 0x7c, 0x8e, 0x7e, 0x02, 0x05, 0x42, 0x4d, 0x09, 0xcc, 0x5d, 0x0b, 0xcc, 0x13, 0x6a, + 0x0a, 0xd8, 0x3b, 0x00, 0x83, 0x31, 0xd7, 0x1a, 0xf8, 0x8c, 0x78, 0x6a, 0x7e, 0xb6, 0x3b, 0xde, + 0x89, 0x10, 0x38, 0x81, 0x46, 0xfb, 0x50, 0xf2, 0x98, 0x31, 0x3c, 0xd5, 0x85, 0xb4, 0x5a, 0x10, + 0x64, 0x0f, 0xae, 0x22, 0xe3, 0xd2, 0xe2, 0xc1, 0x30, 0x78, 0xd1, 0x18, 0x1d, 0x40, 0x89, 0x9b, + 0xa1, 0x93, 0x33, 0x42, 0x99, 0xa7, 0x16, 0x67, 0x7c, 0x78, 0x6b, 0x42, 0x9a, 0x02, 0x81, 0x81, + 0x45, 0x63, 0xf4, 0x0a, 0xb2, 0x63, 0x8b, 0x9e, 0x7a, 0x2a, 0x5c, 0x7f, 0x1c, 0x4e, 0x73, 0xc8, + 0x85, 0xb1, 0xc4, 0xa0, 0x17, 0x90, 0xe3, 0xee, 0xe3, 0x7b, 0x6a, 0x49, 0xa0, 0xbf, 0x7f, 0xb5, + 0x31, 0xcc, 0xf7, 0x70, 0x00, 0x40, 0x0d, 0x28, 0x84, 0xc1, 0xa4, 0x56, 0x05, 0xf8, 0x07, 0x97, + 0xc1, 0x51, 0xb8, 0x9d, 0x6d, 0x69, 0x38, 0x18, 0xe3, 0x08, 0x87, 0x7e, 0x0e, 0xdf, 0xf1, 0x8c, + 0x09, 0xd1, 0x1d, 0xd7, 0x1e, 0x12, 0xcf, 0xd3, 0x0d, 0x4f, 0x4f, 0x38, 0xb1, 0x5a, 0xfe, 0xca, + 0x33, 0x37, 0x6c, 0x7b, 0x7c, 0x64, 0x8c, 0x7d, 0x82, 0x6f, 0x73, 0x78, 0x57, 0xa2, 0x77, 0xbc, + 0x6e, 0xe4, 0xea, 0x68, 0x1f, 0xaa, 0xc3, 0x13, 0x6b, 0x6c, 0xca, 0x68, 0x18, 0xda, 0x3e, 0x65, + 0xea, 0xa2, 0xa0, 0xbb, 0x73, 0x89, 0xee, 0x53, 0x9b, 0xb2, 0x27, 0xdb, 0x92, 0xb0, 0x22, 0x50, + 0x9c, 0x62, 0x97, 0x63, 0x6a, 0x7f, 0x50, 0x00, 0xe2, 0x88, 0x43, 0xef, 0x20, 0x4f, 0x28, 0x73, + 0x2d, 0xe2, 0xa9, 0xca, 0x5a, 0x7a, 0xbd, 0xb4, 0xfd, 0x78, 0xf6, 0x70, 0xd5, 0x9a, 0x94, 0xb9, + 0xe7, 0x38, 0x24, 0xa8, 0x6d, 0x42, 0x56, 0xac, 0xa0, 0x2a, 0xa4, 0x4f, 0xc9, 0xb9, 0xc8, 0x1a, + 0x45, 0xcc, 0x87, 0x68, 0x19, 0xb2, 0x67, 0xfc, 0x38, 0x22, 0x5f, 0x14, 0xb1, 0x9c, 0xd4, 0xfe, + 0x92, 0x02, 0x88, 0x3d, 0x13, 0x19, 0xb0, 0x18, 0xf9, 0xa6, 0x3e, 0x31, 0x9c, 0xe0, 0x44, 0xaf, + 0x67, 0x77, 0xee, 0x78, 0xf8, 0xde, 0x70, 0xe4, 0xe9, 0xca, 0x46, 0x62, 0x09, 0x3d, 0x07, 0xd5, + 0x74, 0x6d, 0xc7, 0x21, 0xa6, 0x1e, 0x87, 0x41, 0x70, 0x9b, 0xfc, 0x68, 0x59, 0xbc, 0x12, 0xec, + 0xc7, 0xa4, 0xf2, 0xde, 0x7e, 0x03, 0x4b, 0x97, 0xc8, 0xbf, 0x60, 0xe8, 0xdb, 0xa4, 0xa1, 0xa5, + 0xed, 0x87, 0x57, 0x9c, 0x3d, 0xa2, 0x93, 0x0f, 0x25, 0x71, 0x2f, 0x53, 0xcf, 0x95, 0xda, 0xdf, + 0xb2, 0x50, 0x8c, 0x82, 0x03, 0x69, 0x90, 0x11, 0x39, 0x42, 0xb9, 0x36, 0x47, 0x08, 0x39, 0x74, + 0x04, 0x60, 0x50, 0x6a, 0x33, 0x83, 0x59, 0x36, 0x0d, 0xce, 0xf1, 0x74, 0xe6, 0x58, 0xd4, 0x76, + 0x22, 0x6c, 0x6b, 0x01, 0x27, 0x98, 0xd0, 0xaf, 0x61, 0x71, 0x42, 0x3c, 0xcf, 0x18, 0x05, 0x71, + 0x2e, 0xf2, 0x71, 0x69, 0xfb, 0xd9, 0xec, 0xd4, 0xef, 0x25, 0x5c, 0x4c, 0x5a, 0x0b, 0xb8, 0x3c, + 0x49, 0xcc, 0x6b, 0x7f, 0x57, 0x00, 0x62, 0xdd, 0xa8, 0x03, 0x25, 0x93, 0x78, 0x43, 0xd7, 0x72, + 0x84, 0x19, 0xca, 0x1c, 0xf9, 0x3d, 0x49, 0x70, 0x21, 0x6d, 0xa6, 0xbe, 0x25, 0x6d, 0xd6, 0xfe, + 0xab, 0x40, 0x39, 0x69, 0x0b, 0xfa, 0x00, 0x19, 0x76, 0xee, 0xc8, 0x27, 0xaa, 0x6c, 0xbf, 0x9a, + 0xef, 0x46, 0xb4, 0xfe, 0xb9, 0x43, 0xb0, 0x20, 0x42, 0x15, 0x48, 0x05, 0xc5, 0x35, 0x83, 0x53, + 0x96, 0x89, 0x1e, 0xc1, 0x92, 0x4f, 0x87, 0xf6, 0xc4, 0x71, 0x89, 0xe7, 0x11, 0x53, 0xf7, 0xac, + 0xcf, 0x44, 0xdc, 0x7f, 0x06, 0x57, 0x93, 0x1b, 0x3d, 0xeb, 0x33, 0x41, 0x3f, 0x84, 0x1b, 0x17, + 0x45, 0x33, 0x42, 0xb4, 0x32, 0x2d, 0x58, 0x7f, 0x0a, 0x19, 0xae, 0x13, 0x2d, 0x43, 0xb5, 0xff, + 0x8b, 0x6e, 0x53, 0xff, 0xd4, 0xe9, 0x75, 0x9b, 0xbb, 0xed, 0xfd, 0x76, 0x73, 0xaf, 0xba, 0x80, + 0x0a, 0x90, 0xe9, 0x35, 0x3b, 0xfd, 0xaa, 0x82, 0xca, 0x50, 0xc0, 0xcd, 0xdd, 0x66, 0xfb, 0xa8, + 0xb9, 0x57, 0x4d, 0x35, 0xf2, 0x81, 0x8b, 0xd7, 0xfe, 0xc9, 0x53, 0x49, 0x9c, 0xb7, 0x5b, 0x00, + 0x71, 0x11, 0x08, 0x62, 0xf7, 0xe1, 0xcc, 0x57, 0x81, 0x8b, 0x51, 0x09, 0x40, 0x2f, 0x61, 0x35, + 0x8a, 0xd2, 0xc8, 0x23, 0xa6, 0xc3, 0xf4, 0x76, 0x18, 0xa6, 0xf1, 0xbe, 0x88, 0x53, 0xf4, 0x16, + 0xee, 0x84, 0xd8, 0x29, 0x6f, 0x0d, 0xe1, 0x69, 0x01, 0x0f, 0xf9, 0x93, 0xf7, 0x1f, 0x04, 0xfa, + 0xbf, 0x52, 0x90, 0xe1, 0x25, 0x65, 0xae, 0x06, 0xe8, 0x4d, 0xe0, 0x08, 0x69, 0xe1, 0x08, 0x0f, + 0x67, 0x29, 0x5d, 0xc9, 0x67, 0x9f, 0x76, 0xd2, 0xcc, 0x37, 0xd5, 0xf6, 0xe9, 0x5e, 0x2c, 0xfb, + 0x2d, 0xbd, 0x58, 0xfd, 0xe0, 0x4a, 0x47, 0xb9, 0x05, 0x4b, 0xbb, 0xad, 0xf6, 0xe1, 0x9e, 0x7e, + 0xd8, 0xee, 0x1c, 0x34, 0xf7, 0xf4, 0x5e, 0x77, 0xa7, 0x53, 0x55, 0xd0, 0x0a, 0xa0, 0xee, 0x0e, + 0x6e, 0x76, 0xfa, 0x53, 0xeb, 0xa9, 0xda, 0x6f, 0x21, 0x2b, 0x4a, 0x36, 0x7a, 0x0e, 0x19, 0x5e, + 0xb4, 0x03, 0x57, 0xb9, 0x3f, 0xcb, 0x65, 0x61, 0x81, 0x40, 0x1a, 0xdc, 0x0c, 0x1f, 0x59, 0x94, + 0xfd, 0x29, 0xd7, 0x58, 0x0a, 0xb6, 0x84, 0x12, 0xf1, 0xa6, 0xf5, 0x37, 0x50, 0x08, 0xfb, 0x36, + 0xb4, 0x0a, 0xb7, 0xf8, 0x41, 0xf4, 0x83, 0x76, 0x67, 0xef, 0x82, 0x21, 0x00, 0xb9, 0x5e, 0x13, + 0x1f, 0x35, 0x71, 0x55, 0xe1, 0xe3, 0xdd, 0xc3, 0x36, 0xf7, 0xff, 0x54, 0xfd, 0x19, 0xe4, 0x64, + 0xaf, 0x80, 0x10, 0x64, 0x86, 0xb6, 0x29, 0x03, 0x3d, 0x8b, 0xc5, 0x18, 0xa9, 0x90, 0x0f, 0x3c, + 0x2d, 0xa8, 0x6e, 0xe1, 0xb4, 0xfe, 0x0f, 0x05, 0x2a, 0xd3, 0x59, 0x1e, 0x7d, 0x84, 0xb2, 0x27, + 0xb2, 0x93, 0x2e, 0xcb, 0xc4, 0x1c, 0x79, 0xad, 0xb5, 0x80, 0x4b, 0x92, 0x43, 0x52, 0x7e, 0x17, + 0x8a, 0x16, 0x65, 0x7a, 0x5c, 0x76, 0xd2, 0xad, 0x05, 0x5c, 0xb0, 0x28, 0x93, 0xdb, 0x77, 0x01, + 0x06, 0xb6, 0x3d, 0x0e, 0xf6, 0xb9, 0x63, 0x16, 0x5a, 0x0b, 0xb8, 0x38, 0x08, 0x5b, 0x0e, 0x74, + 0x0f, 0xca, 0xa6, 0xed, 0x0f, 0xc6, 0x24, 0x10, 0xe1, 0x6e, 0xa7, 0x70, 0x25, 0x72, 0x55, 0x08, + 0x45, 0x41, 0x5f, 0xff, 0x63, 0x0e, 0x20, 0xee, 0x02, 0x51, 0x9f, 0xdb, 0xc3, 0x3b, 0xc8, 0x63, + 0xd7, 0x98, 0x88, 0x26, 0x82, 0xdb, 0xb3, 0x35, 0x53, 0x0b, 0x29, 0x87, 0xfb, 0x02, 0x88, 0x65, + 0x23, 0x2a, 0x27, 0x68, 0x03, 0x6e, 0x26, 0xfa, 0x52, 0xfd, 0xc4, 0xf0, 0x4e, 0xf4, 0x28, 0x1f, + 0x56, 0xe3, 0xc6, 0xb3, 0x65, 0x78, 0x27, 0x6d, 0xb3, 0xf6, 0x9f, 0x74, 0x70, 0x26, 0x01, 0x47, + 0x1f, 0x61, 0xf1, 0xd8, 0xa7, 0x43, 0x9e, 0x14, 0x74, 0xf1, 0x71, 0x30, 0x4f, 0xf1, 0x28, 0x87, + 0x14, 0x1d, 0x4e, 0x39, 0x80, 0x15, 0xdb, 0xb5, 0x46, 0x16, 0x35, 0xc6, 0xfa, 0x34, 0x77, 0x6a, + 0x0e, 0xee, 0xe5, 0x90, 0x6b, 0x3f, 0xa9, 0xa3, 0x0d, 0xc5, 0x63, 0x6b, 0x4c, 0x24, 0x6d, 0x7a, + 0x0e, 0xda, 0x02, 0x87, 0x0b, 0xaa, 0xbb, 0x50, 0x1a, 0x5b, 0x94, 0xe8, 0xd4, 0x9f, 0x0c, 0x88, + 0x2b, 0x5e, 0x34, 0x8d, 0x81, 0x2f, 0x75, 0xc4, 0x0a, 0xba, 0x07, 0x8b, 0x43, 0x7b, 0xec, 0x4f, + 0x68, 0x28, 0x92, 0x15, 0x22, 0x65, 0xb9, 0x18, 0x08, 0x35, 0xa0, 0x34, 0xb6, 0x0d, 0x53, 0x9f, + 0xd8, 0xa6, 0x3f, 0x0e, 0xbf, 0x51, 0xae, 0x6a, 0xa8, 0xdf, 0x0b, 0x41, 0x0c, 0x1c, 0x25, 0xc7, + 0xa8, 0x07, 0x15, 0xd9, 0x1a, 0xeb, 0x67, 0xc4, 0xf5, 0x78, 0x25, 0xcf, 0xcf, 0x61, 0xd9, 0xa2, + 0xe4, 0x38, 0x92, 0x14, 0xb5, 0xdf, 0x2b, 0x50, 0x4a, 0xf8, 0x0e, 0xda, 0x87, 0xac, 0x70, 0xbf, + 0x59, 0x5a, 0xd8, 0x2f, 0x79, 0x1f, 0x96, 0x70, 0xf4, 0x18, 0x96, 0xc3, 0xb4, 0x22, 0xdd, 0x79, + 0x2a, 0xaf, 0xa0, 0x60, 0x4f, 0x2a, 0x95, 0x89, 0xe5, 0xaf, 0x0a, 0xe4, 0x02, 0x4b, 0xf7, 0x20, + 0x17, 0x5c, 0xd4, 0x3c, 0xee, 0x16, 0x60, 0xd1, 0xcf, 0xa0, 0x30, 0xf0, 0x79, 0x9b, 0x1f, 0xb8, + 0xfb, 0xff, 0xcb, 0x93, 0x17, 0xe8, 0xb6, 0x59, 0xff, 0x15, 0x2c, 0x5d, 0xda, 0x8d, 0xdb, 0x70, + 0x25, 0xd1, 0x86, 0x73, 0xb3, 0x99, 0x14, 0x25, 0xa6, 0x3e, 0x38, 0x67, 0x64, 0xda, 0xec, 0x68, + 0xaf, 0x71, 0xce, 0x88, 0x30, 0xbb, 0xf1, 0x27, 0x05, 0xee, 0x58, 0xf6, 0xd7, 0x0f, 0xd6, 0x90, + 0x9f, 0x18, 0x5d, 0xbe, 0xd8, 0x55, 0x7e, 0xd9, 0x18, 0x59, 0xec, 0xc4, 0x1f, 0x68, 0x43, 0x7b, + 0xb2, 0x29, 0xe5, 0x37, 0x2c, 0xea, 0x31, 0xd7, 0x9f, 0x10, 0x2a, 0x8b, 0xf7, 0x66, 0x4c, 0xb5, + 0x21, 0xff, 0xe3, 0x18, 0x11, 0xba, 0x31, 0x8a, 0xff, 0x2c, 0xf9, 0x77, 0x6a, 0xf5, 0x83, 0x43, + 0xe8, 0xae, 0xd4, 0x26, 0x88, 0x65, 0xb1, 0xd2, 0x8e, 0xb6, 0x06, 0x39, 0x01, 0x79, 0xf2, 0xbf, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xcb, 0x56, 0xb6, 0xfd, 0x6c, 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 000000000000..025387784f81 --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace_config.pb.go @@ -0,0 +1,359 @@ +// 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{ + // 506 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xc1, 0x6e, 0xd3, 0x30, + 0x18, 0xc7, 0x97, 0x76, 0x6c, 0xec, 0x9b, 0xb6, 0x05, 0x57, 0x43, 0xa9, 0xb4, 0xc3, 0x94, 0x0b, + 0x13, 0x22, 0x09, 0x1d, 0x07, 0x84, 0x90, 0x90, 0xda, 0x6e, 0x15, 0x87, 0xd2, 0x56, 0xd9, 0x44, + 0x05, 0x97, 0xe0, 0x64, 0x6e, 0xb0, 0x68, 0xec, 0x60, 0x3b, 0xd5, 0x78, 0x0d, 0xce, 0x3c, 0x04, + 0xcf, 0xc5, 0x53, 0xa0, 0x3a, 0x21, 0x49, 0xdb, 0x6d, 0xe2, 0x96, 0xef, 0xfb, 0x7f, 0xbf, 0x9f, + 0xad, 0xd8, 0x86, 0x17, 0x3c, 0x25, 0x2c, 0x22, 0x4c, 0x66, 0xd2, 0x4b, 0x05, 0x57, 0xdc, 0x53, + 0x02, 0x47, 0xc4, 0x5b, 0x74, 0xf2, 0x8f, 0x20, 0xe2, 0x6c, 0x46, 0x63, 0x57, 0x67, 0xa8, 0x5d, + 0x4d, 0xe7, 0x1d, 0x57, 0x0f, 0xb9, 0x8b, 0x8e, 0xfd, 0x6b, 0x1b, 0xf6, 0xaf, 0x97, 0x45, 0x5f, + 0x03, 0xe8, 0x0b, 0xb4, 0x52, 0xc1, 0x43, 0x1c, 0xd2, 0x39, 0x55, 0x3f, 0x02, 0x89, 0x93, 0x74, + 0x4e, 0x84, 0x65, 0x9c, 0x1a, 0x67, 0xfb, 0xe7, 0x8e, 0x7b, 0xaf, 0xc8, 0x9d, 0x54, 0xd4, 0x55, + 0x0e, 0xbd, 0xdf, 0xf2, 0x51, 0xba, 0xd1, 0x45, 0x53, 0x30, 0x23, 0xce, 0xa4, 0xc2, 0x4c, 0x95, + 0xfa, 0x86, 0xd6, 0x3f, 0x7f, 0x40, 0xdf, 0x2f, 0x90, 0xca, 0x7d, 0x14, 0xad, 0xb6, 0xd0, 0x0d, + 0x1c, 0x0b, 0xac, 0x48, 0x30, 0xa7, 0x09, 0x55, 0x94, 0xc5, 0xa5, 0xbd, 0xa9, 0xed, 0xee, 0x03, + 0x76, 0x1f, 0x2b, 0x32, 0x2c, 0xb0, 0x6a, 0x85, 0x96, 0xd8, 0x6c, 0xa3, 0xd7, 0x60, 0x25, 0xf8, + 0x36, 0x60, 0x59, 0x12, 0x12, 0x11, 0xf0, 0x59, 0x80, 0x95, 0x12, 0x34, 0xcc, 0x14, 0x91, 0xd6, + 0xf6, 0xa9, 0x71, 0xd6, 0xf4, 0x8f, 0x13, 0x7c, 0x3b, 0xd2, 0xf1, 0x78, 0xd6, 0x2d, 0x43, 0xf4, + 0x06, 0xda, 0x6b, 0x20, 0x63, 0x5c, 0x61, 0x45, 0x39, 0x93, 0xd6, 0x23, 0x4d, 0x3e, 0xad, 0x93, + 0x55, 0x8a, 0xde, 0xc1, 0xc9, 0x2a, 0x9a, 0x10, 0x29, 0x71, 0x4c, 0x02, 0xb2, 0x20, 0x4c, 0x49, + 0x6b, 0x47, 0xd3, 0x56, 0x8d, 0xfe, 0x90, 0x0f, 0x5c, 0xea, 0x1c, 0x39, 0xd0, 0x5a, 0xe5, 0xe7, + 0x94, 0x7d, 0x93, 0xd6, 0xae, 0xc6, 0xcc, 0x1a, 0x36, 0x5c, 0xf6, 0x7b, 0x7b, 0xb0, 0x5b, 0xfc, + 0x3a, 0x7b, 0x00, 0x68, 0xf3, 0x60, 0xd1, 0x4b, 0x68, 0xe9, 0x01, 0xca, 0xe2, 0x5a, 0xaa, 0x2f, + 0x89, 0xe1, 0xdf, 0x15, 0xd9, 0xbf, 0x0d, 0x38, 0x5a, 0x3b, 0x42, 0x34, 0x85, 0xc7, 0x37, 0x24, + 0xa2, 0x92, 0x72, 0xa6, 0xd1, 0xc3, 0xf3, 0xb7, 0xff, 0x7f, 0x01, 0xca, 0xfa, 0xa2, 0x50, 0xf8, + 0xa5, 0xcc, 0xbe, 0x00, 0x73, 0x3d, 0x45, 0x87, 0x00, 0xdd, 0xe1, 0xb4, 0xfb, 0xe9, 0x2a, 0x18, + 0x0f, 0x06, 0xe6, 0x16, 0x3a, 0x80, 0xbd, 0x7f, 0xf5, 0xc8, 0x34, 0xd0, 0x13, 0x38, 0x28, 0xca, + 0x49, 0xd7, 0xbf, 0x1c, 0x5d, 0x9b, 0x0d, 0xfb, 0x19, 0xb4, 0xee, 0xb8, 0x16, 0xc8, 0x84, 0xe6, + 0xf7, 0x54, 0xea, 0x0d, 0x37, 0xfd, 0xe5, 0x67, 0xef, 0xa7, 0x01, 0x27, 0x94, 0xdf, 0xbf, 0xf5, + 0x9e, 0x59, 0x7b, 0x60, 0x93, 0x65, 0x34, 0x31, 0x3e, 0xf7, 0x62, 0xaa, 0xbe, 0x66, 0xa1, 0x1b, + 0xf1, 0xc4, 0xcb, 0x29, 0x87, 0x32, 0xa9, 0x44, 0x96, 0x10, 0x96, 0x1f, 0xbb, 0x57, 0x09, 0x9d, + 0xfc, 0x89, 0xc7, 0x84, 0x39, 0x71, 0xf5, 0xd2, 0xff, 0x34, 0xda, 0xe3, 0x94, 0xb0, 0x7e, 0xbe, + 0xa6, 0x16, 0xbb, 0x7a, 0x25, 0xf7, 0x63, 0x27, 0xdc, 0xd1, 0xc8, 0xab, 0xbf, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x50, 0x0c, 0xfe, 0x32, 0x29, 0x04, 0x00, 0x00, +} diff --git a/vendor/github.com/cespare/xxhash/v2/.travis.yml b/vendor/github.com/cespare/xxhash/v2/.travis.yml new file mode 100644 index 000000000000..c516ea88da73 --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/.travis.yml @@ -0,0 +1,8 @@ +language: go +go: + - "1.x" + - master +env: + - TAGS="" + - TAGS="-tags purego" +script: go test $TAGS -v ./... diff --git a/vendor/github.com/cespare/xxhash/v2/LICENSE.txt b/vendor/github.com/cespare/xxhash/v2/LICENSE.txt new file mode 100644 index 000000000000..24b53065f40b --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2016 Caleb Spare + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/cespare/xxhash/v2/README.md b/vendor/github.com/cespare/xxhash/v2/README.md new file mode 100644 index 000000000000..2fd8693c21b2 --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/README.md @@ -0,0 +1,67 @@ +# xxhash + +[![GoDoc](https://godoc.org/github.com/cespare/xxhash?status.svg)](https://godoc.org/github.com/cespare/xxhash) +[![Build Status](https://travis-ci.org/cespare/xxhash.svg?branch=master)](https://travis-ci.org/cespare/xxhash) + +xxhash is a Go implementation of the 64-bit +[xxHash](http://cyan4973.github.io/xxHash/) algorithm, XXH64. This is a +high-quality hashing algorithm that is much faster than anything in the Go +standard library. + +This package provides a straightforward API: + +``` +func Sum64(b []byte) uint64 +func Sum64String(s string) uint64 +type Digest struct{ ... } + func New() *Digest +``` + +The `Digest` type implements hash.Hash64. Its key methods are: + +``` +func (*Digest) Write([]byte) (int, error) +func (*Digest) WriteString(string) (int, error) +func (*Digest) Sum64() uint64 +``` + +This implementation provides a fast pure-Go implementation and an even faster +assembly implementation for amd64. + +## Compatibility + +This package is in a module and the latest code is in version 2 of the module. +You need a version of Go with at least "minimal module compatibility" to use +github.com/cespare/xxhash/v2: + +* 1.9.7+ for Go 1.9 +* 1.10.3+ for Go 1.10 +* Go 1.11 or later + +I recommend using the latest release of Go. + +## Benchmarks + +Here are some quick benchmarks comparing the pure-Go and assembly +implementations of Sum64. + +| input size | purego | asm | +| --- | --- | --- | +| 5 B | 979.66 MB/s | 1291.17 MB/s | +| 100 B | 7475.26 MB/s | 7973.40 MB/s | +| 4 KB | 17573.46 MB/s | 17602.65 MB/s | +| 10 MB | 17131.46 MB/s | 17142.16 MB/s | + +These numbers were generated on Ubuntu 18.04 with an Intel i7-8700K CPU using +the following commands under Go 1.11.2: + +``` +$ go test -tags purego -benchtime 10s -bench '/xxhash,direct,bytes' +$ go test -benchtime 10s -bench '/xxhash,direct,bytes' +``` + +## Projects using this package + +- [InfluxDB](https://github.com/influxdata/influxdb) +- [Prometheus](https://github.com/prometheus/prometheus) +- [FreeCache](https://github.com/coocood/freecache) diff --git a/vendor/github.com/cespare/xxhash/v2/go.mod b/vendor/github.com/cespare/xxhash/v2/go.mod new file mode 100644 index 000000000000..49f67608bf6b --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/go.mod @@ -0,0 +1,3 @@ +module github.com/cespare/xxhash/v2 + +go 1.11 diff --git a/vendor/github.com/godbus/dbus/go.sum b/vendor/github.com/cespare/xxhash/v2/go.sum similarity index 100% rename from vendor/github.com/godbus/dbus/go.sum rename to vendor/github.com/cespare/xxhash/v2/go.sum diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash.go b/vendor/github.com/cespare/xxhash/v2/xxhash.go new file mode 100644 index 000000000000..db0b35fbe39f --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/xxhash.go @@ -0,0 +1,236 @@ +// Package xxhash implements the 64-bit variant of xxHash (XXH64) as described +// at http://cyan4973.github.io/xxHash/. +package xxhash + +import ( + "encoding/binary" + "errors" + "math/bits" +) + +const ( + prime1 uint64 = 11400714785074694791 + prime2 uint64 = 14029467366897019727 + prime3 uint64 = 1609587929392839161 + prime4 uint64 = 9650029242287828579 + prime5 uint64 = 2870177450012600261 +) + +// NOTE(caleb): I'm using both consts and vars of the primes. Using consts where +// possible in the Go code is worth a small (but measurable) performance boost +// by avoiding some MOVQs. Vars are needed for the asm and also are useful for +// convenience in the Go code in a few places where we need to intentionally +// avoid constant arithmetic (e.g., v1 := prime1 + prime2 fails because the +// result overflows a uint64). +var ( + prime1v = prime1 + prime2v = prime2 + prime3v = prime3 + prime4v = prime4 + prime5v = prime5 +) + +// Digest implements hash.Hash64. +type Digest struct { + v1 uint64 + v2 uint64 + v3 uint64 + v4 uint64 + total uint64 + mem [32]byte + n int // how much of mem is used +} + +// New creates a new Digest that computes the 64-bit xxHash algorithm. +func New() *Digest { + var d Digest + d.Reset() + return &d +} + +// Reset clears the Digest's state so that it can be reused. +func (d *Digest) Reset() { + d.v1 = prime1v + prime2 + d.v2 = prime2 + d.v3 = 0 + d.v4 = -prime1v + d.total = 0 + d.n = 0 +} + +// Size always returns 8 bytes. +func (d *Digest) Size() int { return 8 } + +// BlockSize always returns 32 bytes. +func (d *Digest) BlockSize() int { return 32 } + +// Write adds more data to d. It always returns len(b), nil. +func (d *Digest) Write(b []byte) (n int, err error) { + n = len(b) + d.total += uint64(n) + + if d.n+n < 32 { + // This new data doesn't even fill the current block. + copy(d.mem[d.n:], b) + d.n += n + return + } + + if d.n > 0 { + // Finish off the partial block. + copy(d.mem[d.n:], b) + d.v1 = round(d.v1, u64(d.mem[0:8])) + d.v2 = round(d.v2, u64(d.mem[8:16])) + d.v3 = round(d.v3, u64(d.mem[16:24])) + d.v4 = round(d.v4, u64(d.mem[24:32])) + b = b[32-d.n:] + d.n = 0 + } + + if len(b) >= 32 { + // One or more full blocks left. + nw := writeBlocks(d, b) + b = b[nw:] + } + + // Store any remaining partial block. + copy(d.mem[:], b) + d.n = len(b) + + return +} + +// Sum appends the current hash to b and returns the resulting slice. +func (d *Digest) Sum(b []byte) []byte { + s := d.Sum64() + return append( + b, + byte(s>>56), + byte(s>>48), + byte(s>>40), + byte(s>>32), + byte(s>>24), + byte(s>>16), + byte(s>>8), + byte(s), + ) +} + +// Sum64 returns the current hash. +func (d *Digest) Sum64() uint64 { + var h uint64 + + if d.total >= 32 { + v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 + h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) + h = mergeRound(h, v1) + h = mergeRound(h, v2) + h = mergeRound(h, v3) + h = mergeRound(h, v4) + } else { + h = d.v3 + prime5 + } + + h += d.total + + i, end := 0, d.n + for ; i+8 <= end; i += 8 { + k1 := round(0, u64(d.mem[i:i+8])) + h ^= k1 + h = rol27(h)*prime1 + prime4 + } + if i+4 <= end { + h ^= uint64(u32(d.mem[i:i+4])) * prime1 + h = rol23(h)*prime2 + prime3 + i += 4 + } + for i < end { + h ^= uint64(d.mem[i]) * prime5 + h = rol11(h) * prime1 + i++ + } + + h ^= h >> 33 + h *= prime2 + h ^= h >> 29 + h *= prime3 + h ^= h >> 32 + + return h +} + +const ( + magic = "xxh\x06" + marshaledSize = len(magic) + 8*5 + 32 +) + +// MarshalBinary implements the encoding.BinaryMarshaler interface. +func (d *Digest) MarshalBinary() ([]byte, error) { + b := make([]byte, 0, marshaledSize) + b = append(b, magic...) + b = appendUint64(b, d.v1) + b = appendUint64(b, d.v2) + b = appendUint64(b, d.v3) + b = appendUint64(b, d.v4) + b = appendUint64(b, d.total) + b = append(b, d.mem[:d.n]...) + b = b[:len(b)+len(d.mem)-d.n] + return b, nil +} + +// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. +func (d *Digest) UnmarshalBinary(b []byte) error { + if len(b) < len(magic) || string(b[:len(magic)]) != magic { + return errors.New("xxhash: invalid hash state identifier") + } + if len(b) != marshaledSize { + return errors.New("xxhash: invalid hash state size") + } + b = b[len(magic):] + b, d.v1 = consumeUint64(b) + b, d.v2 = consumeUint64(b) + b, d.v3 = consumeUint64(b) + b, d.v4 = consumeUint64(b) + b, d.total = consumeUint64(b) + copy(d.mem[:], b) + b = b[len(d.mem):] + d.n = int(d.total % uint64(len(d.mem))) + return nil +} + +func appendUint64(b []byte, x uint64) []byte { + var a [8]byte + binary.LittleEndian.PutUint64(a[:], x) + return append(b, a[:]...) +} + +func consumeUint64(b []byte) ([]byte, uint64) { + x := u64(b) + return b[8:], x +} + +func u64(b []byte) uint64 { return binary.LittleEndian.Uint64(b) } +func u32(b []byte) uint32 { return binary.LittleEndian.Uint32(b) } + +func round(acc, input uint64) uint64 { + acc += input * prime2 + acc = rol31(acc) + acc *= prime1 + return acc +} + +func mergeRound(acc, val uint64) uint64 { + val = round(0, val) + acc ^= val + acc = acc*prime1 + prime4 + return acc +} + +func rol1(x uint64) uint64 { return bits.RotateLeft64(x, 1) } +func rol7(x uint64) uint64 { return bits.RotateLeft64(x, 7) } +func rol11(x uint64) uint64 { return bits.RotateLeft64(x, 11) } +func rol12(x uint64) uint64 { return bits.RotateLeft64(x, 12) } +func rol18(x uint64) uint64 { return bits.RotateLeft64(x, 18) } +func rol23(x uint64) uint64 { return bits.RotateLeft64(x, 23) } +func rol27(x uint64) uint64 { return bits.RotateLeft64(x, 27) } +func rol31(x uint64) uint64 { return bits.RotateLeft64(x, 31) } diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go b/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go new file mode 100644 index 000000000000..ad14b807f4d9 --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go @@ -0,0 +1,13 @@ +// +build !appengine +// +build gc +// +build !purego + +package xxhash + +// Sum64 computes the 64-bit xxHash digest of b. +// +//go:noescape +func Sum64(b []byte) uint64 + +//go:noescape +func writeBlocks(d *Digest, b []byte) int diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s b/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s new file mode 100644 index 000000000000..d580e32aed4a --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s @@ -0,0 +1,215 @@ +// +build !appengine +// +build gc +// +build !purego + +#include "textflag.h" + +// Register allocation: +// AX h +// CX pointer to advance through b +// DX n +// BX loop end +// R8 v1, k1 +// R9 v2 +// R10 v3 +// R11 v4 +// R12 tmp +// R13 prime1v +// R14 prime2v +// R15 prime4v + +// round reads from and advances the buffer pointer in CX. +// It assumes that R13 has prime1v and R14 has prime2v. +#define round(r) \ + MOVQ (CX), R12 \ + ADDQ $8, CX \ + IMULQ R14, R12 \ + ADDQ R12, r \ + ROLQ $31, r \ + IMULQ R13, r + +// mergeRound applies a merge round on the two registers acc and val. +// It assumes that R13 has prime1v, R14 has prime2v, and R15 has prime4v. +#define mergeRound(acc, val) \ + IMULQ R14, val \ + ROLQ $31, val \ + IMULQ R13, val \ + XORQ val, acc \ + IMULQ R13, acc \ + ADDQ R15, acc + +// func Sum64(b []byte) uint64 +TEXT ·Sum64(SB), NOSPLIT, $0-32 + // Load fixed primes. + MOVQ ·prime1v(SB), R13 + MOVQ ·prime2v(SB), R14 + MOVQ ·prime4v(SB), R15 + + // Load slice. + MOVQ b_base+0(FP), CX + MOVQ b_len+8(FP), DX + LEAQ (CX)(DX*1), BX + + // The first loop limit will be len(b)-32. + SUBQ $32, BX + + // Check whether we have at least one block. + CMPQ DX, $32 + JLT noBlocks + + // Set up initial state (v1, v2, v3, v4). + MOVQ R13, R8 + ADDQ R14, R8 + MOVQ R14, R9 + XORQ R10, R10 + XORQ R11, R11 + SUBQ R13, R11 + + // Loop until CX > BX. +blockLoop: + round(R8) + round(R9) + round(R10) + round(R11) + + CMPQ CX, BX + JLE blockLoop + + MOVQ R8, AX + ROLQ $1, AX + MOVQ R9, R12 + ROLQ $7, R12 + ADDQ R12, AX + MOVQ R10, R12 + ROLQ $12, R12 + ADDQ R12, AX + MOVQ R11, R12 + ROLQ $18, R12 + ADDQ R12, AX + + mergeRound(AX, R8) + mergeRound(AX, R9) + mergeRound(AX, R10) + mergeRound(AX, R11) + + JMP afterBlocks + +noBlocks: + MOVQ ·prime5v(SB), AX + +afterBlocks: + ADDQ DX, AX + + // Right now BX has len(b)-32, and we want to loop until CX > len(b)-8. + ADDQ $24, BX + + CMPQ CX, BX + JG fourByte + +wordLoop: + // Calculate k1. + MOVQ (CX), R8 + ADDQ $8, CX + IMULQ R14, R8 + ROLQ $31, R8 + IMULQ R13, R8 + + XORQ R8, AX + ROLQ $27, AX + IMULQ R13, AX + ADDQ R15, AX + + CMPQ CX, BX + JLE wordLoop + +fourByte: + ADDQ $4, BX + CMPQ CX, BX + JG singles + + MOVL (CX), R8 + ADDQ $4, CX + IMULQ R13, R8 + XORQ R8, AX + + ROLQ $23, AX + IMULQ R14, AX + ADDQ ·prime3v(SB), AX + +singles: + ADDQ $4, BX + CMPQ CX, BX + JGE finalize + +singlesLoop: + MOVBQZX (CX), R12 + ADDQ $1, CX + IMULQ ·prime5v(SB), R12 + XORQ R12, AX + + ROLQ $11, AX + IMULQ R13, AX + + CMPQ CX, BX + JL singlesLoop + +finalize: + MOVQ AX, R12 + SHRQ $33, R12 + XORQ R12, AX + IMULQ R14, AX + MOVQ AX, R12 + SHRQ $29, R12 + XORQ R12, AX + IMULQ ·prime3v(SB), AX + MOVQ AX, R12 + SHRQ $32, R12 + XORQ R12, AX + + MOVQ AX, ret+24(FP) + RET + +// writeBlocks uses the same registers as above except that it uses AX to store +// the d pointer. + +// func writeBlocks(d *Digest, b []byte) int +TEXT ·writeBlocks(SB), NOSPLIT, $0-40 + // Load fixed primes needed for round. + MOVQ ·prime1v(SB), R13 + MOVQ ·prime2v(SB), R14 + + // Load slice. + MOVQ b_base+8(FP), CX + MOVQ b_len+16(FP), DX + LEAQ (CX)(DX*1), BX + SUBQ $32, BX + + // Load vN from d. + MOVQ d+0(FP), AX + MOVQ 0(AX), R8 // v1 + MOVQ 8(AX), R9 // v2 + MOVQ 16(AX), R10 // v3 + MOVQ 24(AX), R11 // v4 + + // We don't need to check the loop condition here; this function is + // always called with at least one block of data to process. +blockLoop: + round(R8) + round(R9) + round(R10) + round(R11) + + CMPQ CX, BX + JLE blockLoop + + // Copy vN back to d. + MOVQ R8, 0(AX) + MOVQ R9, 8(AX) + MOVQ R10, 16(AX) + MOVQ R11, 24(AX) + + // The number of bytes written is CX minus the old base pointer. + SUBQ b_base+8(FP), CX + MOVQ CX, ret+32(FP) + + RET diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_other.go b/vendor/github.com/cespare/xxhash/v2/xxhash_other.go new file mode 100644 index 000000000000..4a5a821603e5 --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_other.go @@ -0,0 +1,76 @@ +// +build !amd64 appengine !gc purego + +package xxhash + +// Sum64 computes the 64-bit xxHash digest of b. +func Sum64(b []byte) uint64 { + // A simpler version would be + // d := New() + // d.Write(b) + // return d.Sum64() + // but this is faster, particularly for small inputs. + + n := len(b) + var h uint64 + + if n >= 32 { + v1 := prime1v + prime2 + v2 := prime2 + v3 := uint64(0) + v4 := -prime1v + for len(b) >= 32 { + v1 = round(v1, u64(b[0:8:len(b)])) + v2 = round(v2, u64(b[8:16:len(b)])) + v3 = round(v3, u64(b[16:24:len(b)])) + v4 = round(v4, u64(b[24:32:len(b)])) + b = b[32:len(b):len(b)] + } + h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) + h = mergeRound(h, v1) + h = mergeRound(h, v2) + h = mergeRound(h, v3) + h = mergeRound(h, v4) + } else { + h = prime5 + } + + h += uint64(n) + + i, end := 0, len(b) + for ; i+8 <= end; i += 8 { + k1 := round(0, u64(b[i:i+8:len(b)])) + h ^= k1 + h = rol27(h)*prime1 + prime4 + } + if i+4 <= end { + h ^= uint64(u32(b[i:i+4:len(b)])) * prime1 + h = rol23(h)*prime2 + prime3 + i += 4 + } + for ; i < end; i++ { + h ^= uint64(b[i]) * prime5 + h = rol11(h) * prime1 + } + + h ^= h >> 33 + h *= prime2 + h ^= h >> 29 + h *= prime3 + h ^= h >> 32 + + return h +} + +func writeBlocks(d *Digest, b []byte) int { + v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 + n := len(b) + for len(b) >= 32 { + v1 = round(v1, u64(b[0:8:len(b)])) + v2 = round(v2, u64(b[8:16:len(b)])) + v3 = round(v3, u64(b[16:24:len(b)])) + v4 = round(v4, u64(b[24:32:len(b)])) + b = b[32:len(b):len(b)] + } + d.v1, d.v2, d.v3, d.v4 = v1, v2, v3, v4 + return n - len(b) +} diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go new file mode 100644 index 000000000000..fc9bea7a31f2 --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_safe.go @@ -0,0 +1,15 @@ +// +build appengine + +// This file contains the safe implementations of otherwise unsafe-using code. + +package xxhash + +// Sum64String computes the 64-bit xxHash digest of s. +func Sum64String(s string) uint64 { + return Sum64([]byte(s)) +} + +// WriteString adds more data to d. It always returns len(s), nil. +func (d *Digest) WriteString(s string) (n int, err error) { + return d.Write([]byte(s)) +} diff --git a/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go b/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go new file mode 100644 index 000000000000..53bf76efbc24 --- /dev/null +++ b/vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go @@ -0,0 +1,46 @@ +// +build !appengine + +// This file encapsulates usage of unsafe. +// xxhash_safe.go contains the safe implementations. + +package xxhash + +import ( + "reflect" + "unsafe" +) + +// Notes: +// +// See https://groups.google.com/d/msg/golang-nuts/dcjzJy-bSpw/tcZYBzQqAQAJ +// for some discussion about these unsafe conversions. +// +// In the future it's possible that compiler optimizations will make these +// unsafe operations unnecessary: https://golang.org/issue/2205. +// +// Both of these wrapper functions still incur function call overhead since they +// will not be inlined. We could write Go/asm copies of Sum64 and Digest.Write +// for strings to squeeze out a bit more speed. Mid-stack inlining should +// eventually fix this. + +// Sum64String computes the 64-bit xxHash digest of s. +// It may be faster than Sum64([]byte(s)) by avoiding a copy. +func Sum64String(s string) uint64 { + var b []byte + bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) + bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data + bh.Len = len(s) + bh.Cap = len(s) + return Sum64(b) +} + +// WriteString adds more data to d. It always returns len(s), nil. +// It may be faster than Write([]byte(s)) by avoiding a copy. +func (d *Digest) WriteString(s string) (n int, err error) { + var b []byte + bh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) + bh.Data = (*reflect.StringHeader)(unsafe.Pointer(&s)).Data + bh.Len = len(s) + bh.Cap = len(s) + return d.Write(b) +} diff --git a/vendor/github.com/circonus-labs/circonus-gometrics/.gitignore b/vendor/github.com/circonus-labs/circonus-gometrics/.gitignore new file mode 100644 index 000000000000..af1728d9436c --- /dev/null +++ b/vendor/github.com/circonus-labs/circonus-gometrics/.gitignore @@ -0,0 +1,11 @@ +.DS_Store +env.sh +NOTES.md + +# codecov.io +.codecov +coverage.txt +coverage.xml +coverage.html + +vendor/ diff --git a/vendor/github.com/circonus-labs/circonus-gometrics/CHANGELOG.md b/vendor/github.com/circonus-labs/circonus-gometrics/CHANGELOG.md index 8aa09ea0e04b..dbaaa1240ad9 100644 --- a/vendor/github.com/circonus-labs/circonus-gometrics/CHANGELOG.md +++ b/vendor/github.com/circonus-labs/circonus-gometrics/CHANGELOG.md @@ -1,3 +1,16 @@ +# v2.3.1 + +* fix: incorrect attribute types in graph overlays (docs vs what api actually returns) + +# v2.3.0 + +* fix: graph structures incorrectly represented nesting of overlay sets + +# v2.2.7 + +* add: `search` (`*string`) attribute to graph datapoint +* add: `cluster_ip` (`*string`) attribute to broker details + # v2.2.6 * fix: func signature to match go-retryablehttp update diff --git a/vendor/github.com/circonus-labs/circonus-gometrics/api/broker.go b/vendor/github.com/circonus-labs/circonus-gometrics/api/broker.go index 459fda6df87c..bc444e317184 100644 --- a/vendor/github.com/circonus-labs/circonus-gometrics/api/broker.go +++ b/vendor/github.com/circonus-labs/circonus-gometrics/api/broker.go @@ -18,6 +18,7 @@ import ( // BrokerDetail defines instance attributes type BrokerDetail struct { + ClusterIP *string `json:"cluster_ip"` // string or null CN string `json:"cn"` // string ExternalHost *string `json:"external_host"` // string or null ExternalPort uint16 `json:"external_port"` // uint16 diff --git a/vendor/github.com/circonus-labs/circonus-gometrics/api/graph.go b/vendor/github.com/circonus-labs/circonus-gometrics/api/graph.go index 643eff4bba6b..8c8353ef5f3a 100644 --- a/vendor/github.com/circonus-labs/circonus-gometrics/api/graph.go +++ b/vendor/github.com/circonus-labs/circonus-gometrics/api/graph.go @@ -60,6 +60,7 @@ type GraphDatapoint struct { MetricName string `json:"metric_name,omitempty"` // string MetricType string `json:"metric_type,omitempty"` // string Name string `json:"name"` // string + Search *string `json:"search"` // string or null Stack *uint `json:"stack"` // uint or null } @@ -85,37 +86,18 @@ type GraphMetricCluster struct { Stack *uint `json:"stack"` // uint or null } -// OverlayDataOptions defines overlay options for data. Note, each overlay type requires -// a _subset_ of the options. See Graph API documentation (URL above) for details. -type OverlayDataOptions struct { - Alerts *int `json:"alerts,string,omitempty"` // int encoded as string BUG doc: numeric, api: string - ArrayOutput *int `json:"array_output,string,omitempty"` // int encoded as string BUG doc: numeric, api: string - BasePeriod *int `json:"base_period,string,omitempty"` // int encoded as string BUG doc: numeric, api: string - Delay *int `json:"delay,string,omitempty"` // int encoded as string BUG doc: numeric, api: string - Extension string `json:"extension,omitempty"` // string - GraphTitle string `json:"graph_title,omitempty"` // string - GraphUUID string `json:"graph_id,omitempty"` // string - InPercent *bool `json:"in_percent,string,omitempty"` // boolean encoded as string BUG doc: boolean, api: string - Inverse *int `json:"inverse,string,omitempty"` // int encoded as string BUG doc: numeric, api: string - Method string `json:"method,omitempty"` // string - Model string `json:"model,omitempty"` // string - ModelEnd string `json:"model_end,omitempty"` // string - ModelPeriod string `json:"model_period,omitempty"` // string - ModelRelative *int `json:"model_relative,string,omitempty"` // int encoded as string BUG doc: numeric, api: string - Out string `json:"out,omitempty"` // string - Prequel string `json:"prequel,omitempty"` // string - Presets string `json:"presets,omitempty"` // string - Quantiles string `json:"quantiles,omitempty"` // string - SeasonLength *int `json:"season_length,string,omitempty"` // int encoded as string BUG doc: numeric, api: string - Sensitivity *int `json:"sensitivity,string,omitempty"` // int encoded as string BUG doc: numeric, api: string - SingleValue *int `json:"single_value,string,omitempty"` // int encoded as string BUG doc: numeric, api: string - TargetPeriod string `json:"target_period,omitempty"` // string - TimeOffset string `json:"time_offset,omitempty"` // string - TimeShift *int `json:"time_shift,string,omitempty"` // int encoded as string BUG doc: numeric, api: string - Transform string `json:"transform,omitempty"` // string - Version *int `json:"version,string,omitempty"` // int encoded as string BUG doc: numeric, api: string - Window *int `json:"window,string,omitempty"` // int encoded as string BUG doc: numeric, api: string - XShift string `json:"x_shift,omitempty"` // string +// GraphOverlaySet defines an overlay set for a graph +type GraphOverlaySet struct { + Overlays map[string]GraphOverlay `json:"overlays"` + Title string `json:"title"` +} + +// GraphOverlay defines a single overlay in an overlay set +type GraphOverlay struct { + DataOpts OverlayDataOptions `json:"data_opts,omitempty"` // OverlayDataOptions + ID string `json:"id,omitempty"` // string + Title string `json:"title,omitempty"` // string + UISpecs OverlayUISpecs `json:"ui_specs,omitempty"` // OverlayUISpecs } // OverlayUISpecs defines UI specs for overlay @@ -124,15 +106,40 @@ type OverlayUISpecs struct { ID string `json:"id,omitempty"` // string Label string `json:"label,omitempty"` // string Type string `json:"type,omitempty"` // string - Z *int `json:"z,string,omitempty"` // int encoded as string BUG doc: numeric, api: string + Z string `json:"z,omitempty"` // int encoded as string BUG doc: numeric, api: string } -// GraphOverlaySet defines overlays for graph -type GraphOverlaySet struct { - DataOpts OverlayDataOptions `json:"data_opts,omitempty"` // OverlayDataOptions - ID string `json:"id,omitempty"` // string - Title string `json:"title,omitempty"` // string - UISpecs OverlayUISpecs `json:"ui_specs,omitempty"` // OverlayUISpecs +// OverlayDataOptions defines overlay options for data. Note, each overlay type requires +// a _subset_ of the options. See Graph API documentation (URL above) for details. +type OverlayDataOptions struct { + Alerts string `json:"alerts,omitempty"` // int encoded as string BUG doc: numeric, api: string + ArrayOutput string `json:"array_output,omitempty"` // int encoded as string BUG doc: numeric, api: string + BasePeriod string `json:"base_period,omitempty"` // int encoded as string BUG doc: numeric, api: string + Delay string `json:"delay,omitempty"` // int encoded as string BUG doc: numeric, api: string + Extension string `json:"extension,omitempty"` // string + GraphTitle string `json:"graph_title,omitempty"` // string + GraphUUID string `json:"graph_id,omitempty"` // string + InPercent string `json:"in_percent,omitempty"` // boolean encoded as string BUG doc: boolean, api: string + Inverse string `json:"inverse,omitempty"` // int encoded as string BUG doc: numeric, api: string + Method string `json:"method,omitempty"` // string + Model string `json:"model,omitempty"` // string + ModelEnd string `json:"model_end,omitempty"` // string + ModelPeriod string `json:"model_period,omitempty"` // string + ModelRelative string `json:"model_relative,omitempty"` // int encoded as string BUG doc: numeric, api: string + Out string `json:"out,omitempty"` // string + Prequel string `json:"prequel,omitempty"` // int + Presets string `json:"presets,omitempty"` // string + Quantiles string `json:"quantiles,omitempty"` // string + SeasonLength string `json:"season_length,omitempty"` // int encoded as string BUG doc: numeric, api: string + Sensitivity string `json:"sensitivity,omitempty"` // int encoded as string BUG doc: numeric, api: string + SingleValue string `json:"single_value,omitempty"` // int encoded as string BUG doc: numeric, api: string + TargetPeriod string `json:"target_period,omitempty"` // string + TimeOffset string `json:"time_offset,omitempty"` // string + TimeShift string `json:"time_shift,omitempty"` // int encoded as string BUG doc: numeric, api: string + Transform string `json:"transform,omitempty"` // string + Version string `json:"version,omitempty"` // int encoded as string BUG doc: numeric, api: string + Window string `json:"window,omitempty"` // int encoded as string BUG doc: numeric, api: string + XShift string `json:"x_shift,omitempty"` // string } // Graph defines a graph. See https://login.circonus.com/resources/api/calls/graph for more information. diff --git a/vendor/github.com/circonus-labs/circonusllhist/circonusllhist.go b/vendor/github.com/circonus-labs/circonusllhist/circonusllhist.go index 2211bc5b8dc2..f5c372749d31 100644 --- a/vendor/github.com/circonus-labs/circonusllhist/circonusllhist.go +++ b/vendor/github.com/circonus-labs/circonusllhist/circonusllhist.go @@ -8,19 +8,24 @@ package circonusllhist import ( "bytes" + "encoding/base64" + "encoding/binary" + "encoding/json" "errors" "fmt" + "io" "math" "strconv" "strings" "sync" + "time" ) const ( - DEFAULT_HIST_SIZE = uint16(100) + defaultHistSize = uint16(100) ) -var power_of_ten = [...]float64{ +var powerOfTen = [...]float64{ 1, 10, 100, 1000, 10000, 100000, 1e+06, 1e+07, 1e+08, 1e+09, 1e+10, 1e+11, 1e+12, 1e+13, 1e+14, 1e+15, 1e+16, 1e+17, 1e+18, 1e+19, 1e+20, 1e+21, 1e+22, 1e+23, 1e+24, 1e+25, 1e+26, 1e+27, 1e+28, 1e+29, 1e+30, @@ -51,36 +56,39 @@ var power_of_ten = [...]float64{ } // A Bracket is a part of a cumulative distribution. -type Bin struct { +type bin struct { + count uint64 val int8 exp int8 - count uint64 } -func NewBinRaw(val int8, exp int8, count uint64) *Bin { - return &Bin{ +func newBinRaw(val int8, exp int8, count uint64) *bin { + return &bin{ + count: count, val: val, exp: exp, - count: count, } } -func NewBin() *Bin { - return NewBinRaw(0, 0, 0) + +func newBin() *bin { + return newBinRaw(0, 0, 0) } -func NewBinFromFloat64(d float64) *Bin { - hb := NewBinRaw(0, 0, 0) - hb.SetFromFloat64(d) + +func newBinFromFloat64(d float64) *bin { + hb := newBinRaw(0, 0, 0) + hb.setFromFloat64(d) return hb } -type FastL2 struct { +type fastL2 struct { l1, l2 int } -func (hb *Bin) fastl2() FastL2 { - return FastL2{l1: int(uint8(hb.exp)), l2: int(uint8(hb.val))} +func (hb *bin) newFastL2() fastL2 { + return fastL2{l1: int(uint8(hb.exp)), l2: int(uint8(hb.val))} } -func (hb *Bin) SetFromFloat64(d float64) *Bin { + +func (hb *bin) setFromFloat64(d float64) *bin { hb.val = -1 if math.IsInf(d, 0) || math.IsNaN(d) { return hb @@ -103,7 +111,7 @@ func (hb *Bin) SetFromFloat64(d float64) *Bin { } return hb } - d = d / hb.PowerOfTen() + d = d / hb.powerOfTen() d = d * 10 hb.val = int8(sign * int(math.Floor(d+1e-13))) if hb.val == 100 || hb.val == -100 { @@ -126,86 +134,96 @@ func (hb *Bin) SetFromFloat64(d float64) *Bin { } return hb } -func (hb *Bin) PowerOfTen() float64 { + +func (hb *bin) powerOfTen() float64 { idx := int(uint8(hb.exp)) - return power_of_ten[idx] + return powerOfTen[idx] } -func (hb *Bin) IsNaN() bool { - if hb.val > 99 || hb.val < -99 { +func (hb *bin) isNaN() bool { + // aval := abs(hb.val) + aval := hb.val + if aval < 0 { + aval = -aval + } + if 99 < aval { // in [100... ]: nan return true } + if 9 < aval { // in [10 - 99]: valid range + return false + } + if 0 < aval { // in [1 - 9 ]: nan + return true + } + if 0 == aval { // in [0] : zero bucket + return false + } return false } -func (hb *Bin) Val() int8 { - return hb.val -} -func (hb *Bin) Exp() int8 { - return hb.exp -} -func (hb *Bin) Count() uint64 { - return hb.count -} -func (hb *Bin) Value() float64 { - if hb.IsNaN() { + +func (hb *bin) value() float64 { + if hb.isNaN() { return math.NaN() } if hb.val < 10 && hb.val > -10 { return 0.0 } - return (float64(hb.val) / 10.0) * hb.PowerOfTen() + return (float64(hb.val) / 10.0) * hb.powerOfTen() } -func (hb *Bin) BinWidth() float64 { - if hb.IsNaN() { + +func (hb *bin) binWidth() float64 { + if hb.isNaN() { return math.NaN() } if hb.val < 10 && hb.val > -10 { return 0.0 } - return hb.PowerOfTen() / 10.0 + return hb.powerOfTen() / 10.0 } -func (hb *Bin) Midpoint() float64 { - if hb.IsNaN() { + +func (hb *bin) midpoint() float64 { + if hb.isNaN() { return math.NaN() } - out := hb.Value() + out := hb.value() if out == 0 { return 0 } - interval := hb.BinWidth() + interval := hb.binWidth() if out < 0 { interval = interval * -1 } return out + interval/2.0 } -func (hb *Bin) Left() float64 { - if hb.IsNaN() { + +func (hb *bin) left() float64 { + if hb.isNaN() { return math.NaN() } - out := hb.Value() + out := hb.value() if out >= 0 { return out } - return out - hb.BinWidth() + return out - hb.binWidth() } -func (h1 *Bin) Compare(h2 *Bin) int { +func (h1 *bin) compare(h2 *bin) int { var v1, v2 int - // slide exp positive, - // shift by size of val - // multiple by (val != 0) - // then add or subtract val accordingly + // 1) slide exp positive + // 2) shift by size of val multiple by (val != 0) + // 3) then add or subtract val accordingly if h1.val >= 0 { - v1 = ((int(h1.exp)+256)<<8)*int(((h1.val|(^h1.val+1))>>8)&1) + int(h1.val) + v1 = ((int(h1.exp)+256)<<8)*int(((int(h1.val)|(^int(h1.val)+1))>>8)&1) + int(h1.val) } else { - v1 = ((int(h1.exp)+256)<<8)*int(((h1.val|(^h1.val+1))>>8)&1) - int(h1.val) + v1 = ((int(h1.exp)+256)<<8)*int(((int(h1.val)|(^int(h1.val)+1))>>8)&1) - int(h1.val) } + if h2.val >= 0 { - v2 = ((int(h2.exp)+256)<<8)*int(((h2.val|(^h2.val+1))>>8)&1) + int(h2.val) + v2 = ((int(h2.exp)+256)<<8)*int(((int(h2.val)|(^int(h2.val)+1))>>8)&1) + int(h2.val) } else { - v2 = ((int(h2.exp)+256)<<8)*int(((h2.val|(^h2.val+1))>>8)&1) - int(h2.val) + v2 = ((int(h2.exp)+256)<<8)*int(((int(h2.val)|(^int(h2.val)+1))>>8)&1) - int(h2.val) } // return the difference @@ -215,22 +233,177 @@ func (h1 *Bin) Compare(h2 *Bin) int { // This histogram structure tracks values are two decimal digits of precision // with a bounded error that remains bounded upon composition type Histogram struct { - bvs []Bin + bvs []bin used uint16 allocd uint16 lookup [256][]uint16 - mutex sync.Mutex + mutex sync.RWMutex useLocks bool } +const ( + BVL1, BVL1MASK uint64 = iota, 0xff << (8 * iota) + BVL2, BVL2MASK + BVL3, BVL3MASK + BVL4, BVL4MASK + BVL5, BVL5MASK + BVL6, BVL6MASK + BVL7, BVL7MASK + BVL8, BVL8MASK +) + +func getBytesRequired(val uint64) (len int8) { + if 0 != (BVL8MASK|BVL7MASK|BVL6MASK|BVL5MASK)&val { + if 0 != BVL8MASK&val { + return int8(BVL8) + } + if 0 != BVL7MASK&val { + return int8(BVL7) + } + if 0 != BVL6MASK&val { + return int8(BVL6) + } + if 0 != BVL5MASK&val { + return int8(BVL5) + } + } else { + if 0 != BVL4MASK&val { + return int8(BVL4) + } + if 0 != BVL3MASK&val { + return int8(BVL3) + } + if 0 != BVL2MASK&val { + return int8(BVL2) + } + } + return int8(BVL1) +} + +func writeBin(out io.Writer, in bin, idx int) (err error) { + + err = binary.Write(out, binary.BigEndian, in.val) + if err != nil { + return + } + + err = binary.Write(out, binary.BigEndian, in.exp) + if err != nil { + return + } + + var tgtType int8 = getBytesRequired(in.count) + + err = binary.Write(out, binary.BigEndian, tgtType) + if err != nil { + return + } + + var bcount = make([]uint8, 8) + b := bcount[0 : tgtType+1] + for i := tgtType; i >= 0; i-- { + b[i] = uint8(uint64(in.count>>(uint8(i)*8)) & 0xff) + } + + err = binary.Write(out, binary.BigEndian, b) + if err != nil { + return + } + return +} + +func readBin(in io.Reader) (out bin, err error) { + err = binary.Read(in, binary.BigEndian, &out.val) + if err != nil { + return + } + + err = binary.Read(in, binary.BigEndian, &out.exp) + if err != nil { + return + } + var bvl uint8 + err = binary.Read(in, binary.BigEndian, &bvl) + if err != nil { + return + } + if bvl > uint8(BVL8) { + return out, errors.New("encoding error: bvl value is greater than max allowable") + } + + bcount := make([]byte, 8) + b := bcount[0 : bvl+1] + err = binary.Read(in, binary.BigEndian, b) + if err != nil { + return + } + + var count uint64 = 0 + for i := int(bvl + 1); i >= 0; i-- { + count |= (uint64(bcount[i]) << (uint8(i) * 8)) + } + + out.count = count + return +} + +func Deserialize(in io.Reader) (h *Histogram, err error) { + h = New() + if h.bvs == nil { + h.bvs = make([]bin, 0, defaultHistSize) + } + + var nbin int16 + err = binary.Read(in, binary.BigEndian, &nbin) + if err != nil { + return + } + + for ii := int16(0); ii < nbin; ii++ { + bb, err := readBin(in) + if err != nil { + return h, err + } + h.insertBin(&bb, int64(bb.count)) + } + return h, nil +} + +func (h *Histogram) Serialize(w io.Writer) error { + + var nbin int16 = int16(len(h.bvs)) + if err := binary.Write(w, binary.BigEndian, nbin); err != nil { + return err + } + + for i := 0; i < len(h.bvs); i++ { + if err := writeBin(w, h.bvs[i], i); err != nil { + return err + } + } + return nil +} + +func (h *Histogram) SerializeB64(w io.Writer) error { + buf := bytes.NewBuffer([]byte{}) + h.Serialize(buf) + + encoder := base64.NewEncoder(base64.StdEncoding, w) + if _, err := encoder.Write(buf.Bytes()); err != nil { + return err + } + encoder.Close() + return nil +} + // New returns a new Histogram func New() *Histogram { return &Histogram{ - allocd: DEFAULT_HIST_SIZE, + allocd: defaultHistSize, used: 0, - bvs: make([]Bin, DEFAULT_HIST_SIZE), + bvs: make([]bin, defaultHistSize), useLocks: true, } } @@ -238,9 +411,9 @@ func New() *Histogram { // New returns a Histogram without locking func NewNoLocks() *Histogram { return &Histogram{ - allocd: DEFAULT_HIST_SIZE, + allocd: defaultHistSize, used: 0, - bvs: make([]Bin, DEFAULT_HIST_SIZE), + bvs: make([]bin, defaultHistSize), useLocks: false, } } @@ -257,7 +430,7 @@ func NewFromStrings(strs []string, locks bool) (*Histogram, error) { } // NewFromBins returns a Histogram created from a bins struct slice -func newFromBins(bins []Bin, locks bool) *Histogram { +func newFromBins(bins []bin, locks bool) *Histogram { return &Histogram{ allocd: uint16(len(bins) + 10), // pad it with 10 used: uint16(len(bins)), @@ -299,7 +472,7 @@ func (h *Histogram) Reset() { // RecordIntScale records an integer scaler value, returning an error if the // value is out of range. -func (h *Histogram) RecordIntScale(val, scale int) error { +func (h *Histogram) RecordIntScale(val int64, scale int) error { return h.RecordIntScales(val, scale, 1) } @@ -309,6 +482,12 @@ func (h *Histogram) RecordValue(v float64) error { return h.RecordValues(v, 1) } +// RecordDuration records the given time.Duration in seconds, returning an error +// if the value is out of range. +func (h *Histogram) RecordDuration(v time.Duration) error { + return h.RecordIntScale(int64(v), -9) +} + // RecordCorrectedValue records the given value, correcting for stalls in the // recording process. This only works for processes which are recording values // at an expected interval (e.g., doing jitter analysis). Processes which are @@ -336,11 +515,11 @@ func (h *Histogram) RecordCorrectedValue(v, expectedInterval int64) error { } // find where a new bin should go -func (h *Histogram) InternalFind(hb *Bin) (bool, uint16) { +func (h *Histogram) internalFind(hb *bin) (bool, uint16) { if h.used == 0 { return false, 0 } - f2 := hb.fastl2() + f2 := hb.newFastL2() if h.lookup[f2.l1] != nil { if idx := h.lookup[f2.l1][f2.l2]; idx != 0 { return true, idx - 1 @@ -352,7 +531,7 @@ func (h *Histogram) InternalFind(hb *Bin) (bool, uint16) { r := int(h.used - 1) for l < r { check := (r + l) / 2 - rv = h.bvs[check].Compare(hb) + rv = h.bvs[check].compare(hb) if rv == 0 { l = check r = check @@ -363,7 +542,7 @@ func (h *Histogram) InternalFind(hb *Bin) (bool, uint16) { } } if rv != 0 { - rv = h.bvs[l].Compare(hb) + rv = h.bvs[l].compare(hb) } idx = uint16(l) if rv == 0 { @@ -376,22 +555,22 @@ func (h *Histogram) InternalFind(hb *Bin) (bool, uint16) { return false, idx } -func (h *Histogram) InsertBin(hb *Bin, count int64) uint64 { +func (h *Histogram) insertBin(hb *bin, count int64) uint64 { if h.useLocks { h.mutex.Lock() defer h.mutex.Unlock() } - found, idx := h.InternalFind(hb) + found, idx := h.internalFind(hb) if !found { if h.used == h.allocd { - new_bvs := make([]Bin, h.allocd+DEFAULT_HIST_SIZE) + new_bvs := make([]bin, h.allocd+defaultHistSize) if idx > 0 { copy(new_bvs[0:], h.bvs[0:idx]) } if idx < h.used { copy(new_bvs[idx+1:], h.bvs[idx:]) } - h.allocd = h.allocd + DEFAULT_HIST_SIZE + h.allocd = h.allocd + defaultHistSize h.bvs = new_bvs } else { copy(h.bvs[idx+1:], h.bvs[idx:h.used]) @@ -401,7 +580,7 @@ func (h *Histogram) InsertBin(hb *Bin, count int64) uint64 { h.bvs[idx].count = uint64(count) h.used++ for i := idx; i < h.used; i++ { - f2 := h.bvs[i].fastl2() + f2 := h.bvs[i].newFastL2() if h.lookup[f2.l1] == nil { h.lookup[f2.l1] = make([]uint16, 256) } @@ -424,11 +603,12 @@ func (h *Histogram) InsertBin(hb *Bin, count int64) uint64 { // RecordIntScales records n occurrences of the given value, returning an error if // the value is out of range. -func (h *Histogram) RecordIntScales(val, scale int, n int64) error { - sign := 1 +func (h *Histogram) RecordIntScales(val int64, scale int, n int64) error { + sign := int64(1) if val == 0 { scale = 0 } else { + scale++ if val < 0 { val = 0 - val sign = -1 @@ -437,7 +617,7 @@ func (h *Histogram) RecordIntScales(val, scale int, n int64) error { val *= 10 scale -= 1 } - for val > 100 { + for val >= 100 { val /= 10 scale++ } @@ -450,30 +630,30 @@ func (h *Histogram) RecordIntScales(val, scale int, n int64) error { scale = 0 } val *= sign - hb := Bin{val: int8(val), exp: int8(scale), count: 0} - h.InsertBin(&hb, n) + hb := bin{val: int8(val), exp: int8(scale), count: 0} + h.insertBin(&hb, n) return nil } // RecordValues records n occurrences of the given value, returning an error if // the value is out of range. func (h *Histogram) RecordValues(v float64, n int64) error { - var hb Bin - hb.SetFromFloat64(v) - h.InsertBin(&hb, n) + var hb bin + hb.setFromFloat64(v) + h.insertBin(&hb, n) return nil } // Approximate mean func (h *Histogram) ApproxMean() float64 { if h.useLocks { - h.mutex.Lock() - defer h.mutex.Unlock() + h.mutex.RLock() + defer h.mutex.RUnlock() } divisor := 0.0 sum := 0.0 for i := uint16(0); i < h.used; i++ { - midpoint := h.bvs[i].Midpoint() + midpoint := h.bvs[i].midpoint() cardinality := float64(h.bvs[i].count) divisor += cardinality sum += midpoint * cardinality @@ -487,12 +667,12 @@ func (h *Histogram) ApproxMean() float64 { // Approximate sum func (h *Histogram) ApproxSum() float64 { if h.useLocks { - h.mutex.Lock() - defer h.mutex.Unlock() + h.mutex.RLock() + defer h.mutex.RUnlock() } sum := 0.0 for i := uint16(0); i < h.used; i++ { - midpoint := h.bvs[i].Midpoint() + midpoint := h.bvs[i].midpoint() cardinality := float64(h.bvs[i].count) sum += midpoint * cardinality } @@ -501,8 +681,8 @@ func (h *Histogram) ApproxSum() float64 { func (h *Histogram) ApproxQuantile(q_in []float64) ([]float64, error) { if h.useLocks { - h.mutex.Lock() - defer h.mutex.Unlock() + h.mutex.RLock() + defer h.mutex.RUnlock() } q_out := make([]float64, len(q_in)) i_q, i_b := 0, uint16(0) @@ -518,7 +698,7 @@ func (h *Histogram) ApproxQuantile(q_in []float64) ([]float64, error) { } // Add up the bins for i_b = 0; i_b < h.used; i_b++ { - if !h.bvs[i_b].IsNaN() { + if !h.bvs[i_b].isNaN() { total_cnt += float64(h.bvs[i_b].count) } } @@ -534,11 +714,11 @@ func (h *Histogram) ApproxQuantile(q_in []float64) ([]float64, error) { } for i_b = 0; i_b < h.used; i_b++ { - if h.bvs[i_b].IsNaN() { + if h.bvs[i_b].isNaN() { continue } - bin_width = h.bvs[i_b].BinWidth() - bin_left = h.bvs[i_b].Left() + bin_width = h.bvs[i_b].binWidth() + bin_left = h.bvs[i_b].left() lower_cnt = upper_cnt upper_cnt = lower_cnt + float64(h.bvs[i_b].count) break @@ -546,8 +726,8 @@ func (h *Histogram) ApproxQuantile(q_in []float64) ([]float64, error) { for i_q = 0; i_q < len(q_in); i_q++ { for i_b < (h.used-1) && upper_cnt < q_out[i_q] { i_b++ - bin_width = h.bvs[i_b].BinWidth() - bin_left = h.bvs[i_b].Left() + bin_width = h.bvs[i_b].binWidth() + bin_left = h.bvs[i_b].left() lower_cnt = upper_cnt upper_cnt = lower_cnt + float64(h.bvs[i_b].count) } @@ -569,8 +749,8 @@ func (h *Histogram) ApproxQuantile(q_in []float64) ([]float64, error) { // ValueAtQuantile returns the recorded value at the given quantile (0..1). func (h *Histogram) ValueAtQuantile(q float64) float64 { if h.useLocks { - h.mutex.Lock() - defer h.mutex.Unlock() + h.mutex.RLock() + defer h.mutex.RUnlock() } q_in := make([]float64, 1) q_in[0] = q @@ -591,12 +771,12 @@ func (h *Histogram) SignificantFigures() int64 { // Equals returns true if the two Histograms are equivalent, false if not. func (h *Histogram) Equals(other *Histogram) bool { if h.useLocks { - h.mutex.Lock() - defer h.mutex.Unlock() + h.mutex.RLock() + defer h.mutex.RUnlock() } if other.useLocks { - other.mutex.Lock() - defer other.mutex.Unlock() + other.mutex.RLock() + defer other.mutex.RUnlock() } switch { case @@ -604,7 +784,7 @@ func (h *Histogram) Equals(other *Histogram) bool { return false default: for i := uint16(0); i < h.used; i++ { - if h.bvs[i].Compare(&other.bvs[i]) != 0 { + if h.bvs[i].compare(&other.bvs[i]) != 0 { return false } if h.bvs[i].count != other.bvs[i].count { @@ -615,28 +795,53 @@ func (h *Histogram) Equals(other *Histogram) bool { return true } -func (h *Histogram) CopyAndReset() *Histogram { +// Copy creates and returns an exact copy of a histogram. +func (h *Histogram) Copy() *Histogram { if h.useLocks { h.mutex.Lock() defer h.mutex.Unlock() } - newhist := &Histogram{ - allocd: h.allocd, - used: h.used, - bvs: h.bvs, + + newhist := New() + newhist.allocd = h.allocd + newhist.used = h.used + newhist.useLocks = h.useLocks + + newhist.bvs = []bin{} + for _, v := range h.bvs { + newhist.bvs = append(newhist.bvs, v) } - h.allocd = DEFAULT_HIST_SIZE - h.bvs = make([]Bin, DEFAULT_HIST_SIZE) - h.used = 0 - for i := 0; i < 256; i++ { - if h.lookup[i] != nil { - for j := range h.lookup[i] { - h.lookup[i][j] = 0 - } + + for i, u := range h.lookup { + for _, v := range u { + newhist.lookup[i] = append(newhist.lookup[i], v) } } + + return newhist +} + +// FullReset resets a histogram to default empty values. +func (h *Histogram) FullReset() { + if h.useLocks { + h.mutex.Lock() + defer h.mutex.Unlock() + } + + h.allocd = defaultHistSize + h.bvs = make([]bin, defaultHistSize) + h.used = 0 + h.lookup = [256][]uint16{} +} + +// CopyAndReset creates and returns an exact copy of a histogram, +// and resets it to default empty values. +func (h *Histogram) CopyAndReset() *Histogram { + newhist := h.Copy() + h.FullReset() return newhist } + func (h *Histogram) DecStrings() []string { if h.useLocks { h.mutex.Lock() @@ -646,7 +851,7 @@ func (h *Histogram) DecStrings() []string { for i, bin := range h.bvs[0:h.used] { var buffer bytes.Buffer buffer.WriteString("H[") - buffer.WriteString(fmt.Sprintf("%3.1e", bin.Value())) + buffer.WriteString(fmt.Sprintf("%3.1e", bin.value())) buffer.WriteString("]=") buffer.WriteString(fmt.Sprintf("%v", bin.count)) out[i] = buffer.String() @@ -655,9 +860,9 @@ func (h *Histogram) DecStrings() []string { } // takes the output of DecStrings and deserializes it into a Bin struct slice -func stringsToBin(strs []string) ([]Bin, error) { +func stringsToBin(strs []string) ([]bin, error) { - bins := make([]Bin, len(strs)) + bins := make([]bin, len(strs)) for i, str := range strs { // H[0.0e+00]=1 @@ -682,8 +887,31 @@ func stringsToBin(strs []string) ([]Bin, error) { if err != nil { return nil, err } - bins[i] = *NewBinRaw(int8(valInt*10), int8(expInt), uint64(countInt)) + bins[i] = *newBinRaw(int8(valInt*10), int8(expInt), uint64(countInt)) } return bins, nil } + +// UnmarshalJSON - histogram will come in a base64 encoded serialized form +func (h *Histogram) UnmarshalJSON(b []byte) error { + var s string + if err := json.Unmarshal(b, &s); err != nil { + return err + } + data, err := base64.StdEncoding.DecodeString(s) + if err != nil { + return err + } + h, err = Deserialize(bytes.NewBuffer(data)) + return err +} + +func (h *Histogram) MarshalJSON() ([]byte, error) { + buf := bytes.NewBuffer([]byte{}) + err := h.SerializeB64(buf) + if err != nil { + return buf.Bytes(), err + } + return json.Marshal(buf.String()) +} diff --git a/vendor/github.com/containerd/console/.travis.yml b/vendor/github.com/containerd/console/.travis.yml new file mode 100644 index 000000000000..16827ec3e8f6 --- /dev/null +++ b/vendor/github.com/containerd/console/.travis.yml @@ -0,0 +1,27 @@ +language: go +go: + - "1.12.x" + - "1.13.x" + +go_import_path: github.com/containerd/console + +env: + - GO111MODULE=on + +install: + - pushd ..; go get -u github.com/vbatts/git-validation; popd + - pushd ..; go get -u github.com/kunalkushwaha/ltag; popd + +before_script: + - pushd ..; git clone https://github.com/containerd/project; popd + +script: + - DCO_VERBOSITY=-q ../project/script/validate/dco + - ../project/script/validate/fileheader ../project/ + - travis_wait ../project/script/validate/vendor + - go test -race + - GOOS=openbsd go build + - GOOS=openbsd go test -c + - GOOS=solaris go build + - GOOS=solaris go test -c + - GOOS=windows go test diff --git a/vendor/github.com/containerd/continuity/AUTHORS b/vendor/github.com/containerd/continuity/AUTHORS new file mode 100644 index 000000000000..4043394cc501 --- /dev/null +++ b/vendor/github.com/containerd/continuity/AUTHORS @@ -0,0 +1,16 @@ +Aaron Lehmann +Akash Gupta +Akihiro Suda +Andrew Pennebaker +Brandon Philips +Christopher Jones +Daniel, Dao Quang Minh +Derek McGowan +Edward Pilatowicz +Ian Campbell +Justin Cormack +Justin Cummins +Phil Estes +Stephen J Day +Tobias Klauser +Tonis Tiigi diff --git a/vendor/github.com/containerd/continuity/pathdriver/path_driver.go b/vendor/github.com/containerd/continuity/pathdriver/path_driver.go deleted file mode 100644 index b0d5a6b56706..000000000000 --- a/vendor/github.com/containerd/continuity/pathdriver/path_driver.go +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright The containerd 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 pathdriver - -import ( - "path/filepath" -) - -// PathDriver provides all of the path manipulation functions in a common -// interface. The context should call these and never use the `filepath` -// package or any other package to manipulate paths. -type PathDriver interface { - Join(paths ...string) string - IsAbs(path string) bool - Rel(base, target string) (string, error) - Base(path string) string - Dir(path string) string - Clean(path string) string - Split(path string) (dir, file string) - Separator() byte - Abs(path string) (string, error) - Walk(string, filepath.WalkFunc) error - FromSlash(path string) string - ToSlash(path string) string - Match(pattern, name string) (matched bool, err error) -} - -// pathDriver is a simple default implementation calls the filepath package. -type pathDriver struct{} - -// LocalPathDriver is the exported pathDriver struct for convenience. -var LocalPathDriver PathDriver = &pathDriver{} - -func (*pathDriver) Join(paths ...string) string { - return filepath.Join(paths...) -} - -func (*pathDriver) IsAbs(path string) bool { - return filepath.IsAbs(path) -} - -func (*pathDriver) Rel(base, target string) (string, error) { - return filepath.Rel(base, target) -} - -func (*pathDriver) Base(path string) string { - return filepath.Base(path) -} - -func (*pathDriver) Dir(path string) string { - return filepath.Dir(path) -} - -func (*pathDriver) Clean(path string) string { - return filepath.Clean(path) -} - -func (*pathDriver) Split(path string) (dir, file string) { - return filepath.Split(path) -} - -func (*pathDriver) Separator() byte { - return filepath.Separator -} - -func (*pathDriver) Abs(path string) (string, error) { - return filepath.Abs(path) -} - -// Note that filepath.Walk calls os.Stat, so if the context wants to -// to call Driver.Stat() for Walk, they need to create a new struct that -// overrides this method. -func (*pathDriver) Walk(root string, walkFn filepath.WalkFunc) error { - return filepath.Walk(root, walkFn) -} - -func (*pathDriver) FromSlash(path string) string { - return filepath.FromSlash(path) -} - -func (*pathDriver) ToSlash(path string) string { - return filepath.ToSlash(path) -} - -func (*pathDriver) Match(pattern, name string) (bool, error) { - return filepath.Match(pattern, name) -} diff --git a/vendor/github.com/containerd/continuity/sysx/generate.sh b/vendor/github.com/containerd/continuity/sysx/generate.sh old mode 100755 new mode 100644 diff --git a/vendor/github.com/containerd/go-cni/.travis.yml b/vendor/github.com/containerd/go-cni/.travis.yml new file mode 100644 index 000000000000..61bae2150715 --- /dev/null +++ b/vendor/github.com/containerd/go-cni/.travis.yml @@ -0,0 +1,22 @@ +language: go +go: + - 1.12.x + - tip + +go_import_path: github.com/containerd/go-cni + +install: + - go get -d + - go get -u github.com/vbatts/git-validation + - go get -u github.com/kunalkushwaha/ltag + +before_script: + - pushd ..; git clone https://github.com/containerd/project; popd + +script: + - DCO_VERBOSITY=-q ../project/script/validate/dco + - ../project/script/validate/fileheader ../project/ + - go test -race -coverprofile=coverage.txt -covermode=atomic + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/coreos/go-semver/NOTICE b/vendor/github.com/coreos/go-semver/NOTICE new file mode 100644 index 000000000000..23a0ada2fbb5 --- /dev/null +++ b/vendor/github.com/coreos/go-semver/NOTICE @@ -0,0 +1,5 @@ +CoreOS Project +Copyright 2018 CoreOS, Inc + +This product includes software developed at CoreOS, Inc. +(http://www.coreos.com/). diff --git a/vendor/github.com/coreos/go-systemd/dbus/methods.go b/vendor/github.com/coreos/go-systemd/dbus/methods.go index 5f2790acff9c..5859583eb245 100644 --- a/vendor/github.com/coreos/go-systemd/dbus/methods.go +++ b/vendor/github.com/coreos/go-systemd/dbus/methods.go @@ -197,6 +197,12 @@ func (c *Conn) GetUnitPathProperties(path dbus.ObjectPath) (map[string]interface return c.getProperties(path, "org.freedesktop.systemd1.Unit") } +// GetAllProperties takes the (unescaped) unit name and returns all of its dbus object properties. +func (c *Conn) GetAllProperties(unit string) (map[string]interface{}, error) { + path := unitPath(unit) + return c.getProperties(path, "") +} + func (c *Conn) getProperty(unit string, dbusInterface string, propertyName string) (*Property, error) { var err error var prop dbus.Variant diff --git a/vendor/github.com/creack/pty/Dockerfile.riscv b/vendor/github.com/creack/pty/Dockerfile.riscv deleted file mode 100644 index adfdf82c8956..000000000000 --- a/vendor/github.com/creack/pty/Dockerfile.riscv +++ /dev/null @@ -1,14 +0,0 @@ -FROM golang:1.13 - -# Clone and complie a riscv compatible version of the go compiler. -RUN git clone https://review.gerrithub.io/riscv/riscv-go /riscv-go -# riscvdev branch HEAD as of 2019-06-29. -RUN cd /riscv-go && git checkout 04885fddd096d09d4450726064d06dd107e374bf -ENV PATH=/riscv-go/misc/riscv:/riscv-go/bin:$PATH -RUN cd /riscv-go/src && GOROOT_BOOTSTRAP=$(go env GOROOT) ./make.bash -ENV GOROOT=/riscv-go - -# Make sure we compile. -WORKDIR pty -ADD . . -RUN GOOS=linux GOARCH=riscv go build diff --git a/vendor/github.com/creack/pty/LICENSE b/vendor/github.com/creack/pty/LICENSE deleted file mode 100644 index 6b7558b6b421..000000000000 --- a/vendor/github.com/creack/pty/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2011 Keith Rarick - -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/creack/pty/README.md b/vendor/github.com/creack/pty/README.md deleted file mode 100644 index 5275014a7a71..000000000000 --- a/vendor/github.com/creack/pty/README.md +++ /dev/null @@ -1,100 +0,0 @@ -# pty - -Pty is a Go package for using unix pseudo-terminals. - -## Install - - go get github.com/creack/pty - -## Example - -### Command - -```go -package main - -import ( - "github.com/creack/pty" - "io" - "os" - "os/exec" -) - -func main() { - c := exec.Command("grep", "--color=auto", "bar") - f, err := pty.Start(c) - if err != nil { - panic(err) - } - - go func() { - f.Write([]byte("foo\n")) - f.Write([]byte("bar\n")) - f.Write([]byte("baz\n")) - f.Write([]byte{4}) // EOT - }() - io.Copy(os.Stdout, f) -} -``` - -### Shell - -```go -package main - -import ( - "io" - "log" - "os" - "os/exec" - "os/signal" - "syscall" - - "github.com/creack/pty" - "golang.org/x/crypto/ssh/terminal" -) - -func test() error { - // Create arbitrary command. - c := exec.Command("bash") - - // Start the command with a pty. - ptmx, err := pty.Start(c) - if err != nil { - return err - } - // Make sure to close the pty at the end. - defer func() { _ = ptmx.Close() }() // Best effort. - - // Handle pty size. - ch := make(chan os.Signal, 1) - signal.Notify(ch, syscall.SIGWINCH) - go func() { - for range ch { - if err := pty.InheritSize(os.Stdin, ptmx); err != nil { - log.Printf("error resizing pty: %s", err) - } - } - }() - ch <- syscall.SIGWINCH // Initial resize. - - // Set stdin in raw mode. - oldState, err := terminal.MakeRaw(int(os.Stdin.Fd())) - if err != nil { - panic(err) - } - defer func() { _ = terminal.Restore(int(os.Stdin.Fd()), oldState) }() // Best effort. - - // Copy stdin to the pty and the pty to stdout. - go func() { _, _ = io.Copy(ptmx, os.Stdin) }() - _, _ = io.Copy(os.Stdout, ptmx) - - return nil -} - -func main() { - if err := test(); err != nil { - log.Fatal(err) - } -} -``` diff --git a/vendor/github.com/creack/pty/doc.go b/vendor/github.com/creack/pty/doc.go deleted file mode 100644 index 190cfbea929d..000000000000 --- a/vendor/github.com/creack/pty/doc.go +++ /dev/null @@ -1,16 +0,0 @@ -// Package pty provides functions for working with Unix terminals. -package pty - -import ( - "errors" - "os" -) - -// ErrUnsupported is returned if a function is not -// available on the current platform. -var ErrUnsupported = errors.New("unsupported") - -// Opens a pty and its corresponding tty. -func Open() (pty, tty *os.File, err error) { - return open() -} diff --git a/vendor/github.com/creack/pty/go.mod b/vendor/github.com/creack/pty/go.mod deleted file mode 100644 index e48decaf469a..000000000000 --- a/vendor/github.com/creack/pty/go.mod +++ /dev/null @@ -1,4 +0,0 @@ -module github.com/creack/pty - -go 1.13 - diff --git a/vendor/github.com/creack/pty/ioctl.go b/vendor/github.com/creack/pty/ioctl.go deleted file mode 100644 index c85cdcd14a01..000000000000 --- a/vendor/github.com/creack/pty/ioctl.go +++ /dev/null @@ -1,13 +0,0 @@ -// +build !windows,!solaris - -package pty - -import "syscall" - -func ioctl(fd, cmd, ptr uintptr) error { - _, _, e := syscall.Syscall(syscall.SYS_IOCTL, fd, cmd, ptr) - if e != 0 { - return e - } - return nil -} diff --git a/vendor/github.com/creack/pty/ioctl_bsd.go b/vendor/github.com/creack/pty/ioctl_bsd.go deleted file mode 100644 index 73b12c53cf48..000000000000 --- a/vendor/github.com/creack/pty/ioctl_bsd.go +++ /dev/null @@ -1,39 +0,0 @@ -// +build darwin dragonfly freebsd netbsd openbsd - -package pty - -// from -const ( - _IOC_VOID uintptr = 0x20000000 - _IOC_OUT uintptr = 0x40000000 - _IOC_IN uintptr = 0x80000000 - _IOC_IN_OUT uintptr = _IOC_OUT | _IOC_IN - _IOC_DIRMASK = _IOC_VOID | _IOC_OUT | _IOC_IN - - _IOC_PARAM_SHIFT = 13 - _IOC_PARAM_MASK = (1 << _IOC_PARAM_SHIFT) - 1 -) - -func _IOC_PARM_LEN(ioctl uintptr) uintptr { - return (ioctl >> 16) & _IOC_PARAM_MASK -} - -func _IOC(inout uintptr, group byte, ioctl_num uintptr, param_len uintptr) uintptr { - return inout | (param_len&_IOC_PARAM_MASK)<<16 | uintptr(group)<<8 | ioctl_num -} - -func _IO(group byte, ioctl_num uintptr) uintptr { - return _IOC(_IOC_VOID, group, ioctl_num, 0) -} - -func _IOR(group byte, ioctl_num uintptr, param_len uintptr) uintptr { - return _IOC(_IOC_OUT, group, ioctl_num, param_len) -} - -func _IOW(group byte, ioctl_num uintptr, param_len uintptr) uintptr { - return _IOC(_IOC_IN, group, ioctl_num, param_len) -} - -func _IOWR(group byte, ioctl_num uintptr, param_len uintptr) uintptr { - return _IOC(_IOC_IN_OUT, group, ioctl_num, param_len) -} diff --git a/vendor/github.com/creack/pty/ioctl_solaris.go b/vendor/github.com/creack/pty/ioctl_solaris.go deleted file mode 100644 index f63985f34ce3..000000000000 --- a/vendor/github.com/creack/pty/ioctl_solaris.go +++ /dev/null @@ -1,30 +0,0 @@ -package pty - -import ( - "golang.org/x/sys/unix" - "unsafe" -) - -const ( - // see /usr/include/sys/stropts.h - I_PUSH = uintptr((int32('S')<<8 | 002)) - I_STR = uintptr((int32('S')<<8 | 010)) - I_FIND = uintptr((int32('S')<<8 | 013)) - // see /usr/include/sys/ptms.h - ISPTM = (int32('P') << 8) | 1 - UNLKPT = (int32('P') << 8) | 2 - PTSSTTY = (int32('P') << 8) | 3 - ZONEPT = (int32('P') << 8) | 4 - OWNERPT = (int32('P') << 8) | 5 -) - -type strioctl struct { - ic_cmd int32 - ic_timout int32 - ic_len int32 - ic_dp unsafe.Pointer -} - -func ioctl(fd, cmd, ptr uintptr) error { - return unix.IoctlSetInt(int(fd), uint(cmd), int(ptr)) -} diff --git a/vendor/github.com/creack/pty/mktypes.bash b/vendor/github.com/creack/pty/mktypes.bash deleted file mode 100755 index 82ee16721cba..000000000000 --- a/vendor/github.com/creack/pty/mktypes.bash +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -GOOSARCH="${GOOS}_${GOARCH}" -case "$GOOSARCH" in -_* | *_ | _) - echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2 - exit 1 - ;; -esac - -GODEFS="go tool cgo -godefs" - -$GODEFS types.go |gofmt > ztypes_$GOARCH.go - -case $GOOS in -freebsd|dragonfly|openbsd) - $GODEFS types_$GOOS.go |gofmt > ztypes_$GOOSARCH.go - ;; -esac diff --git a/vendor/github.com/creack/pty/pty_darwin.go b/vendor/github.com/creack/pty/pty_darwin.go deleted file mode 100644 index 6344b6b0efb6..000000000000 --- a/vendor/github.com/creack/pty/pty_darwin.go +++ /dev/null @@ -1,65 +0,0 @@ -package pty - -import ( - "errors" - "os" - "syscall" - "unsafe" -) - -func open() (pty, tty *os.File, err error) { - pFD, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|syscall.O_CLOEXEC, 0) - if err != nil { - return nil, nil, err - } - p := os.NewFile(uintptr(pFD), "/dev/ptmx") - // In case of error after this point, make sure we close the ptmx fd. - defer func() { - if err != nil { - _ = p.Close() // Best effort. - } - }() - - sname, err := ptsname(p) - if err != nil { - return nil, nil, err - } - - if err := grantpt(p); err != nil { - return nil, nil, err - } - - if err := unlockpt(p); err != nil { - return nil, nil, err - } - - t, err := os.OpenFile(sname, os.O_RDWR, 0) - if err != nil { - return nil, nil, err - } - return p, t, nil -} - -func ptsname(f *os.File) (string, error) { - n := make([]byte, _IOC_PARM_LEN(syscall.TIOCPTYGNAME)) - - err := ioctl(f.Fd(), syscall.TIOCPTYGNAME, uintptr(unsafe.Pointer(&n[0]))) - if err != nil { - return "", err - } - - for i, c := range n { - if c == 0 { - return string(n[:i]), nil - } - } - return "", errors.New("TIOCPTYGNAME string not NUL-terminated") -} - -func grantpt(f *os.File) error { - return ioctl(f.Fd(), syscall.TIOCPTYGRANT, 0) -} - -func unlockpt(f *os.File) error { - return ioctl(f.Fd(), syscall.TIOCPTYUNLK, 0) -} diff --git a/vendor/github.com/creack/pty/pty_dragonfly.go b/vendor/github.com/creack/pty/pty_dragonfly.go deleted file mode 100644 index b7d1f20f29e5..000000000000 --- a/vendor/github.com/creack/pty/pty_dragonfly.go +++ /dev/null @@ -1,80 +0,0 @@ -package pty - -import ( - "errors" - "os" - "strings" - "syscall" - "unsafe" -) - -// same code as pty_darwin.go -func open() (pty, tty *os.File, err error) { - p, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0) - if err != nil { - return nil, nil, err - } - // In case of error after this point, make sure we close the ptmx fd. - defer func() { - if err != nil { - _ = p.Close() // Best effort. - } - }() - - sname, err := ptsname(p) - if err != nil { - return nil, nil, err - } - - if err := grantpt(p); err != nil { - return nil, nil, err - } - - if err := unlockpt(p); err != nil { - return nil, nil, err - } - - t, err := os.OpenFile(sname, os.O_RDWR, 0) - if err != nil { - return nil, nil, err - } - return p, t, nil -} - -func grantpt(f *os.File) error { - _, err := isptmaster(f.Fd()) - return err -} - -func unlockpt(f *os.File) error { - _, err := isptmaster(f.Fd()) - return err -} - -func isptmaster(fd uintptr) (bool, error) { - err := ioctl(fd, syscall.TIOCISPTMASTER, 0) - return err == nil, err -} - -var ( - emptyFiodgnameArg fiodgnameArg - ioctl_FIODNAME = _IOW('f', 120, unsafe.Sizeof(emptyFiodgnameArg)) -) - -func ptsname(f *os.File) (string, error) { - name := make([]byte, _C_SPECNAMELEN) - fa := fiodgnameArg{Name: (*byte)(unsafe.Pointer(&name[0])), Len: _C_SPECNAMELEN, Pad_cgo_0: [4]byte{0, 0, 0, 0}} - - err := ioctl(f.Fd(), ioctl_FIODNAME, uintptr(unsafe.Pointer(&fa))) - if err != nil { - return "", err - } - - for i, c := range name { - if c == 0 { - s := "/dev/" + string(name[:i]) - return strings.Replace(s, "ptm", "pts", -1), nil - } - } - return "", errors.New("TIOCPTYGNAME string not NUL-terminated") -} diff --git a/vendor/github.com/creack/pty/pty_freebsd.go b/vendor/github.com/creack/pty/pty_freebsd.go deleted file mode 100644 index 63b6d91337ae..000000000000 --- a/vendor/github.com/creack/pty/pty_freebsd.go +++ /dev/null @@ -1,78 +0,0 @@ -package pty - -import ( - "errors" - "os" - "syscall" - "unsafe" -) - -func posixOpenpt(oflag int) (fd int, err error) { - r0, _, e1 := syscall.Syscall(syscall.SYS_POSIX_OPENPT, uintptr(oflag), 0, 0) - fd = int(r0) - if e1 != 0 { - err = e1 - } - return fd, err -} - -func open() (pty, tty *os.File, err error) { - fd, err := posixOpenpt(syscall.O_RDWR | syscall.O_CLOEXEC) - if err != nil { - return nil, nil, err - } - p := os.NewFile(uintptr(fd), "/dev/pts") - // In case of error after this point, make sure we close the pts fd. - defer func() { - if err != nil { - _ = p.Close() // Best effort. - } - }() - - sname, err := ptsname(p) - if err != nil { - return nil, nil, err - } - - t, err := os.OpenFile("/dev/"+sname, os.O_RDWR, 0) - if err != nil { - return nil, nil, err - } - return p, t, nil -} - -func isptmaster(fd uintptr) (bool, error) { - err := ioctl(fd, syscall.TIOCPTMASTER, 0) - return err == nil, err -} - -var ( - emptyFiodgnameArg fiodgnameArg - ioctlFIODGNAME = _IOW('f', 120, unsafe.Sizeof(emptyFiodgnameArg)) -) - -func ptsname(f *os.File) (string, error) { - master, err := isptmaster(f.Fd()) - if err != nil { - return "", err - } - if !master { - return "", syscall.EINVAL - } - - const n = _C_SPECNAMELEN + 1 - var ( - buf = make([]byte, n) - arg = fiodgnameArg{Len: n, Buf: (*byte)(unsafe.Pointer(&buf[0]))} - ) - if err := ioctl(f.Fd(), ioctlFIODGNAME, uintptr(unsafe.Pointer(&arg))); err != nil { - return "", err - } - - for i, c := range buf { - if c == 0 { - return string(buf[:i]), nil - } - } - return "", errors.New("FIODGNAME string not NUL-terminated") -} diff --git a/vendor/github.com/creack/pty/pty_linux.go b/vendor/github.com/creack/pty/pty_linux.go deleted file mode 100644 index 4a833de18499..000000000000 --- a/vendor/github.com/creack/pty/pty_linux.go +++ /dev/null @@ -1,51 +0,0 @@ -package pty - -import ( - "os" - "strconv" - "syscall" - "unsafe" -) - -func open() (pty, tty *os.File, err error) { - p, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0) - if err != nil { - return nil, nil, err - } - // In case of error after this point, make sure we close the ptmx fd. - defer func() { - if err != nil { - _ = p.Close() // Best effort. - } - }() - - sname, err := ptsname(p) - if err != nil { - return nil, nil, err - } - - if err := unlockpt(p); err != nil { - return nil, nil, err - } - - t, err := os.OpenFile(sname, os.O_RDWR|syscall.O_NOCTTY, 0) - if err != nil { - return nil, nil, err - } - return p, t, nil -} - -func ptsname(f *os.File) (string, error) { - var n _C_uint - err := ioctl(f.Fd(), syscall.TIOCGPTN, uintptr(unsafe.Pointer(&n))) - if err != nil { - return "", err - } - return "/dev/pts/" + strconv.Itoa(int(n)), nil -} - -func unlockpt(f *os.File) error { - var u _C_int - // use TIOCSPTLCK with a pointer to zero to clear the lock - return ioctl(f.Fd(), syscall.TIOCSPTLCK, uintptr(unsafe.Pointer(&u))) -} diff --git a/vendor/github.com/creack/pty/pty_openbsd.go b/vendor/github.com/creack/pty/pty_openbsd.go deleted file mode 100644 index a6a35d1e677e..000000000000 --- a/vendor/github.com/creack/pty/pty_openbsd.go +++ /dev/null @@ -1,33 +0,0 @@ -package pty - -import ( - "os" - "syscall" - "unsafe" -) - -func open() (pty, tty *os.File, err error) { - /* - * from ptm(4): - * The PTMGET command allocates a free pseudo terminal, changes its - * ownership to the caller, revokes the access privileges for all previous - * users, opens the file descriptors for the pty and tty devices and - * returns them to the caller in struct ptmget. - */ - - p, err := os.OpenFile("/dev/ptm", os.O_RDWR|syscall.O_CLOEXEC, 0) - if err != nil { - return nil, nil, err - } - defer p.Close() - - var ptm ptmget - if err := ioctl(p.Fd(), uintptr(ioctl_PTMGET), uintptr(unsafe.Pointer(&ptm))); err != nil { - return nil, nil, err - } - - pty = os.NewFile(uintptr(ptm.Cfd), "/dev/ptm") - tty = os.NewFile(uintptr(ptm.Sfd), "/dev/ptm") - - return pty, tty, nil -} diff --git a/vendor/github.com/creack/pty/pty_solaris.go b/vendor/github.com/creack/pty/pty_solaris.go deleted file mode 100644 index 09ec1b7978a6..000000000000 --- a/vendor/github.com/creack/pty/pty_solaris.go +++ /dev/null @@ -1,139 +0,0 @@ -package pty - -/* based on: -http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libc/port/gen/pt.c -*/ - -import ( - "errors" - "golang.org/x/sys/unix" - "os" - "strconv" - "syscall" - "unsafe" -) - -const NODEV = ^uint64(0) - -func open() (pty, tty *os.File, err error) { - masterfd, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|unix.O_NOCTTY, 0) - //masterfd, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|syscall.O_CLOEXEC|unix.O_NOCTTY, 0) - if err != nil { - return nil, nil, err - } - p := os.NewFile(uintptr(masterfd), "/dev/ptmx") - - sname, err := ptsname(p) - if err != nil { - return nil, nil, err - } - - err = grantpt(p) - if err != nil { - return nil, nil, err - } - - err = unlockpt(p) - if err != nil { - return nil, nil, err - } - - slavefd, err := syscall.Open(sname, os.O_RDWR|unix.O_NOCTTY, 0) - if err != nil { - return nil, nil, err - } - t := os.NewFile(uintptr(slavefd), sname) - - // pushing terminal driver STREAMS modules as per pts(7) - for _, mod := range([]string{"ptem", "ldterm", "ttcompat"}) { - err = streams_push(t, mod) - if err != nil { - return nil, nil, err - } - } - - return p, t, nil -} - -func minor(x uint64) uint64 { - return x & 0377 -} - -func ptsdev(fd uintptr) uint64 { - istr := strioctl{ISPTM, 0, 0, nil} - err := ioctl(fd, I_STR, uintptr(unsafe.Pointer(&istr))) - if err != nil { - return NODEV - } - var status unix.Stat_t - err = unix.Fstat(int(fd), &status) - if err != nil { - return NODEV - } - return uint64(minor(status.Rdev)) -} - -func ptsname(f *os.File) (string, error) { - dev := ptsdev(f.Fd()) - if dev == NODEV { - return "", errors.New("not a master pty") - } - fn := "/dev/pts/" + strconv.FormatInt(int64(dev), 10) - // access(2) creates the slave device (if the pty exists) - // F_OK == 0 (unistd.h) - err := unix.Access(fn, 0) - if err != nil { - return "", err - } - return fn, nil -} - -type pt_own struct { - pto_ruid int32 - pto_rgid int32 -} - -func grantpt(f *os.File) error { - if ptsdev(f.Fd()) == NODEV { - return errors.New("not a master pty") - } - var pto pt_own - pto.pto_ruid = int32(os.Getuid()) - // XXX should first attempt to get gid of DEFAULT_TTY_GROUP="tty" - pto.pto_rgid = int32(os.Getgid()) - var istr strioctl - istr.ic_cmd = OWNERPT - istr.ic_timout = 0 - istr.ic_len = int32(unsafe.Sizeof(istr)) - istr.ic_dp = unsafe.Pointer(&pto) - err := ioctl(f.Fd(), I_STR, uintptr(unsafe.Pointer(&istr))) - if err != nil { - return errors.New("access denied") - } - return nil -} - -func unlockpt(f *os.File) error { - istr := strioctl{UNLKPT, 0, 0, nil} - return ioctl(f.Fd(), I_STR, uintptr(unsafe.Pointer(&istr))) -} - -// push STREAMS modules if not already done so -func streams_push(f *os.File, mod string) error { - var err error - buf := []byte(mod) - // XXX I_FIND is not returning an error when the module - // is already pushed even though truss reports a return - // value of 1. A bug in the Go Solaris syscall interface? - // XXX without this we are at risk of the issue - // https://www.illumos.org/issues/9042 - // but since we are not using libc or XPG4.2, we should not be - // double-pushing modules - - err = ioctl(f.Fd(), I_FIND, uintptr(unsafe.Pointer(&buf[0]))) - if err != nil { - return nil - } - err = ioctl(f.Fd(), I_PUSH, uintptr(unsafe.Pointer(&buf[0]))) - return err -} diff --git a/vendor/github.com/creack/pty/pty_unsupported.go b/vendor/github.com/creack/pty/pty_unsupported.go deleted file mode 100644 index ceb425b19c98..000000000000 --- a/vendor/github.com/creack/pty/pty_unsupported.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build !linux,!darwin,!freebsd,!dragonfly,!openbsd,!solaris - -package pty - -import ( - "os" -) - -func open() (pty, tty *os.File, err error) { - return nil, nil, ErrUnsupported -} diff --git a/vendor/github.com/creack/pty/run.go b/vendor/github.com/creack/pty/run.go deleted file mode 100644 index 959be26b208b..000000000000 --- a/vendor/github.com/creack/pty/run.go +++ /dev/null @@ -1,57 +0,0 @@ -// +build !windows - -package pty - -import ( - "os" - "os/exec" - "syscall" -) - -// Start assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout, -// and c.Stderr, calls c.Start, and returns the File of the tty's -// corresponding pty. -func Start(c *exec.Cmd) (pty *os.File, err error) { - return StartWithSize(c, nil) -} - -// StartWithSize assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout, -// and c.Stderr, calls c.Start, and returns the File of the tty's -// corresponding pty. -// -// This will resize the pty to the specified size before starting the command -func StartWithSize(c *exec.Cmd, sz *Winsize) (pty *os.File, err error) { - pty, tty, err := Open() - if err != nil { - return nil, err - } - defer tty.Close() - if sz != nil { - err = Setsize(pty, sz) - if err != nil { - pty.Close() - return nil, err - } - } - if c.Stdout == nil { - c.Stdout = tty - } - if c.Stderr == nil { - c.Stderr = tty - } - if c.Stdin == nil { - c.Stdin = tty - } - if c.SysProcAttr == nil { - c.SysProcAttr = &syscall.SysProcAttr{} - } - c.SysProcAttr.Setctty = true - c.SysProcAttr.Setsid = true - c.SysProcAttr.Ctty = int(tty.Fd()) - err = c.Start() - if err != nil { - pty.Close() - return nil, err - } - return pty, err -} diff --git a/vendor/github.com/creack/pty/test_crosscompile.sh b/vendor/github.com/creack/pty/test_crosscompile.sh deleted file mode 100755 index f0b1dcac092b..000000000000 --- a/vendor/github.com/creack/pty/test_crosscompile.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env sh - -# Test script checking that all expected os/arch compile properly. -# Does not actually test the logic, just the compilation so we make sure we don't break code depending on the lib. - -echo2() { - echo $@ >&2 -} - -trap end 0 -end() { - [ "$?" = 0 ] && echo2 "Pass." || (echo2 "Fail."; exit 1) -} - -cross() { - os=$1 - shift - echo2 "Build for $os." - for arch in $@; do - echo2 " - $os/$arch" - GOOS=$os GOARCH=$arch go build - done - echo2 -} - -set -e - -cross linux amd64 386 arm arm64 ppc64 ppc64le s390x mips mipsle mips64 mips64le -cross darwin amd64 386 arm arm64 -cross freebsd amd64 386 arm -cross netbsd amd64 386 arm -cross openbsd amd64 386 -cross dragonfly amd64 -cross solaris amd64 - -# Not expected to work but should still compile. -cross windows amd64 386 arm - -# TODO: Fix compilation error on openbsd/arm. -# TODO: Merge the solaris PR. - -# Some os/arch require a different compiler. Run in docker. -if ! hash docker; then - # If docker is not present, stop here. - return -fi - -echo2 "Build for linux." -echo2 " - linux/riscv" -docker build -t test -f Dockerfile.riscv . diff --git a/vendor/github.com/creack/pty/util.go b/vendor/github.com/creack/pty/util.go deleted file mode 100644 index 8fdde0bab988..000000000000 --- a/vendor/github.com/creack/pty/util.go +++ /dev/null @@ -1,64 +0,0 @@ -// +build !windows,!solaris - -package pty - -import ( - "os" - "syscall" - "unsafe" -) - -// InheritSize applies the terminal size of pty to tty. This should be run -// in a signal handler for syscall.SIGWINCH to automatically resize the tty when -// the pty receives a window size change notification. -func InheritSize(pty, tty *os.File) error { - size, err := GetsizeFull(pty) - if err != nil { - return err - } - err = Setsize(tty, size) - if err != nil { - return err - } - return nil -} - -// Setsize resizes t to s. -func Setsize(t *os.File, ws *Winsize) error { - return windowRectCall(ws, t.Fd(), syscall.TIOCSWINSZ) -} - -// GetsizeFull returns the full terminal size description. -func GetsizeFull(t *os.File) (size *Winsize, err error) { - var ws Winsize - err = windowRectCall(&ws, t.Fd(), syscall.TIOCGWINSZ) - return &ws, err -} - -// Getsize returns the number of rows (lines) and cols (positions -// in each line) in terminal t. -func Getsize(t *os.File) (rows, cols int, err error) { - ws, err := GetsizeFull(t) - return int(ws.Rows), int(ws.Cols), err -} - -// Winsize describes the terminal size. -type Winsize struct { - Rows uint16 // ws_row: Number of rows (in cells) - Cols uint16 // ws_col: Number of columns (in cells) - X uint16 // ws_xpixel: Width in pixels - Y uint16 // ws_ypixel: Height in pixels -} - -func windowRectCall(ws *Winsize, fd, a2 uintptr) error { - _, _, errno := syscall.Syscall( - syscall.SYS_IOCTL, - fd, - a2, - uintptr(unsafe.Pointer(ws)), - ) - if errno != 0 { - return syscall.Errno(errno) - } - return nil -} diff --git a/vendor/github.com/creack/pty/util_solaris.go b/vendor/github.com/creack/pty/util_solaris.go deleted file mode 100644 index e8896924824b..000000000000 --- a/vendor/github.com/creack/pty/util_solaris.go +++ /dev/null @@ -1,51 +0,0 @@ -// - -package pty - -import ( - "os" - "golang.org/x/sys/unix" -) - -const ( - TIOCGWINSZ = 21608 // 'T' << 8 | 104 - TIOCSWINSZ = 21607 // 'T' << 8 | 103 -) - -// Winsize describes the terminal size. -type Winsize struct { - Rows uint16 // ws_row: Number of rows (in cells) - Cols uint16 // ws_col: Number of columns (in cells) - X uint16 // ws_xpixel: Width in pixels - Y uint16 // ws_ypixel: Height in pixels -} - -// GetsizeFull returns the full terminal size description. -func GetsizeFull(t *os.File) (size *Winsize, err error) { - var wsz *unix.Winsize - wsz, err = unix.IoctlGetWinsize(int(t.Fd()), TIOCGWINSZ) - - if err != nil { - return nil, err - } else { - return &Winsize{wsz.Row, wsz.Col, wsz.Xpixel, wsz.Ypixel}, nil - } -} - -// Get Windows Size -func Getsize(t *os.File) (rows, cols int, err error) { - var wsz *unix.Winsize - wsz, err = unix.IoctlGetWinsize(int(t.Fd()), TIOCGWINSZ) - - if err != nil { - return 80, 25, err - } else { - return int(wsz.Row), int(wsz.Col), nil - } -} - -// Setsize resizes t to s. -func Setsize(t *os.File, ws *Winsize) error { - wsz := unix.Winsize{ws.Rows, ws.Cols, ws.X, ws.Y} - return unix.IoctlSetWinsize(int(t.Fd()), TIOCSWINSZ, &wsz) -} diff --git a/vendor/github.com/creack/pty/ztypes_386.go b/vendor/github.com/creack/pty/ztypes_386.go deleted file mode 100644 index ff0b8fd838f0..000000000000 --- a/vendor/github.com/creack/pty/ztypes_386.go +++ /dev/null @@ -1,9 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types.go - -package pty - -type ( - _C_int int32 - _C_uint uint32 -) diff --git a/vendor/github.com/creack/pty/ztypes_amd64.go b/vendor/github.com/creack/pty/ztypes_amd64.go deleted file mode 100644 index ff0b8fd838f0..000000000000 --- a/vendor/github.com/creack/pty/ztypes_amd64.go +++ /dev/null @@ -1,9 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types.go - -package pty - -type ( - _C_int int32 - _C_uint uint32 -) diff --git a/vendor/github.com/creack/pty/ztypes_arm.go b/vendor/github.com/creack/pty/ztypes_arm.go deleted file mode 100644 index ff0b8fd838f0..000000000000 --- a/vendor/github.com/creack/pty/ztypes_arm.go +++ /dev/null @@ -1,9 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types.go - -package pty - -type ( - _C_int int32 - _C_uint uint32 -) diff --git a/vendor/github.com/creack/pty/ztypes_arm64.go b/vendor/github.com/creack/pty/ztypes_arm64.go deleted file mode 100644 index 6c29a4b91888..000000000000 --- a/vendor/github.com/creack/pty/ztypes_arm64.go +++ /dev/null @@ -1,11 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types.go - -// +build arm64 - -package pty - -type ( - _C_int int32 - _C_uint uint32 -) diff --git a/vendor/github.com/creack/pty/ztypes_dragonfly_amd64.go b/vendor/github.com/creack/pty/ztypes_dragonfly_amd64.go deleted file mode 100644 index 6b0ba037f897..000000000000 --- a/vendor/github.com/creack/pty/ztypes_dragonfly_amd64.go +++ /dev/null @@ -1,14 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types_dragonfly.go - -package pty - -const ( - _C_SPECNAMELEN = 0x3f -) - -type fiodgnameArg struct { - Name *byte - Len uint32 - Pad_cgo_0 [4]byte -} diff --git a/vendor/github.com/creack/pty/ztypes_freebsd_386.go b/vendor/github.com/creack/pty/ztypes_freebsd_386.go deleted file mode 100644 index d9975374e3c5..000000000000 --- a/vendor/github.com/creack/pty/ztypes_freebsd_386.go +++ /dev/null @@ -1,13 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types_freebsd.go - -package pty - -const ( - _C_SPECNAMELEN = 0x3f -) - -type fiodgnameArg struct { - Len int32 - Buf *byte -} diff --git a/vendor/github.com/creack/pty/ztypes_freebsd_amd64.go b/vendor/github.com/creack/pty/ztypes_freebsd_amd64.go deleted file mode 100644 index 5fa102fcdf6e..000000000000 --- a/vendor/github.com/creack/pty/ztypes_freebsd_amd64.go +++ /dev/null @@ -1,14 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types_freebsd.go - -package pty - -const ( - _C_SPECNAMELEN = 0x3f -) - -type fiodgnameArg struct { - Len int32 - Pad_cgo_0 [4]byte - Buf *byte -} diff --git a/vendor/github.com/creack/pty/ztypes_freebsd_arm.go b/vendor/github.com/creack/pty/ztypes_freebsd_arm.go deleted file mode 100644 index d9975374e3c5..000000000000 --- a/vendor/github.com/creack/pty/ztypes_freebsd_arm.go +++ /dev/null @@ -1,13 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types_freebsd.go - -package pty - -const ( - _C_SPECNAMELEN = 0x3f -) - -type fiodgnameArg struct { - Len int32 - Buf *byte -} diff --git a/vendor/github.com/creack/pty/ztypes_freebsd_arm64.go b/vendor/github.com/creack/pty/ztypes_freebsd_arm64.go deleted file mode 100644 index 4418139b26fd..000000000000 --- a/vendor/github.com/creack/pty/ztypes_freebsd_arm64.go +++ /dev/null @@ -1,13 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs types_freebsd.go - -package pty - -const ( - _C_SPECNAMELEN = 0xff -) - -type fiodgnameArg struct { - Len int32 - Buf *byte -} diff --git a/vendor/github.com/creack/pty/ztypes_mipsx.go b/vendor/github.com/creack/pty/ztypes_mipsx.go deleted file mode 100644 index f0ce74086aef..000000000000 --- a/vendor/github.com/creack/pty/ztypes_mipsx.go +++ /dev/null @@ -1,12 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types.go - -// +build linux -// +build mips mipsle mips64 mips64le - -package pty - -type ( - _C_int int32 - _C_uint uint32 -) diff --git a/vendor/github.com/creack/pty/ztypes_openbsd_386.go b/vendor/github.com/creack/pty/ztypes_openbsd_386.go deleted file mode 100644 index ccb3aab9ae9c..000000000000 --- a/vendor/github.com/creack/pty/ztypes_openbsd_386.go +++ /dev/null @@ -1,13 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types_openbsd.go - -package pty - -type ptmget struct { - Cfd int32 - Sfd int32 - Cn [16]int8 - Sn [16]int8 -} - -var ioctl_PTMGET = 0x40287401 diff --git a/vendor/github.com/creack/pty/ztypes_openbsd_amd64.go b/vendor/github.com/creack/pty/ztypes_openbsd_amd64.go deleted file mode 100644 index e67051688f00..000000000000 --- a/vendor/github.com/creack/pty/ztypes_openbsd_amd64.go +++ /dev/null @@ -1,13 +0,0 @@ -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types_openbsd.go - -package pty - -type ptmget struct { - Cfd int32 - Sfd int32 - Cn [16]int8 - Sn [16]int8 -} - -var ioctl_PTMGET = 0x40287401 diff --git a/vendor/github.com/creack/pty/ztypes_ppc64.go b/vendor/github.com/creack/pty/ztypes_ppc64.go deleted file mode 100644 index 4e1af84312bf..000000000000 --- a/vendor/github.com/creack/pty/ztypes_ppc64.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build ppc64 - -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types.go - -package pty - -type ( - _C_int int32 - _C_uint uint32 -) diff --git a/vendor/github.com/creack/pty/ztypes_ppc64le.go b/vendor/github.com/creack/pty/ztypes_ppc64le.go deleted file mode 100644 index e6780f4e237a..000000000000 --- a/vendor/github.com/creack/pty/ztypes_ppc64le.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build ppc64le - -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types.go - -package pty - -type ( - _C_int int32 - _C_uint uint32 -) diff --git a/vendor/github.com/creack/pty/ztypes_riscvx.go b/vendor/github.com/creack/pty/ztypes_riscvx.go deleted file mode 100644 index 99eec8ecbe02..000000000000 --- a/vendor/github.com/creack/pty/ztypes_riscvx.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs types.go - -// +build riscv riscv64 - -package pty - -type ( - _C_int int32 - _C_uint uint32 -) diff --git a/vendor/github.com/creack/pty/ztypes_s390x.go b/vendor/github.com/creack/pty/ztypes_s390x.go deleted file mode 100644 index a7452b61cb35..000000000000 --- a/vendor/github.com/creack/pty/ztypes_s390x.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build s390x - -// Created by cgo -godefs - DO NOT EDIT -// cgo -godefs types.go - -package pty - -type ( - _C_int int32 - _C_uint uint32 -) diff --git a/vendor/github.com/cyphar/filepath-securejoin/.travis.yml b/vendor/github.com/cyphar/filepath-securejoin/.travis.yml new file mode 100644 index 000000000000..3938f3834944 --- /dev/null +++ b/vendor/github.com/cyphar/filepath-securejoin/.travis.yml @@ -0,0 +1,19 @@ +# Copyright (C) 2017 SUSE LLC. All rights reserved. +# Use of this source code is governed by a BSD-style +# license that can be found in the LICENSE file. + +language: go +go: + - 1.7.x + - 1.8.x + - tip + +os: + - linux + - osx + +script: + - go test -cover -v ./... + +notifications: + email: false diff --git a/vendor/github.com/davecgh/go-spew/spew/bypass.go b/vendor/github.com/davecgh/go-spew/spew/bypass.go index 7f166c3a3d95..792994785e36 100644 --- a/vendor/github.com/davecgh/go-spew/spew/bypass.go +++ b/vendor/github.com/davecgh/go-spew/spew/bypass.go @@ -16,7 +16,9 @@ // when the code is not running on Google App Engine, compiled by GopherJS, and // "-tags safe" is not added to the go build command line. The "disableunsafe" // tag is deprecated and thus should not be used. -// +build !js,!appengine,!safe,!disableunsafe +// Go versions prior to 1.4 are disabled because they use a different layout +// for interfaces which make the implementation of unsafeReflectValue more complex. +// +build !js,!appengine,!safe,!disableunsafe,go1.4 package spew @@ -34,80 +36,49 @@ const ( ptrSize = unsafe.Sizeof((*byte)(nil)) ) +type flag uintptr + var ( - // offsetPtr, offsetScalar, and offsetFlag are the offsets for the - // internal reflect.Value fields. These values are valid before golang - // commit ecccf07e7f9d which changed the format. The are also valid - // after commit 82f48826c6c7 which changed the format again to mirror - // the original format. Code in the init function updates these offsets - // as necessary. - offsetPtr = ptrSize - offsetScalar = uintptr(0) - offsetFlag = ptrSize * 2 - - // flagKindWidth and flagKindShift indicate various bits that the - // reflect package uses internally to track kind information. - // - // flagRO indicates whether or not the value field of a reflect.Value is - // read-only. - // - // flagIndir indicates whether the value field of a reflect.Value is - // the actual data or a pointer to the data. - // - // These values are valid before golang commit 90a7c3c86944 which - // changed their positions. Code in the init function updates these - // flags as necessary. - flagKindWidth = uintptr(5) - flagKindShift = flagKindWidth - 1 - flagRO = uintptr(1 << 0) - flagIndir = uintptr(1 << 1) + // flagRO indicates whether the value field of a reflect.Value + // is read-only. + flagRO flag + + // flagAddr indicates whether the address of the reflect.Value's + // value may be taken. + flagAddr flag ) -func init() { - // Older versions of reflect.Value stored small integers directly in the - // ptr field (which is named val in the older versions). Versions - // between commits ecccf07e7f9d and 82f48826c6c7 added a new field named - // scalar for this purpose which unfortunately came before the flag - // field, so the offset of the flag field is different for those - // versions. - // - // This code constructs a new reflect.Value from a known small integer - // and checks if the size of the reflect.Value struct indicates it has - // the scalar field. When it does, the offsets are updated accordingly. - vv := reflect.ValueOf(0xf00) - if unsafe.Sizeof(vv) == (ptrSize * 4) { - offsetScalar = ptrSize * 2 - offsetFlag = ptrSize * 3 - } +// flagKindMask holds the bits that make up the kind +// part of the flags field. In all the supported versions, +// it is in the lower 5 bits. +const flagKindMask = flag(0x1f) - // Commit 90a7c3c86944 changed the flag positions such that the low - // order bits are the kind. This code extracts the kind from the flags - // field and ensures it's the correct type. When it's not, the flag - // order has been changed to the newer format, so the flags are updated - // accordingly. - upf := unsafe.Pointer(uintptr(unsafe.Pointer(&vv)) + offsetFlag) - upfv := *(*uintptr)(upf) - flagKindMask := uintptr((1<>flagKindShift != uintptr(reflect.Int) { - flagKindShift = 0 - flagRO = 1 << 5 - flagIndir = 1 << 6 - - // Commit adf9b30e5594 modified the flags to separate the - // flagRO flag into two bits which specifies whether or not the - // field is embedded. This causes flagIndir to move over a bit - // and means that flagRO is the combination of either of the - // original flagRO bit and the new bit. - // - // This code detects the change by extracting what used to be - // the indirect bit to ensure it's set. When it's not, the flag - // order has been changed to the newer format, so the flags are - // updated accordingly. - if upfv&flagIndir == 0 { - flagRO = 3 << 5 - flagIndir = 1 << 7 - } +// Different versions of Go have used different +// bit layouts for the flags type. This table +// records the known combinations. +var okFlags = []struct { + ro, addr flag +}{{ + // From Go 1.4 to 1.5 + ro: 1 << 5, + addr: 1 << 7, +}, { + // Up to Go tip. + ro: 1<<5 | 1<<6, + addr: 1 << 8, +}} + +var flagValOffset = func() uintptr { + field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") + if !ok { + panic("reflect.Value has no flag field") } + return field.Offset +}() + +// flagField returns a pointer to the flag field of a reflect.Value. +func flagField(v *reflect.Value) *flag { + return (*flag)(unsafe.Pointer(uintptr(unsafe.Pointer(v)) + flagValOffset)) } // unsafeReflectValue converts the passed reflect.Value into a one that bypasses @@ -119,34 +90,56 @@ func init() { // This allows us to check for implementations of the Stringer and error // interfaces to be used for pretty printing ordinarily unaddressable and // inaccessible values such as unexported struct fields. -func unsafeReflectValue(v reflect.Value) (rv reflect.Value) { - indirects := 1 - vt := v.Type() - upv := unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetPtr) - rvf := *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + offsetFlag)) - if rvf&flagIndir != 0 { - vt = reflect.PtrTo(v.Type()) - indirects++ - } else if offsetScalar != 0 { - // The value is in the scalar field when it's not one of the - // reference types. - switch vt.Kind() { - case reflect.Uintptr: - case reflect.Chan: - case reflect.Func: - case reflect.Map: - case reflect.Ptr: - case reflect.UnsafePointer: - default: - upv = unsafe.Pointer(uintptr(unsafe.Pointer(&v)) + - offsetScalar) - } +func unsafeReflectValue(v reflect.Value) reflect.Value { + if !v.IsValid() || (v.CanInterface() && v.CanAddr()) { + return v } + flagFieldPtr := flagField(&v) + *flagFieldPtr &^= flagRO + *flagFieldPtr |= flagAddr + return v +} - pv := reflect.NewAt(vt, upv) - rv = pv - for i := 0; i < indirects; i++ { - rv = rv.Elem() +// Sanity checks against future reflect package changes +// to the type or semantics of the Value.flag field. +func init() { + field, ok := reflect.TypeOf(reflect.Value{}).FieldByName("flag") + if !ok { + panic("reflect.Value has no flag field") + } + if field.Type.Kind() != reflect.TypeOf(flag(0)).Kind() { + panic("reflect.Value flag field has changed kind") + } + type t0 int + var t struct { + A t0 + // t0 will have flagEmbedRO set. + t0 + // a will have flagStickyRO set + a t0 + } + vA := reflect.ValueOf(t).FieldByName("A") + va := reflect.ValueOf(t).FieldByName("a") + vt0 := reflect.ValueOf(t).FieldByName("t0") + + // Infer flagRO from the difference between the flags + // for the (otherwise identical) fields in t. + flagPublic := *flagField(&vA) + flagWithRO := *flagField(&va) | *flagField(&vt0) + flagRO = flagPublic ^ flagWithRO + + // Infer flagAddr from the difference between a value + // taken from a pointer and not. + vPtrA := reflect.ValueOf(&t).Elem().FieldByName("A") + flagNoPtr := *flagField(&vA) + flagPtr := *flagField(&vPtrA) + flagAddr = flagNoPtr ^ flagPtr + + // Check that the inferred flags tally with one of the known versions. + for _, f := range okFlags { + if flagRO == f.ro && flagAddr == f.addr { + return + } } - return rv + panic("reflect.Value read-only flag has changed semantics") } diff --git a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go index 1fe3cf3d5d10..205c28d68c47 100644 --- a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go +++ b/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go @@ -16,7 +16,7 @@ // when the code is running on Google App Engine, compiled by GopherJS, or // "-tags safe" is added to the go build command line. The "disableunsafe" // tag is deprecated and thus should not be used. -// +build js appengine safe disableunsafe +// +build js appengine safe disableunsafe !go1.4 package spew diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/LICENSE.txt b/vendor/github.com/denverdino/aliyungo/LICENSE.txt similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/LICENSE.txt rename to vendor/github.com/denverdino/aliyungo/LICENSE.txt diff --git a/vendor/github.com/denverdino/aliyungo/common/client.go b/vendor/github.com/denverdino/aliyungo/common/client.go new file mode 100644 index 000000000000..6c00d1c19065 --- /dev/null +++ b/vendor/github.com/denverdino/aliyungo/common/client.go @@ -0,0 +1,550 @@ +package common + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "log" + "net/http" + "net/url" + "os" + "strconv" + "strings" + "time" + + "github.com/denverdino/aliyungo/util" +) + +// RemovalPolicy.N add index to array item +// RemovalPolicy=["a", "b"] => RemovalPolicy.1="a" RemovalPolicy.2="b" +type FlattenArray []string + +// string contains underline which will be replaced with dot +// SystemDisk_Category => SystemDisk.Category +type UnderlineString string + +// A Client represents a client of ECS services +type Client struct { + AccessKeyId string //Access Key Id + AccessKeySecret string //Access Key Secret + securityToken string + debug bool + httpClient *http.Client + endpoint string + version string + serviceCode string + regionID Region + businessInfo string + userAgent string +} + +// Initialize properties of a client instance +func (client *Client) Init(endpoint, version, accessKeyId, accessKeySecret string) { + client.AccessKeyId = accessKeyId + ak := accessKeySecret + if !strings.HasSuffix(ak, "&") { + ak += "&" + } + client.AccessKeySecret = ak + client.debug = false + handshakeTimeout, err := strconv.Atoi(os.Getenv("TLSHandshakeTimeout")) + if err != nil { + handshakeTimeout = 0 + } + if handshakeTimeout == 0 { + client.httpClient = &http.Client{} + } else { + t := &http.Transport{ + TLSHandshakeTimeout: time.Duration(handshakeTimeout) * time.Second} + client.httpClient = &http.Client{Transport: t} + } + client.endpoint = endpoint + client.version = version +} + +// Initialize properties of a client instance including regionID +func (client *Client) NewInit(endpoint, version, accessKeyId, accessKeySecret, serviceCode string, regionID Region) { + client.Init(endpoint, version, accessKeyId, accessKeySecret) + client.serviceCode = serviceCode + client.regionID = regionID +} + +// Intialize client object when all properties are ready +func (client *Client) InitClient() *Client { + client.debug = false + handshakeTimeout, err := strconv.Atoi(os.Getenv("TLSHandshakeTimeout")) + if err != nil { + handshakeTimeout = 0 + } + if handshakeTimeout == 0 { + client.httpClient = &http.Client{} + } else { + t := &http.Transport{ + TLSHandshakeTimeout: time.Duration(handshakeTimeout) * time.Second} + client.httpClient = &http.Client{Transport: t} + } + return client +} + +func (client *Client) NewInitForAssumeRole(endpoint, version, accessKeyId, accessKeySecret, serviceCode string, regionID Region, securityToken string) { + client.NewInit(endpoint, version, accessKeyId, accessKeySecret, serviceCode, regionID) + client.securityToken = securityToken +} + +//getLocationEndpoint +func (client *Client) getEndpointByLocation() string { + locationClient := NewLocationClient(client.AccessKeyId, client.AccessKeySecret, client.securityToken) + locationClient.SetDebug(true) + return locationClient.DescribeOpenAPIEndpoint(client.regionID, client.serviceCode) +} + +//NewClient using location service +func (client *Client) setEndpointByLocation(region Region, serviceCode, accessKeyId, accessKeySecret, securityToken string) { + locationClient := NewLocationClient(accessKeyId, accessKeySecret, securityToken) + locationClient.SetDebug(true) + ep := locationClient.DescribeOpenAPIEndpoint(region, serviceCode) + if ep == "" { + ep = loadEndpointFromFile(region, serviceCode) + } + + if ep != "" { + client.endpoint = ep + } +} + +// Ensure all necessary properties are valid +func (client *Client) ensureProperties() error { + var msg string + + if client.endpoint == "" { + msg = fmt.Sprintf("endpoint cannot be empty!") + } else if client.version == "" { + msg = fmt.Sprintf("version cannot be empty!") + } else if client.AccessKeyId == "" { + msg = fmt.Sprintf("AccessKeyId cannot be empty!") + } else if client.AccessKeySecret == "" { + msg = fmt.Sprintf("AccessKeySecret cannot be empty!") + } + + if msg != "" { + return errors.New(msg) + } + + return nil +} + +// ---------------------------------------------------- +// WithXXX methods +// ---------------------------------------------------- + +// WithEndpoint sets custom endpoint +func (client *Client) WithEndpoint(endpoint string) *Client { + client.SetEndpoint(endpoint) + return client +} + +// WithVersion sets custom version +func (client *Client) WithVersion(version string) *Client { + client.SetVersion(version) + return client +} + +// WithRegionID sets Region ID +func (client *Client) WithRegionID(regionID Region) *Client { + client.SetRegionID(regionID) + return client +} + +//WithServiceCode sets serviceCode +func (client *Client) WithServiceCode(serviceCode string) *Client { + client.SetServiceCode(serviceCode) + return client +} + +// WithAccessKeyId sets new AccessKeyId +func (client *Client) WithAccessKeyId(id string) *Client { + client.SetAccessKeyId(id) + return client +} + +// WithAccessKeySecret sets new AccessKeySecret +func (client *Client) WithAccessKeySecret(secret string) *Client { + client.SetAccessKeySecret(secret) + return client +} + +// WithSecurityToken sets securityToken +func (client *Client) WithSecurityToken(securityToken string) *Client { + client.SetSecurityToken(securityToken) + return client +} + +// WithDebug sets debug mode to log the request/response message +func (client *Client) WithDebug(debug bool) *Client { + client.SetDebug(debug) + return client +} + +// WithBusinessInfo sets business info to log the request/response message +func (client *Client) WithBusinessInfo(businessInfo string) *Client { + client.SetBusinessInfo(businessInfo) + return client +} + +// WithUserAgent sets user agent to the request/response message +func (client *Client) WithUserAgent(userAgent string) *Client { + client.SetUserAgent(userAgent) + return client +} + +// ---------------------------------------------------- +// SetXXX methods +// ---------------------------------------------------- + +// SetEndpoint sets custom endpoint +func (client *Client) SetEndpoint(endpoint string) { + client.endpoint = endpoint +} + +// SetEndpoint sets custom version +func (client *Client) SetVersion(version string) { + client.version = version +} + +// SetEndpoint sets Region ID +func (client *Client) SetRegionID(regionID Region) { + client.regionID = regionID +} + +//SetServiceCode sets serviceCode +func (client *Client) SetServiceCode(serviceCode string) { + client.serviceCode = serviceCode +} + +// SetAccessKeyId sets new AccessKeyId +func (client *Client) SetAccessKeyId(id string) { + client.AccessKeyId = id +} + +// SetAccessKeySecret sets new AccessKeySecret +func (client *Client) SetAccessKeySecret(secret string) { + client.AccessKeySecret = secret + "&" +} + +// SetDebug sets debug mode to log the request/response message +func (client *Client) SetDebug(debug bool) { + client.debug = debug +} + +// SetBusinessInfo sets business info to log the request/response message +func (client *Client) SetBusinessInfo(businessInfo string) { + if strings.HasPrefix(businessInfo, "/") { + client.businessInfo = businessInfo + } else if businessInfo != "" { + client.businessInfo = "/" + businessInfo + } +} + +// SetUserAgent sets user agent to the request/response message +func (client *Client) SetUserAgent(userAgent string) { + client.userAgent = userAgent +} + +//set SecurityToken +func (client *Client) SetSecurityToken(securityToken string) { + client.securityToken = securityToken +} + +func (client *Client) initEndpoint() error { + // if set any value to "CUSTOMIZED_ENDPOINT" could skip location service. + // example: export CUSTOMIZED_ENDPOINT=true + if os.Getenv("CUSTOMIZED_ENDPOINT") != "" { + return nil + } + + if client.serviceCode != "" && client.regionID != "" { + endpoint := client.getEndpointByLocation() + if endpoint == "" { + return GetCustomError("InvalidEndpoint", "endpoint is empty,pls check") + } + client.endpoint = endpoint + } + return nil +} + +// Invoke sends the raw HTTP request for ECS services +func (client *Client) Invoke(action string, args interface{}, response interface{}) error { + if err := client.ensureProperties(); err != nil { + return err + } + + //init endpoint + if err := client.initEndpoint(); err != nil { + return err + } + + request := Request{} + request.init(client.version, action, client.AccessKeyId, client.securityToken, client.regionID) + + query := util.ConvertToQueryValues(request) + util.SetQueryValues(args, &query) + + // Sign request + signature := util.CreateSignatureForRequest(ECSRequestMethod, &query, client.AccessKeySecret) + + // Generate the request URL + requestURL := client.endpoint + "?" + query.Encode() + "&Signature=" + url.QueryEscape(signature) + + httpReq, err := http.NewRequest(ECSRequestMethod, requestURL, nil) + + if err != nil { + return GetClientError(err) + } + + // TODO move to util and add build val flag + httpReq.Header.Set("X-SDK-Client", `AliyunGO/`+Version+client.businessInfo) + + httpReq.Header.Set("User-Agent", httpReq.UserAgent()+" "+client.userAgent) + + t0 := time.Now() + httpResp, err := client.httpClient.Do(httpReq) + t1 := time.Now() + if err != nil { + return GetClientError(err) + } + statusCode := httpResp.StatusCode + + if client.debug { + log.Printf("Invoke %s %s %d (%v)", ECSRequestMethod, requestURL, statusCode, t1.Sub(t0)) + } + + defer httpResp.Body.Close() + body, err := ioutil.ReadAll(httpResp.Body) + + if err != nil { + return GetClientError(err) + } + + if client.debug { + var prettyJSON bytes.Buffer + err = json.Indent(&prettyJSON, body, "", " ") + log.Println(string(prettyJSON.Bytes())) + } + + if statusCode >= 400 && statusCode <= 599 { + errorResponse := ErrorResponse{} + err = json.Unmarshal(body, &errorResponse) + ecsError := &Error{ + ErrorResponse: errorResponse, + StatusCode: statusCode, + } + return ecsError + } + + err = json.Unmarshal(body, response) + //log.Printf("%++v", response) + if err != nil { + return GetClientError(err) + } + + return nil +} + +// Invoke sends the raw HTTP request for ECS services +func (client *Client) InvokeByFlattenMethod(action string, args interface{}, response interface{}) error { + if err := client.ensureProperties(); err != nil { + return err + } + + //init endpoint + if err := client.initEndpoint(); err != nil { + return err + } + + request := Request{} + request.init(client.version, action, client.AccessKeyId, client.securityToken, client.regionID) + + query := util.ConvertToQueryValues(request) + + util.SetQueryValueByFlattenMethod(args, &query) + + // Sign request + signature := util.CreateSignatureForRequest(ECSRequestMethod, &query, client.AccessKeySecret) + + // Generate the request URL + requestURL := client.endpoint + "?" + query.Encode() + "&Signature=" + url.QueryEscape(signature) + + httpReq, err := http.NewRequest(ECSRequestMethod, requestURL, nil) + + if err != nil { + return GetClientError(err) + } + + // TODO move to util and add build val flag + httpReq.Header.Set("X-SDK-Client", `AliyunGO/`+Version+client.businessInfo) + + httpReq.Header.Set("User-Agent", httpReq.UserAgent()+" "+client.userAgent) + + t0 := time.Now() + httpResp, err := client.httpClient.Do(httpReq) + t1 := time.Now() + if err != nil { + return GetClientError(err) + } + statusCode := httpResp.StatusCode + + if client.debug { + log.Printf("Invoke %s %s %d (%v)", ECSRequestMethod, requestURL, statusCode, t1.Sub(t0)) + } + + defer httpResp.Body.Close() + body, err := ioutil.ReadAll(httpResp.Body) + + if err != nil { + return GetClientError(err) + } + + if client.debug { + var prettyJSON bytes.Buffer + err = json.Indent(&prettyJSON, body, "", " ") + log.Println(string(prettyJSON.Bytes())) + } + + if statusCode >= 400 && statusCode <= 599 { + errorResponse := ErrorResponse{} + err = json.Unmarshal(body, &errorResponse) + ecsError := &Error{ + ErrorResponse: errorResponse, + StatusCode: statusCode, + } + return ecsError + } + + err = json.Unmarshal(body, response) + //log.Printf("%++v", response) + if err != nil { + return GetClientError(err) + } + + return nil +} + +// Invoke sends the raw HTTP request for ECS services +//改进了一下上é¢é‚£ä¸ªæ–¹æ³•ï¼Œå¯ä»¥ä½¿ç”¨å„ç§Http方法 +//2017.1.30 增加了一个pathå‚数,用æ¥æ‹“å±•è®¿é—®çš„åœ°å€ +func (client *Client) InvokeByAnyMethod(method, action, path string, args interface{}, response interface{}) error { + if err := client.ensureProperties(); err != nil { + return err + } + + //init endpoint + if err := client.initEndpoint(); err != nil { + return err + } + + request := Request{} + request.init(client.version, action, client.AccessKeyId, client.securityToken, client.regionID) + data := util.ConvertToQueryValues(request) + util.SetQueryValues(args, &data) + + // Sign request + signature := util.CreateSignatureForRequest(method, &data, client.AccessKeySecret) + + data.Add("Signature", signature) + // Generate the request URL + var ( + httpReq *http.Request + err error + ) + if method == http.MethodGet { + requestURL := client.endpoint + path + "?" + data.Encode() + //fmt.Println(requestURL) + httpReq, err = http.NewRequest(method, requestURL, nil) + } else { + //fmt.Println(client.endpoint + path) + httpReq, err = http.NewRequest(method, client.endpoint+path, strings.NewReader(data.Encode())) + httpReq.Header.Set("Content-Type", "application/x-www-form-urlencoded") + } + + if err != nil { + return GetClientError(err) + } + + // TODO move to util and add build val flag + httpReq.Header.Set("X-SDK-Client", `AliyunGO/`+Version+client.businessInfo) + httpReq.Header.Set("User-Agent", httpReq.Header.Get("User-Agent")+" "+client.userAgent) + + t0 := time.Now() + httpResp, err := client.httpClient.Do(httpReq) + t1 := time.Now() + if err != nil { + return GetClientError(err) + } + statusCode := httpResp.StatusCode + + if client.debug { + log.Printf("Invoke %s %s %d (%v) %v", ECSRequestMethod, client.endpoint, statusCode, t1.Sub(t0), data.Encode()) + } + + defer httpResp.Body.Close() + body, err := ioutil.ReadAll(httpResp.Body) + + if err != nil { + return GetClientError(err) + } + + if client.debug { + var prettyJSON bytes.Buffer + err = json.Indent(&prettyJSON, body, "", " ") + log.Println(string(prettyJSON.Bytes())) + } + + if statusCode >= 400 && statusCode <= 599 { + errorResponse := ErrorResponse{} + err = json.Unmarshal(body, &errorResponse) + ecsError := &Error{ + ErrorResponse: errorResponse, + StatusCode: statusCode, + } + return ecsError + } + + err = json.Unmarshal(body, response) + //log.Printf("%++v", response) + if err != nil { + return GetClientError(err) + } + + return nil +} + +// GenerateClientToken generates the Client Token with random string +func (client *Client) GenerateClientToken() string { + return util.CreateRandomString() +} + +func GetClientErrorFromString(str string) error { + return &Error{ + ErrorResponse: ErrorResponse{ + Code: "AliyunGoClientFailure", + Message: str, + }, + StatusCode: -1, + } +} + +func GetClientError(err error) error { + return GetClientErrorFromString(err.Error()) +} + +func GetCustomError(code, message string) error { + return &Error{ + ErrorResponse: ErrorResponse{ + Code: code, + Message: message, + }, + StatusCode: 400, + } +} diff --git a/vendor/github.com/denverdino/aliyungo/common/endpoint.go b/vendor/github.com/denverdino/aliyungo/common/endpoint.go new file mode 100644 index 000000000000..757f7a7849cc --- /dev/null +++ b/vendor/github.com/denverdino/aliyungo/common/endpoint.go @@ -0,0 +1,208 @@ +package common + +import ( + "encoding/xml" + "fmt" + "io/ioutil" + "log" + "os" + "strings" + "time" +) + +const ( + // LocationDefaultEndpoint is the default API endpoint of Location services + locationDefaultEndpoint = "https://location.aliyuncs.com" + locationAPIVersion = "2015-06-12" + HTTP_PROTOCOL = "http" + HTTPS_PROTOCOL = "https" +) + +var ( + endpoints = make(map[Region]map[string]string) + + SpecailEnpoints = map[Region]map[string]string{ + APNorthEast1: { + "ecs": "https://ecs.ap-northeast-1.aliyuncs.com", + "slb": "https://slb.ap-northeast-1.aliyuncs.com", + "rds": "https://rds.ap-northeast-1.aliyuncs.com", + "vpc": "https://vpc.ap-northeast-1.aliyuncs.com", + }, + APSouthEast2: { + "ecs": "https://ecs.ap-southeast-2.aliyuncs.com", + "slb": "https://slb.ap-southeast-2.aliyuncs.com", + "rds": "https://rds.ap-southeast-2.aliyuncs.com", + "vpc": "https://vpc.ap-southeast-2.aliyuncs.com", + }, + APSouthEast3: { + "ecs": "https://ecs.ap-southeast-3.aliyuncs.com", + "slb": "https://slb.ap-southeast-3.aliyuncs.com", + "rds": "https://rds.ap-southeast-3.aliyuncs.com", + "vpc": "https://vpc.ap-southeast-3.aliyuncs.com", + }, + MEEast1: { + "ecs": "https://ecs.me-east-1.aliyuncs.com", + "slb": "https://slb.me-east-1.aliyuncs.com", + "rds": "https://rds.me-east-1.aliyuncs.com", + "vpc": "https://vpc.me-east-1.aliyuncs.com", + }, + EUCentral1: { + "ecs": "https://ecs.eu-central-1.aliyuncs.com", + "slb": "https://slb.eu-central-1.aliyuncs.com", + "rds": "https://rds.eu-central-1.aliyuncs.com", + "vpc": "https://vpc.eu-central-1.aliyuncs.com", + }, + EUWest1: { + "ecs": "https://ecs.eu-west-1.aliyuncs.com", + "slb": "https://slb.eu-west-1.aliyuncs.com", + "rds": "https://rds.eu-west-1.aliyuncs.com", + "vpc": "https://vpc.eu-west-1.aliyuncs.com", + }, + Zhangjiakou: { + "ecs": "https://ecs.cn-zhangjiakou.aliyuncs.com", + "slb": "https://slb.cn-zhangjiakou.aliyuncs.com", + "rds": "https://rds.cn-zhangjiakou.aliyuncs.com", + "vpc": "https://vpc.cn-zhangjiakou.aliyuncs.com", + }, + Huhehaote: { + "ecs": "https://ecs.cn-huhehaote.aliyuncs.com", + "slb": "https://slb.cn-huhehaote.aliyuncs.com", + "rds": "https://rds.cn-huhehaote.aliyuncs.com", + "vpc": "https://vpc.cn-huhehaote.aliyuncs.com", + }, + } +) + +//init endpoints from file +func init() { + +} + +type LocationClient struct { + Client +} + +func NewLocationClient(accessKeyId, accessKeySecret, securityToken string) *LocationClient { + endpoint := os.Getenv("LOCATION_ENDPOINT") + if endpoint == "" { + endpoint = locationDefaultEndpoint + } + + client := &LocationClient{} + client.Init(endpoint, locationAPIVersion, accessKeyId, accessKeySecret) + client.securityToken = securityToken + return client +} + +func NewLocationClientWithSecurityToken(accessKeyId, accessKeySecret, securityToken string) *LocationClient { + endpoint := os.Getenv("LOCATION_ENDPOINT") + if endpoint == "" { + endpoint = locationDefaultEndpoint + } + + client := &LocationClient{} + client.WithEndpoint(endpoint). + WithVersion(locationAPIVersion). + WithAccessKeyId(accessKeyId). + WithAccessKeySecret(accessKeySecret). + WithSecurityToken(securityToken). + InitClient() + return client +} + +func (client *LocationClient) DescribeEndpoint(args *DescribeEndpointArgs) (*DescribeEndpointResponse, error) { + response := &DescribeEndpointResponse{} + err := client.Invoke("DescribeEndpoint", args, response) + if err != nil { + return nil, err + } + return response, err +} + +func (client *LocationClient) DescribeEndpoints(args *DescribeEndpointsArgs) (*DescribeEndpointsResponse, error) { + response := &DescribeEndpointsResponse{} + err := client.Invoke("DescribeEndpoints", args, response) + if err != nil { + return nil, err + } + return response, err +} + +func getProductRegionEndpoint(region Region, serviceCode string) string { + if sp, ok := endpoints[region]; ok { + if endpoint, ok := sp[serviceCode]; ok { + return endpoint + } + } + + return "" +} + +func setProductRegionEndpoint(region Region, serviceCode string, endpoint string) { + endpoints[region] = map[string]string{ + serviceCode: endpoint, + } +} + +func (client *LocationClient) DescribeOpenAPIEndpoint(region Region, serviceCode string) string { + if endpoint := getProductRegionEndpoint(region, serviceCode); endpoint != "" { + return endpoint + } + defaultProtocols := HTTP_PROTOCOL + + args := &DescribeEndpointsArgs{ + Id: region, + ServiceCode: serviceCode, + Type: "openAPI", + } + + var endpoint *DescribeEndpointsResponse + var err error + for index := 0; index < 5; index++ { + endpoint, err = client.DescribeEndpoints(args) + if err == nil && endpoint != nil && len(endpoint.Endpoints.Endpoint) > 0 { + break + } + time.Sleep(500 * time.Millisecond) + } + + if err != nil || endpoint == nil || len(endpoint.Endpoints.Endpoint) <= 0 { + log.Printf("aliyungo: can not get endpoint from service, use default. endpoint=[%v], error=[%v]\n", endpoint, err) + return "" + } + + for _, protocol := range endpoint.Endpoints.Endpoint[0].Protocols.Protocols { + if strings.ToLower(protocol) == HTTPS_PROTOCOL { + defaultProtocols = HTTPS_PROTOCOL + break + } + } + + ep := fmt.Sprintf("%s://%s", defaultProtocols, endpoint.Endpoints.Endpoint[0].Endpoint) + + setProductRegionEndpoint(region, serviceCode, ep) + return ep +} + +func loadEndpointFromFile(region Region, serviceCode string) string { + data, err := ioutil.ReadFile("./endpoints.xml") + if err != nil { + return "" + } + var endpoints Endpoints + err = xml.Unmarshal(data, &endpoints) + if err != nil { + return "" + } + for _, endpoint := range endpoints.Endpoint { + if endpoint.RegionIds.RegionId == string(region) { + for _, product := range endpoint.Products.Product { + if strings.ToLower(product.ProductName) == serviceCode { + return fmt.Sprintf("%s://%s", HTTPS_PROTOCOL, product.DomainName) + } + } + } + } + + return "" +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/common/endpoints.xml b/vendor/github.com/denverdino/aliyungo/common/endpoints.xml similarity index 98% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/common/endpoints.xml rename to vendor/github.com/denverdino/aliyungo/common/endpoints.xml index 4079bcd2b508..26ea765b2e35 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/common/endpoints.xml +++ b/vendor/github.com/denverdino/aliyungo/common/endpoints.xml @@ -1336,6 +1336,17 @@ Slbslb.eu-central-1.aliyuncs.com + + eu-west-1 + + Rdsrds.eu-west-1.aliyuncs.com + Ecsecs.eu-west-1.aliyuncs.com + Vpcvpc.eu-west-1.aliyuncs.com + Kmskms.eu-west-1.aliyuncs.com + Cmsmetrics.cn-hangzhou.aliyuncs.com + Slbslb.eu-west-1.aliyuncs.com + + cn-zhangjiakou @@ -1346,4 +1357,14 @@ Slbslb.cn-zhangjiakou.aliyuncs.com + + cn-huhehaote + + Rdsrds.cn-huhehaote.aliyuncs.com + Ecsecs.cn-huhehaote.aliyuncs.com + Vpcvpc.cn-huhehaote.aliyuncs.com + Cmsmetrics.cn-hangzhou.aliyuncs.com + Slbslb.cn-huhehaote.aliyuncs.com + + diff --git a/vendor/github.com/denverdino/aliyungo/common/regions.go b/vendor/github.com/denverdino/aliyungo/common/regions.go new file mode 100644 index 000000000000..e6bc728fec67 --- /dev/null +++ b/vendor/github.com/denverdino/aliyungo/common/regions.go @@ -0,0 +1,55 @@ +package common + +// Region represents ECS region +type Region string + +// Constants of region definition +const ( + Hangzhou = Region("cn-hangzhou") + Qingdao = Region("cn-qingdao") + Beijing = Region("cn-beijing") + Hongkong = Region("cn-hongkong") + Shenzhen = Region("cn-shenzhen") + Shanghai = Region("cn-shanghai") + Zhangjiakou = Region("cn-zhangjiakou") + Huhehaote = Region("cn-huhehaote") + + APSouthEast1 = Region("ap-southeast-1") + APNorthEast1 = Region("ap-northeast-1") + APSouthEast2 = Region("ap-southeast-2") + APSouthEast3 = Region("ap-southeast-3") + APSouthEast5 = Region("ap-southeast-5") + + APSouth1 = Region("ap-south-1") + + USWest1 = Region("us-west-1") + USEast1 = Region("us-east-1") + + MEEast1 = Region("me-east-1") + + EUCentral1 = Region("eu-central-1") + EUWest1 = Region("eu-west-1") + + ShenZhenFinance = Region("cn-shenzhen-finance-1") + ShanghaiFinance = Region("cn-shanghai-finance-1") +) + +var ValidRegions = []Region{ + Hangzhou, Qingdao, Beijing, Shenzhen, Hongkong, Shanghai, Zhangjiakou, Huhehaote, + USWest1, USEast1, + APNorthEast1, APSouthEast1, APSouthEast2, APSouthEast3, APSouthEast5, + APSouth1, + MEEast1, + EUCentral1, EUWest1, + ShenZhenFinance, ShanghaiFinance, +} + +// IsValidRegion checks if r is an Ali supported region. +func IsValidRegion(r string) bool { + for _, v := range ValidRegions { + if r == string(v) { + return true + } + } + return false +} diff --git a/vendor/github.com/denverdino/aliyungo/common/request.go b/vendor/github.com/denverdino/aliyungo/common/request.go new file mode 100644 index 000000000000..f35c2990def7 --- /dev/null +++ b/vendor/github.com/denverdino/aliyungo/common/request.go @@ -0,0 +1,105 @@ +package common + +import ( + "fmt" + "log" + "time" + + "github.com/denverdino/aliyungo/util" +) + +// Constants for Aliyun API requests +const ( + SignatureVersion = "1.0" + SignatureMethod = "HMAC-SHA1" + JSONResponseFormat = "JSON" + XMLResponseFormat = "XML" + ECSRequestMethod = "GET" +) + +type Request struct { + Format string + Version string + RegionId Region + AccessKeyId string + SecurityToken string + Signature string + SignatureMethod string + Timestamp util.ISO6801Time + SignatureVersion string + SignatureNonce string + ResourceOwnerAccount string + Action string +} + +func (request *Request) init(version string, action string, AccessKeyId string, securityToken string, regionId Region) { + request.Format = JSONResponseFormat + request.Timestamp = util.NewISO6801Time(time.Now().UTC()) + request.Version = version + request.SignatureVersion = SignatureVersion + request.SignatureMethod = SignatureMethod + request.SignatureNonce = util.CreateRandomString() + request.Action = action + request.AccessKeyId = AccessKeyId + request.SecurityToken = securityToken + request.RegionId = regionId +} + +type Response struct { + RequestId string +} + +type ErrorResponse struct { + Response + HostId string + Code string + Message string +} + +// An Error represents a custom error for Aliyun API failure response +type Error struct { + ErrorResponse + StatusCode int //Status Code of HTTP Response +} + +func (e *Error) Error() string { + return fmt.Sprintf("Aliyun API Error: RequestId: %s Status Code: %d Code: %s Message: %s", e.RequestId, e.StatusCode, e.Code, e.Message) +} + +type Pagination struct { + PageNumber int + PageSize int +} + +func (p *Pagination) SetPageSize(size int) { + p.PageSize = size +} + +func (p *Pagination) Validate() { + if p.PageNumber < 0 { + log.Printf("Invalid PageNumber: %d", p.PageNumber) + p.PageNumber = 1 + } + if p.PageSize < 0 { + log.Printf("Invalid PageSize: %d", p.PageSize) + p.PageSize = 10 + } else if p.PageSize > 50 { + log.Printf("Invalid PageSize: %d", p.PageSize) + p.PageSize = 50 + } +} + +// A PaginationResponse represents a response with pagination information +type PaginationResult struct { + TotalCount int + PageNumber int + PageSize int +} + +// NextPage gets the next page of the result set +func (r *PaginationResult) NextPage() *Pagination { + if r.PageNumber*r.PageSize >= r.TotalCount { + return nil + } + return &Pagination{PageNumber: r.PageNumber + 1, PageSize: r.PageSize} +} diff --git a/vendor/github.com/denverdino/aliyungo/common/types.go b/vendor/github.com/denverdino/aliyungo/common/types.go new file mode 100644 index 000000000000..cf161f11b1c3 --- /dev/null +++ b/vendor/github.com/denverdino/aliyungo/common/types.go @@ -0,0 +1,107 @@ +package common + +type InternetChargeType string + +const ( + PayByBandwidth = InternetChargeType("PayByBandwidth") + PayByTraffic = InternetChargeType("PayByTraffic") +) + +type InstanceChargeType string + +const ( + PrePaid = InstanceChargeType("PrePaid") + PostPaid = InstanceChargeType("PostPaid") +) + +type DescribeEndpointArgs struct { + Id Region + ServiceCode string + Type string +} + +type EndpointItem struct { + Protocols struct { + Protocols []string + } + Type string + Namespace string + Id Region + SerivceCode string + Endpoint string +} + +type DescribeEndpointResponse struct { + Response + EndpointItem +} + +type DescribeEndpointsArgs struct { + Id Region + ServiceCode string + Type string +} + +type DescribeEndpointsResponse struct { + Response + Endpoints APIEndpoints + RequestId string + Success bool +} + +type APIEndpoints struct { + Endpoint []EndpointItem +} + +type NetType string + +const ( + Internet = NetType("Internet") + Intranet = NetType("Intranet") +) + +type TimeType string + +const ( + Hour = TimeType("Hour") + Day = TimeType("Day") + Week = TimeType("Week") + Month = TimeType("Month") + Year = TimeType("Year") +) + +type NetworkType string + +const ( + Classic = NetworkType("Classic") + VPC = NetworkType("VPC") +) + +type BusinessInfo struct { + Pack string `json:"pack,omitempty"` + ActivityId string `json:"activityId,omitempty"` +} + +//xml +type Endpoints struct { + Endpoint []Endpoint `xml:"Endpoint"` +} + +type Endpoint struct { + Name string `xml:"name,attr"` + RegionIds RegionIds `xml:"RegionIds"` + Products Products `xml:"Products"` +} + +type RegionIds struct { + RegionId string `xml:"RegionId"` +} + +type Products struct { + Product []Product `xml:"Product"` +} + +type Product struct { + ProductName string `xml:"ProductName"` + DomainName string `xml:"DomainName"` +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/common/version.go b/vendor/github.com/denverdino/aliyungo/common/version.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/common/version.go rename to vendor/github.com/denverdino/aliyungo/common/version.go diff --git a/vendor/github.com/denverdino/aliyungo/ecs/client.go b/vendor/github.com/denverdino/aliyungo/ecs/client.go new file mode 100644 index 000000000000..7ae1fb52ee8d --- /dev/null +++ b/vendor/github.com/denverdino/aliyungo/ecs/client.go @@ -0,0 +1,124 @@ +package ecs + +import ( + "os" + + "github.com/denverdino/aliyungo/common" +) + +// Interval for checking status in WaitForXXX method +const DefaultWaitForInterval = 5 + +// Default timeout value for WaitForXXX method +const DefaultTimeout = 60 + +type Client struct { + common.Client +} + +const ( + // ECSDefaultEndpoint is the default API endpoint of ECS services + ECSDefaultEndpoint = "https://ecs-cn-hangzhou.aliyuncs.com" + ECSAPIVersion = "2014-05-26" + ECSServiceCode = "ecs" + + VPCDefaultEndpoint = "https://vpc.aliyuncs.com" + VPCAPIVersion = "2016-04-28" + VPCServiceCode = "vpc" +) + +// NewClient creates a new instance of ECS client +func NewClient(accessKeyId, accessKeySecret string) *Client { + endpoint := os.Getenv("ECS_ENDPOINT") + if endpoint == "" { + endpoint = ECSDefaultEndpoint + } + return NewClientWithEndpoint(endpoint, accessKeyId, accessKeySecret) +} + +func NewClientWithRegion(endpoint string, accessKeyId string, accessKeySecret string, regionID common.Region) *Client { + client := &Client{} + client.NewInit(endpoint, ECSAPIVersion, accessKeyId, accessKeySecret, ECSServiceCode, regionID) + return client +} + +func NewClientWithEndpoint(endpoint string, accessKeyId string, accessKeySecret string) *Client { + client := &Client{} + client.Init(endpoint, ECSAPIVersion, accessKeyId, accessKeySecret) + return client +} + +// --------------------------------------- +// NewECSClient creates a new instance of ECS client +// --------------------------------------- +func NewECSClient(accessKeyId, accessKeySecret string, regionID common.Region) *Client { + return NewECSClientWithSecurityToken(accessKeyId, accessKeySecret, "", regionID) +} + +func NewECSClientWithSecurityToken(accessKeyId string, accessKeySecret string, securityToken string, regionID common.Region) *Client { + endpoint := os.Getenv("ECS_ENDPOINT") + if endpoint == "" { + endpoint = ECSDefaultEndpoint + } + + return NewECSClientWithEndpointAndSecurityToken(endpoint, accessKeyId, accessKeySecret, securityToken, regionID) +} + +func NewECSClientWithEndpoint(endpoint string, accessKeyId string, accessKeySecret string, regionID common.Region) *Client { + return NewECSClientWithEndpointAndSecurityToken(endpoint, accessKeyId, accessKeySecret, "", regionID) +} + +func NewECSClientWithEndpointAndSecurityToken(endpoint string, accessKeyId string, accessKeySecret string, securityToken string, regionID common.Region) *Client { + client := &Client{} + client.WithEndpoint(endpoint). + WithVersion(ECSAPIVersion). + WithAccessKeyId(accessKeyId). + WithAccessKeySecret(accessKeySecret). + WithSecurityToken(securityToken). + WithServiceCode(ECSServiceCode). + WithRegionID(regionID). + InitClient() + return client +} + +// --------------------------------------- +// NewVPCClient creates a new instance of VPC client +// --------------------------------------- +func NewVPCClient(accessKeyId string, accessKeySecret string, regionID common.Region) *Client { + return NewVPCClientWithSecurityToken(accessKeyId, accessKeySecret, "", regionID) +} + +func NewVPCClientWithSecurityToken(accessKeyId string, accessKeySecret string, securityToken string, regionID common.Region) *Client { + endpoint := os.Getenv("VPC_ENDPOINT") + if endpoint == "" { + endpoint = VPCDefaultEndpoint + } + + return NewVPCClientWithEndpointAndSecurityToken(endpoint, accessKeyId, accessKeySecret, securityToken, regionID) +} + +func NewVPCClientWithEndpoint(endpoint string, accessKeyId string, accessKeySecret string, regionID common.Region) *Client { + return NewVPCClientWithEndpointAndSecurityToken(endpoint, accessKeyId, accessKeySecret, "", regionID) +} + +func NewVPCClientWithEndpointAndSecurityToken(endpoint string, accessKeyId string, accessKeySecret string, securityToken string, regionID common.Region) *Client { + client := &Client{} + client.WithEndpoint(endpoint). + WithVersion(VPCAPIVersion). + WithAccessKeyId(accessKeyId). + WithAccessKeySecret(accessKeySecret). + WithSecurityToken(securityToken). + WithServiceCode(VPCServiceCode). + WithRegionID(regionID). + InitClient() + return client +} + +// --------------------------------------- +// NewVPCClientWithRegion creates a new instance of VPC client automatically get endpoint +// --------------------------------------- +func NewVPCClientWithRegion(endpoint string, accessKeyId string, accessKeySecret string, regionID common.Region) *Client { + client := &Client{} + client.NewInit(endpoint, VPCAPIVersion, accessKeyId, accessKeySecret, VPCServiceCode, regionID) + return client +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/disks.go b/vendor/github.com/denverdino/aliyungo/ecs/disks.go similarity index 94% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/disks.go rename to vendor/github.com/denverdino/aliyungo/ecs/disks.go index 2cfbffc379fe..ae2c408728ea 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/disks.go +++ b/vendor/github.com/denverdino/aliyungo/ecs/disks.go @@ -59,7 +59,7 @@ type DescribeDisksArgs struct { Category DiskCategory //enum for all(default) | cloud | ephemeral Status DiskStatus //enum for In_use | Available | Attaching | Detaching | Creating | ReIniting | All(default) SnapshotId string - Name string + DiskName string Portable *bool //optional DeleteWithInstance *bool //optional DeleteAutoSnapshot *bool //optional @@ -78,6 +78,7 @@ type DiskItemType struct { DiskName string Description string Type DiskType + Encrypted bool Category DiskCategory Size int ImageId string @@ -241,6 +242,28 @@ func (client *Client) DetachDisk(instanceId string, diskId string) error { return err } +type ResizeDiskArgs struct { + DiskId string + NewSize int +} + +type ResizeDiskResponse struct { + common.Response +} + +// +// ResizeDisk can only support to enlarge disk size +// You can read doc at https://help.aliyun.com/document_detail/25522.html +func (client *Client) ResizeDisk(diskId string, sizeGB int) error { + args := ResizeDiskArgs{ + DiskId: diskId, + NewSize: sizeGB, + } + response := ResizeDiskResponse{} + err := client.Invoke("ResizeDisk", &args, &response) + return err +} + type ResetDiskArgs struct { DiskId string SnapshotId string diff --git a/vendor/github.com/denverdino/aliyungo/ecs/eni.go b/vendor/github.com/denverdino/aliyungo/ecs/eni.go new file mode 100644 index 000000000000..698d4fa70e39 --- /dev/null +++ b/vendor/github.com/denverdino/aliyungo/ecs/eni.go @@ -0,0 +1,183 @@ +package ecs + +import ( + "fmt" + "time" + + "github.com/denverdino/aliyungo/common" +) + +type CreateNetworkInterfaceArgs struct { + RegionId common.Region + VSwitchId string + PrimaryIpAddress string // optional + SecurityGroupId string + NetworkInterfaceName string // optional + Description string // optional + ClientToken string // optional +} + +type CreateNetworkInterfaceResponse struct { + common.Response + NetworkInterfaceId string +} +type DeleteNetworkInterfaceArgs struct { + RegionId common.Region + NetworkInterfaceId string +} + +type DeleteNetworkInterfaceResponse struct { + common.Response +} + +type DescribeNetworkInterfacesArgs struct { + RegionId common.Region + VSwitchId string + PrimaryIpAddress string + SecurityGroupId string + NetworkInterfaceName string + Type string + InstanceId string + NetworkInterfaceId []string `query:"list"` + PageNumber int + PageSize int +} +type NetworkInterfaceType struct { + NetworkInterfaceId string + NetworkInterfaceName string + PrimaryIpAddress string + MacAddress string + Status string + PrivateIpAddress string +} + +type DescribeNetworkInterfacesResponse struct { + common.Response + NetworkInterfaceSets struct { + NetworkInterfaceSet []NetworkInterfaceType + } + TotalCount int + PageNumber int + PageSize int +} +type AttachNetworkInterfaceArgs struct { + RegionId common.Region + NetworkInterfaceId string + InstanceId string +} + +type AttachNetworkInterfaceResponse common.Response + +type DetachNetworkInterfaceArgs AttachNetworkInterfaceArgs + +type DetachNetworkInterfaceResponse common.Response + +type ModifyNetworkInterfaceAttributeArgs struct { + RegionId common.Region + NetworkInterfaceId string + SecurityGroupId []string + NetworkInterfaceName string + Description string +} +type ModifyNetworkInterfaceAttributeResponse common.Response + +type UnassignPrivateIpAddressesArgs struct { + RegionId common.Region + NetworkInterfaceId string + PrivateIpAddress []string `query:"list"` +} + +type UnassignPrivateIpAddressesResponse common.Response + +type AssignPrivateIpAddressesArgs struct { + RegionId common.Region + NetworkInterfaceId string + PrivateIpAddress []string `query:"list"` // optional + SecondaryPrivateIpAddressCount int // optional +} + +type AssignPrivateIpAddressesResponse common.Response + +func (client *Client) CreateNetworkInterface(args *CreateNetworkInterfaceArgs) (resp *CreateNetworkInterfaceResponse, err error) { + resp = &CreateNetworkInterfaceResponse{} + err = client.Invoke("CreateNetworkInterface", args, resp) + return resp, err +} + +func (client *Client) DeleteNetworkInterface(args *DeleteNetworkInterfaceArgs) (resp *DeleteNetworkInterfaceResponse, err error) { + resp = &DeleteNetworkInterfaceResponse{} + err = client.Invoke("DeleteNetworkInterface", args, resp) + return resp, err +} + +func (client *Client) DescribeNetworkInterfaces(args *DescribeNetworkInterfacesArgs) (resp *DescribeNetworkInterfacesResponse, err error) { + resp = &DescribeNetworkInterfacesResponse{} + err = client.Invoke("DescribeNetworkInterfaces", args, resp) + return resp, err +} + +func (client *Client) AttachNetworkInterface(args *AttachNetworkInterfaceArgs) error { + resp := &AttachNetworkInterfaceResponse{} + err := client.Invoke("AttachNetworkInterface", args, resp) + return err +} + +func (client *Client) DetachNetworkInterface(args *DetachNetworkInterfaceArgs) (resp *DetachNetworkInterfaceResponse, err error) { + resp = &DetachNetworkInterfaceResponse{} + err = client.Invoke("DetachNetworkInterface", args, resp) + return resp, err +} + +func (client *Client) ModifyNetworkInterfaceAttribute(args *ModifyNetworkInterfaceAttributeArgs) (resp *ModifyNetworkInterfaceAttributeResponse, err error) { + resp = &ModifyNetworkInterfaceAttributeResponse{} + err = client.Invoke("ModifyNetworkInterfaceAttribute", args, resp) + return resp, err +} + +func (client *Client) UnassignPrivateIpAddresses(args *UnassignPrivateIpAddressesArgs) (resp *UnassignPrivateIpAddressesResponse, err error) { + resp = &UnassignPrivateIpAddressesResponse{} + err = client.Invoke("UnassignPrivateIpAddresses", args, resp) + return resp, err +} + +func (client *Client) AssignPrivateIpAddresses(args *AssignPrivateIpAddressesArgs) (resp *AssignPrivateIpAddressesResponse, err error) { + resp = &AssignPrivateIpAddressesResponse{} + err = client.Invoke("AssignPrivateIpAddresses", args, resp) + return resp, err +} + +// Default timeout value for WaitForInstance method +const NetworkInterfacesDefaultTimeout = 120 + +// WaitForInstance waits for instance to given status +func (client *Client) WaitForNetworkInterface(regionId common.Region, eniID string, status string, timeout int) error { + if timeout <= 0 { + timeout = NetworkInterfacesDefaultTimeout + } + for { + + eniIds := []string{eniID} + + describeNetworkInterfacesArgs := DescribeNetworkInterfacesArgs{ + RegionId: regionId, + NetworkInterfaceId: eniIds, + } + + nisResponse, err := client.DescribeNetworkInterfaces(&describeNetworkInterfacesArgs) + if err != nil { + return fmt.Errorf("Failed to describe network interface %v: %v", eniID, err) + } + + if len(nisResponse.NetworkInterfaceSets.NetworkInterfaceSet) > 0 && nisResponse.NetworkInterfaceSets.NetworkInterfaceSet[0].Status == status { + break + } + + timeout = timeout - DefaultWaitForInterval + if timeout <= 0 { + return fmt.Errorf("Timeout for waiting available status for network interfaces") + } + time.Sleep(DefaultWaitForInterval * time.Second) + + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/forward_entry.go b/vendor/github.com/denverdino/aliyungo/ecs/forward_entry.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/forward_entry.go rename to vendor/github.com/denverdino/aliyungo/ecs/forward_entry.go diff --git a/vendor/github.com/denverdino/aliyungo/ecs/images.go b/vendor/github.com/denverdino/aliyungo/ecs/images.go new file mode 100644 index 000000000000..e50297adcfd0 --- /dev/null +++ b/vendor/github.com/denverdino/aliyungo/ecs/images.go @@ -0,0 +1,347 @@ +package ecs + +import ( + "net/url" + "strconv" + "time" + + "github.com/denverdino/aliyungo/common" + "github.com/denverdino/aliyungo/util" +) + +// ImageOwnerAlias represents image owner +type ImageOwnerAlias string + +// Constants of image owner +const ( + ImageOwnerSystem = ImageOwnerAlias("system") + ImageOwnerSelf = ImageOwnerAlias("self") + ImageOwnerOthers = ImageOwnerAlias("others") + ImageOwnerMarketplace = ImageOwnerAlias("marketplace") + ImageOwnerDefault = ImageOwnerAlias("") //Return the values for system, self, and others +) + +type ImageStatus string + +const ( + ImageStatusAvailable = ImageStatus("Available") + ImageStatusUnAvailable = ImageStatus("UnAvailable") + ImageStatusCreating = ImageStatus("Creating") + ImageStatusCreateFailed = ImageStatus("CreateFailed") +) + +type ImageUsage string + +const ( + ImageUsageInstance = ImageUsage("instance") + ImageUsageNone = ImageUsage("none") +) + +type ImageFormatType string + +const ( + RAW = ImageFormatType("RAW") + VHD = ImageFormatType("VHD") +) + +// DescribeImagesArgs repsents arguments to describe images +type DescribeImagesArgs struct { + RegionId common.Region + ImageId string + SnapshotId string + ImageName string + Status ImageStatus + ImageOwnerAlias ImageOwnerAlias + common.Pagination +} + +type DescribeImagesResponse struct { + common.Response + common.PaginationResult + + RegionId common.Region + Images struct { + Image []ImageType + } +} + +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&diskdevicemapping +type DiskDeviceMapping struct { + SnapshotId string + //Why Size Field is string-type. + Size string + // Now the key Size change to DiskImageSize + DiskImageSize string + Device string + //For import images + Format string + OSSBucket string + OSSObject string +} + +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&imagetype +type ImageType struct { + ImageId string + ImageVersion string + Architecture string + ImageName string + Description string + Size int + ImageOwnerAlias string + OSName string + OSType string + Platform string + DiskDeviceMappings struct { + DiskDeviceMapping []DiskDeviceMapping + } + ProductCode string + IsSubscribed bool + IsSelfShared string + IsCopied bool + IsSupportIoOptimized bool + Progress string + Usage ImageUsage + Status ImageStatus + CreationTime util.ISO6801Time +} + +// DescribeImages describes images +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/image&describeimages +func (client *Client) DescribeImages(args *DescribeImagesArgs) (images []ImageType, pagination *common.PaginationResult, err error) { + response, err := client.DescribeImagesWithRaw(args) + if err != nil { + return nil, nil, err + } + return response.Images.Image, &response.PaginationResult, nil +} + +func (client *Client) DescribeImagesWithRaw(args *DescribeImagesArgs) (response *DescribeImagesResponse, err error) { + args.Validate() + response = &DescribeImagesResponse{} + err = client.Invoke("DescribeImages", args, response) + if err != nil { + return nil, err + } + return response, nil +} + +// CreateImageArgs repsents arguments to create image +type CreateImageArgs struct { + RegionId common.Region + SnapshotId string + InstanceId string + ImageName string + ImageVersion string + Description string + ClientToken string +} + +type CreateImageResponse struct { + common.Response + + ImageId string +} + +// CreateImage creates a new image +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/image&createimage +func (client *Client) CreateImage(args *CreateImageArgs) (imageId string, err error) { + response := &CreateImageResponse{} + err = client.Invoke("CreateImage", args, &response) + if err != nil { + return "", err + } + return response.ImageId, nil +} + +type DeleteImageArgs struct { + RegionId common.Region + ImageId string + Force bool +} + +type DeleteImageResponse struct { + common.Response +} + +// DeleteImage deletes Image +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/image&deleteimage +func (client *Client) DeleteImage(regionId common.Region, imageId string) error { + args := DeleteImageArgs{ + RegionId: regionId, + ImageId: imageId, + } + + response := &DeleteImageResponse{} + return client.Invoke("DeleteImage", &args, &response) +} + +// DeleteImage deletes Image +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/image&deleteimage +func (client *Client) DeleteImageWithForce(regionId common.Region, imageId string, force bool) error { + args := DeleteImageArgs{ + RegionId: regionId, + ImageId: imageId, + Force: force, + } + + response := &DeleteImageResponse{} + return client.Invoke("DeleteImage", &args, &response) +} + +// ModifyImageSharePermission repsents arguments to share image +type ModifyImageSharePermissionArgs struct { + RegionId common.Region + ImageId string + AddAccount []string + RemoveAccount []string +} + +// You can read doc at http://help.aliyun.com/document_detail/ecs/open-api/image/modifyimagesharepermission.html +func (client *Client) ModifyImageSharePermission(args *ModifyImageSharePermissionArgs) error { + req := url.Values{} + req.Add("RegionId", string(args.RegionId)) + req.Add("ImageId", args.ImageId) + + for i, item := range args.AddAccount { + req.Add("AddAccount."+strconv.Itoa(i+1), item) + } + for i, item := range args.RemoveAccount { + req.Add("RemoveAccount."+strconv.Itoa(i+1), item) + } + + return client.Invoke("ModifyImageSharePermission", req, &common.Response{}) +} + +type AccountType struct { + AliyunId string +} +type ImageSharePermissionResponse struct { + common.Response + ImageId string + RegionId string + Accounts struct { + Account []AccountType + } + TotalCount int + PageNumber int + PageSize int +} + +func (client *Client) DescribeImageSharePermission(args *ModifyImageSharePermissionArgs) (*ImageSharePermissionResponse, error) { + response := ImageSharePermissionResponse{} + err := client.Invoke("DescribeImageSharePermission", args, &response) + return &response, err +} + +type CopyImageArgs struct { + RegionId common.Region + ImageId string + DestinationRegionId common.Region + DestinationImageName string + DestinationDescription string + ClientToken string +} + +type CopyImageResponse struct { + common.Response + ImageId string +} + +// You can read doc at https://help.aliyun.com/document_detail/25538.html +func (client *Client) CopyImage(args *CopyImageArgs) (string, error) { + response := &CopyImageResponse{} + err := client.Invoke("CopyImage", args, &response) + if err != nil { + return "", err + } + return response.ImageId, nil +} + +// ImportImageArgs repsents arguments to import image from oss +type ImportImageArgs struct { + RegionId common.Region + ImageName string + ImageVersion string + Description string + ClientToken string + Architecture string + OSType string + Platform string + DiskDeviceMappings struct { + DiskDeviceMapping []DiskDeviceMapping + } +} + +func (client *Client) ImportImage(args *ImportImageArgs) (string, error) { + response := &CopyImageResponse{} + err := client.Invoke("ImportImage", args, &response) + if err != nil { + return "", err + } + return response.ImageId, nil +} + +type ImportImageResponse struct { + common.Response + RegionId common.Region + ImageId string + ImportTaskId string +} + +// Default timeout value for WaitForImageReady method +const ImageDefaultTimeout = 120 + +//Wait Image ready +func (client *Client) WaitForImageReady(regionId common.Region, imageId string, timeout int) error { + if timeout <= 0 { + timeout = ImageDefaultTimeout + } + for { + args := DescribeImagesArgs{ + RegionId: regionId, + ImageId: imageId, + Status: ImageStatusCreating, + } + + images, _, err := client.DescribeImages(&args) + if err != nil { + return err + } + if images == nil || len(images) == 0 { + args.Status = ImageStatusAvailable + images, _, er := client.DescribeImages(&args) + if er == nil && len(images) == 1 { + break + } else { + return common.GetClientErrorFromString("Not found") + } + } + if images[0].Progress == "100%" { + break + } + timeout = timeout - DefaultWaitForInterval + if timeout <= 0 { + return common.GetClientErrorFromString("Timeout") + } + time.Sleep(DefaultWaitForInterval * time.Second) + } + return nil +} + +type CancelCopyImageRequest struct { + regionId common.Region + ImageId string +} + +// You can read doc at https://help.aliyun.com/document_detail/25539.html +func (client *Client) CancelCopyImage(regionId common.Region, imageId string) error { + response := &common.Response{} + err := client.Invoke("CancelCopyImage", &CancelCopyImageRequest{regionId, imageId}, &response) + return err +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/instance_types.go b/vendor/github.com/denverdino/aliyungo/ecs/instance_types.go similarity index 81% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/instance_types.go rename to vendor/github.com/denverdino/aliyungo/ecs/instance_types.go index a133806f1c35..d26b5666a39d 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/instance_types.go +++ b/vendor/github.com/denverdino/aliyungo/ecs/instance_types.go @@ -9,10 +9,19 @@ type DescribeInstanceTypesArgs struct { // // You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&instancetypeitemtype type InstanceTypeItemType struct { - InstanceTypeId string - CpuCoreCount int - MemorySize float64 - InstanceTypeFamily string + InstanceTypeId string + CpuCoreCount int + MemorySize float64 + InstanceTypeFamily string + GPUAmount int + GPUSpec string + InitialCredit int + BaselineCredit int + EniQuantity int + EniPrivateIpAddressQuantity int + LocalStorageCapacity int + LocalStorageAmount int + LocalStorageCategory string } type DescribeInstanceTypesResponse struct { diff --git a/vendor/github.com/denverdino/aliyungo/ecs/instances.go b/vendor/github.com/denverdino/aliyungo/ecs/instances.go new file mode 100644 index 000000000000..dd424f96b703 --- /dev/null +++ b/vendor/github.com/denverdino/aliyungo/ecs/instances.go @@ -0,0 +1,832 @@ +package ecs + +import ( + "encoding/base64" + "encoding/json" + "strconv" + "time" + + "github.com/denverdino/aliyungo/common" + "github.com/denverdino/aliyungo/util" +) + +// InstanceStatus represents instance status +type InstanceStatus string + +// Constants of InstanceStatus +const ( + Creating = InstanceStatus("Creating") // For backward compatibility + Pending = InstanceStatus("Pending") + Running = InstanceStatus("Running") + Starting = InstanceStatus("Starting") + + Stopped = InstanceStatus("Stopped") + Stopping = InstanceStatus("Stopping") + Deleted = InstanceStatus("Deleted") +) + +type LockReason string + +const ( + LockReasonFinancial = LockReason("financial") + LockReasonSecurity = LockReason("security") +) + +type LockReasonType struct { + LockReason LockReason +} + +type DescribeUserdataArgs struct { + RegionId common.Region + InstanceId string +} + +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&instancestatusitemtype +type DescribeUserdataItemType struct { + UserData string + InstanceId string + RegionId string +} + +type DescribeUserdataResponse struct { + common.Response + DescribeUserdataItemType +} + +// DescribeInstanceStatus describes instance status +// +// You can read doc at https://intl.aliyun.com/help/doc-detail/49227.htm +func (client *Client) DescribeUserdata(args *DescribeUserdataArgs) (userData *DescribeUserdataItemType, err error) { + response := DescribeUserdataResponse{} + + err = client.Invoke("DescribeUserdata", args, &response) + + if err == nil { + return &response.DescribeUserdataItemType, nil + } + + return nil, err +} + +type DescribeInstanceStatusArgs struct { + RegionId common.Region + ZoneId string + common.Pagination +} + +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&instancestatusitemtype +type InstanceStatusItemType struct { + InstanceId string + Status InstanceStatus +} + +type DescribeInstanceStatusResponse struct { + common.Response + common.PaginationResult + InstanceStatuses struct { + InstanceStatus []InstanceStatusItemType + } +} + +// DescribeInstanceStatus describes instance status +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/instance&describeinstancestatus +func (client *Client) DescribeInstanceStatus(args *DescribeInstanceStatusArgs) (instanceStatuses []InstanceStatusItemType, pagination *common.PaginationResult, err error) { + response, err := client.DescribeInstanceStatusWithRaw(args) + + if err == nil { + return response.InstanceStatuses.InstanceStatus, &response.PaginationResult, nil + } + + return nil, nil, err +} + +func (client *Client) DescribeInstanceStatusWithRaw(args *DescribeInstanceStatusArgs) (response *DescribeInstanceStatusResponse, err error) { + args.Validate() + response = &DescribeInstanceStatusResponse{} + + err = client.Invoke("DescribeInstanceStatus", args, response) + if err != nil { + return nil, err + } + + return response, nil +} + +type StopInstanceArgs struct { + InstanceId string + ForceStop bool +} + +type StopInstanceResponse struct { + common.Response +} + +// StopInstance stops instance +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/instance&stopinstance +func (client *Client) StopInstance(instanceId string, forceStop bool) error { + args := StopInstanceArgs{ + InstanceId: instanceId, + ForceStop: forceStop, + } + response := StopInstanceResponse{} + err := client.Invoke("StopInstance", &args, &response) + return err +} + +type StartInstanceArgs struct { + InstanceId string +} + +type StartInstanceResponse struct { + common.Response +} + +// StartInstance starts instance +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/instance&startinstance +func (client *Client) StartInstance(instanceId string) error { + args := StartInstanceArgs{InstanceId: instanceId} + response := StartInstanceResponse{} + err := client.Invoke("StartInstance", &args, &response) + return err +} + +type RebootInstanceArgs struct { + InstanceId string + ForceStop bool +} + +type RebootInstanceResponse struct { + common.Response +} + +// RebootInstance reboot instance +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/instance&rebootinstance +func (client *Client) RebootInstance(instanceId string, forceStop bool) error { + request := RebootInstanceArgs{ + InstanceId: instanceId, + ForceStop: forceStop, + } + response := RebootInstanceResponse{} + err := client.Invoke("RebootInstance", &request, &response) + return err +} + +type DescribeInstanceAttributeArgs struct { + InstanceId string +} + +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&operationlockstype +type OperationLocksType struct { + LockReason []LockReasonType //enum for financial, security +} + +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&securitygroupidsettype +type SecurityGroupIdSetType struct { + SecurityGroupId string +} + +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&ipaddresssettype +type IpAddressSetType struct { + IpAddress []string +} + +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&vpcattributestype +type VpcAttributesType struct { + VpcId string + VSwitchId string + PrivateIpAddress IpAddressSetType + NatIpAddress string +} + +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&eipaddressassociatetype +type EipAddressAssociateType struct { + AllocationId string + IpAddress string + Bandwidth int + InternetChargeType common.InternetChargeType +} + +// Experimental feature +type SpotStrategyType string + +// Constants of SpotStrategyType +const ( + NoSpot = SpotStrategyType("NoSpot") + SpotWithPriceLimit = SpotStrategyType("SpotWithPriceLimit") + SpotAsPriceGo = SpotStrategyType("SpotAsPriceGo") +) + +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&instanceattributestype +type InstanceAttributesType struct { + InstanceId string + InstanceName string + Description string + ImageId string + RegionId common.Region + ZoneId string + CPU int + Memory int + ClusterId string + InstanceType string + InstanceTypeFamily string + HostName string + SerialNumber string + Status InstanceStatus + OperationLocks OperationLocksType + SecurityGroupIds struct { + SecurityGroupId []string + } + PublicIpAddress IpAddressSetType + InnerIpAddress IpAddressSetType + InstanceNetworkType string //enum Classic | Vpc + InternetMaxBandwidthIn int + InternetMaxBandwidthOut int + InternetChargeType common.InternetChargeType + CreationTime util.ISO6801Time //time.Time + VpcAttributes VpcAttributesType + EipAddress EipAddressAssociateType + IoOptimized StringOrBool + InstanceChargeType common.InstanceChargeType + ExpiredTime util.ISO6801Time + Tags struct { + Tag []TagItemType + } + SpotStrategy SpotStrategyType + SpotPriceLimit float64 + KeyPairName string +} + +type DescribeInstanceAttributeResponse struct { + common.Response + InstanceAttributesType +} + +// DescribeInstanceAttribute describes instance attribute +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/instance&describeinstanceattribute +func (client *Client) DescribeInstanceAttribute(instanceId string) (instance *InstanceAttributesType, err error) { + args := DescribeInstanceAttributeArgs{InstanceId: instanceId} + + response := DescribeInstanceAttributeResponse{} + err = client.Invoke("DescribeInstanceAttribute", &args, &response) + if err != nil { + return nil, err + } + return &response.InstanceAttributesType, err +} + +type ModifyInstanceAttributeArgs struct { + InstanceId string + InstanceName string + Description string + Password string + HostName string + UserData string +} + +type ModifyInstanceAttributeResponse struct { + common.Response +} + +//ModifyInstanceAttribute modify instance attrbute +// +// You can read doc at https://help.aliyun.com/document_detail/ecs/open-api/instance/modifyinstanceattribute.html +func (client *Client) ModifyInstanceAttribute(args *ModifyInstanceAttributeArgs) error { + response := ModifyInstanceAttributeResponse{} + err := client.Invoke("ModifyInstanceAttribute", args, &response) + return err +} + +// Default timeout value for WaitForInstance method +const InstanceDefaultTimeout = 120 + +// WaitForInstance waits for instance to given status +func (client *Client) WaitForInstance(instanceId string, status InstanceStatus, timeout int) error { + if timeout <= 0 { + timeout = InstanceDefaultTimeout + } + for { + instance, err := client.DescribeInstanceAttribute(instanceId) + if err != nil { + return err + } + if instance.Status == status { + //TODO + //Sleep one more time for timing issues + time.Sleep(DefaultWaitForInterval * time.Second) + break + } + timeout = timeout - DefaultWaitForInterval + if timeout <= 0 { + return common.GetClientErrorFromString("Timeout") + } + time.Sleep(DefaultWaitForInterval * time.Second) + + } + return nil +} + +// WaitForInstance waits for instance to given status +// when instance.NotFound wait until timeout +func (client *Client) WaitForInstanceAsyn(instanceId string, status InstanceStatus, timeout int) error { + if timeout <= 0 { + timeout = InstanceDefaultTimeout + } + for { + instance, err := client.DescribeInstanceAttribute(instanceId) + if err != nil { + e, _ := err.(*common.Error) + if e.Code != "InvalidInstanceId.NotFound" && e.Code != "Forbidden.InstanceNotFound" { + return err + } + } else if instance != nil && instance.Status == status { + //TODO + break + } + timeout = timeout - DefaultWaitForInterval + if timeout <= 0 { + return common.GetClientErrorFromString("Timeout") + } + time.Sleep(DefaultWaitForInterval * time.Second) + + } + return nil +} + +type DescribeInstanceVncUrlArgs struct { + RegionId common.Region + InstanceId string +} + +type DescribeInstanceVncUrlResponse struct { + common.Response + VncUrl string +} + +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/instance&describeinstancevncurl +func (client *Client) DescribeInstanceVncUrl(args *DescribeInstanceVncUrlArgs) (string, error) { + response := DescribeInstanceVncUrlResponse{} + + err := client.Invoke("DescribeInstanceVncUrl", args, &response) + + if err == nil { + return response.VncUrl, nil + } + + return "", err +} + +type DescribeInstancesArgs struct { + RegionId common.Region + VpcId string + VSwitchId string + ZoneId string + InstanceIds string + InstanceNetworkType string + InstanceName string + Status InstanceStatus + PrivateIpAddresses string + InnerIpAddresses string + PublicIpAddresses string + SecurityGroupId string + Tag map[string]string + InstanceType string + SpotStrategy SpotStrategyType + common.Pagination +} + +type DescribeInstancesResponse struct { + common.Response + common.PaginationResult + Instances struct { + Instance []InstanceAttributesType + } +} + +// DescribeInstances describes instances +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/instance&describeinstances +func (client *Client) DescribeInstances(args *DescribeInstancesArgs) (instances []InstanceAttributesType, pagination *common.PaginationResult, err error) { + response, err := client.DescribeInstancesWithRaw(args) + if err != nil { + return nil, nil, err + } + + return response.Instances.Instance, &response.PaginationResult, nil +} + +func (client *Client) DescribeInstancesWithRaw(args *DescribeInstancesArgs) (response *DescribeInstancesResponse, err error) { + args.Validate() + response = &DescribeInstancesResponse{} + + err = client.Invoke("DescribeInstances", args, &response) + if err != nil { + return nil, err + } + + return response, nil +} + +type ModifyInstanceAutoReleaseTimeArgs struct { + InstanceId string + AutoReleaseTime string +} + +type ModifyInstanceAutoReleaseTimeResponse struct { + common.Response +} + +// 对给定的实例设定自动释放时间。 +// +// You can read doc at https://help.aliyun.com/document_detail/47576.html +func (client *Client) ModifyInstanceAutoReleaseTime(instanceId, time string) error { + args := ModifyInstanceAutoReleaseTimeArgs{ + InstanceId: instanceId, + AutoReleaseTime: time, + } + response := ModifyInstanceAutoReleaseTimeResponse{} + err := client.Invoke("ModifyInstanceAutoReleaseTime", &args, &response) + return err +} + +type DeleteInstanceArgs struct { + InstanceId string +} + +type DeleteInstanceResponse struct { + common.Response +} + +// DeleteInstance deletes instance +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/instance&deleteinstance +func (client *Client) DeleteInstance(instanceId string) error { + args := DeleteInstanceArgs{InstanceId: instanceId} + response := DeleteInstanceResponse{} + err := client.Invoke("DeleteInstance", &args, &response) + return err +} + +type DataDiskType struct { + Size int + Category DiskCategory //Enum cloud, ephemeral, ephemeral_ssd + SnapshotId string + DiskName string + Description string + Device string + DeleteWithInstance bool +} + +type SystemDiskType struct { + Size int + Category DiskCategory //Enum cloud, ephemeral, ephemeral_ssd + DiskName string + Description string +} + +type IoOptimized string + +type StringOrBool struct { + Value bool +} + +// UnmarshalJSON implements the json.Unmarshaller interface. +func (io *StringOrBool) UnmarshalJSON(value []byte) error { + if value[0] == '"' { + var str string + err := json.Unmarshal(value, &str) + if err == nil { + io.Value = (str == "true" || str == "optimized") + } + return err + } + var boolVal bool + err := json.Unmarshal(value, &boolVal) + if err == nil { + io.Value = boolVal + } + return err +} + +func (io StringOrBool) Bool() bool { + return io.Value +} + +func (io StringOrBool) String() string { + return strconv.FormatBool(io.Value) +} + +var ( + IoOptimizedNone = IoOptimized("none") + IoOptimizedOptimized = IoOptimized("optimized") +) + +type SecurityEnhancementStrategy string + +var ( + InactiveSecurityEnhancementStrategy = SecurityEnhancementStrategy("Active") + DeactiveSecurityEnhancementStrategy = SecurityEnhancementStrategy("Deactive") +) + +type CreateInstanceArgs struct { + RegionId common.Region + ZoneId string + ImageId string + InstanceType string + SecurityGroupId string + InstanceName string + Description string + InternetChargeType common.InternetChargeType + InternetMaxBandwidthIn int + InternetMaxBandwidthOut int + HostName string + Password string + IoOptimized IoOptimized + SystemDisk SystemDiskType + DataDisk []DataDiskType + VSwitchId string + PrivateIpAddress string + ClientToken string + InstanceChargeType common.InstanceChargeType + Period int + PeriodUnit common.TimeType + UserData string + AutoRenew bool + AutoRenewPeriod int + SpotStrategy SpotStrategyType + SpotPriceLimit float64 + KeyPairName string + RamRoleName string + SecurityEnhancementStrategy SecurityEnhancementStrategy +} + +type CreateInstanceResponse struct { + common.Response + InstanceId string +} + +// CreateInstance creates instance +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/instance&createinstance +func (client *Client) CreateInstance(args *CreateInstanceArgs) (instanceId string, err error) { + if args.UserData != "" { + // Encode to base64 string + args.UserData = base64.StdEncoding.EncodeToString([]byte(args.UserData)) + } + response := CreateInstanceResponse{} + err = client.Invoke("CreateInstance", args, &response) + if err != nil { + return "", err + } + return response.InstanceId, err +} + +type RunInstanceArgs struct { + CreateInstanceArgs + MinAmount int + MaxAmount int + AutoReleaseTime string + NetworkType string + InnerIpAddress string + BusinessInfo string +} + +type RunInstanceResponse struct { + common.Response + InstanceIdSets InstanceIdSets +} + +type InstanceIdSets struct { + InstanceIdSet []string +} + +type BusinessInfo struct { + Pack string `json:"pack,omitempty"` + ActivityId string `json:"activityId,omitempty"` +} + +func (client *Client) RunInstances(args *RunInstanceArgs) (instanceIdSet []string, err error) { + if args.UserData != "" { + // Encode to base64 string + args.UserData = base64.StdEncoding.EncodeToString([]byte(args.UserData)) + } + response := RunInstanceResponse{} + err = client.Invoke("RunInstances", args, &response) + if err != nil { + return nil, err + } + return response.InstanceIdSets.InstanceIdSet, err +} + +type SecurityGroupArgs struct { + InstanceId string + SecurityGroupId string +} + +type SecurityGroupResponse struct { + common.Response +} + +//JoinSecurityGroup +// +//You can read doc at https://help.aliyun.com/document_detail/ecs/open-api/instance/joinsecuritygroup.html +func (client *Client) JoinSecurityGroup(instanceId string, securityGroupId string) error { + args := SecurityGroupArgs{InstanceId: instanceId, SecurityGroupId: securityGroupId} + response := SecurityGroupResponse{} + err := client.Invoke("JoinSecurityGroup", &args, &response) + return err +} + +//LeaveSecurityGroup +// +//You can read doc at https://help.aliyun.com/document_detail/ecs/open-api/instance/leavesecuritygroup.html +func (client *Client) LeaveSecurityGroup(instanceId string, securityGroupId string) error { + args := SecurityGroupArgs{InstanceId: instanceId, SecurityGroupId: securityGroupId} + response := SecurityGroupResponse{} + err := client.Invoke("LeaveSecurityGroup", &args, &response) + return err +} + +type AttachInstancesArgs struct { + RegionId common.Region + RamRoleName string + InstanceIds string +} + +// AttachInstanceRamRole attach instances to ram role +// +// You can read doc at https://help.aliyun.com/document_detail/54244.html?spm=5176.doc54245.6.811.zEJcS5 +func (client *Client) AttachInstanceRamRole(args *AttachInstancesArgs) (err error) { + response := common.Response{} + err = client.Invoke("AttachInstanceRamRole", args, &response) + if err != nil { + return err + } + return nil +} + +// DetachInstanceRamRole detach instances from ram role +// +// You can read doc at https://help.aliyun.com/document_detail/54245.html?spm=5176.doc54243.6.813.bt8RB3 +func (client *Client) DetachInstanceRamRole(args *AttachInstancesArgs) (err error) { + response := common.Response{} + err = client.Invoke("DetachInstanceRamRole", args, &response) + if err != nil { + return err + } + return nil +} + +type DescribeInstanceRamRoleResponse struct { + common.Response + InstanceRamRoleSets struct { + InstanceRamRoleSet []InstanceRamRoleSetType + } +} + +type InstanceRamRoleSetType struct { + InstanceId string + RamRoleName string +} + +// DescribeInstanceRamRole +// +// You can read doc at https://help.aliyun.com/document_detail/54243.html?spm=5176.doc54245.6.812.RgNCoi +func (client *Client) DescribeInstanceRamRole(args *AttachInstancesArgs) (resp *DescribeInstanceRamRoleResponse, err error) { + response := &DescribeInstanceRamRoleResponse{} + err = client.Invoke("DescribeInstanceRamRole", args, response) + if err != nil { + return response, err + } + return response, nil +} + +type ModifyInstanceSpecArgs struct { + InstanceId string + InstanceType string + InternetMaxBandwidthOut *int + InternetMaxBandwidthIn *int + ClientToken string +} + +type ModifyInstanceSpecResponse struct { + common.Response +} + +//ModifyInstanceSpec modify instance specification +// +// Notice: 1. An instance that was successfully modified once cannot be modified again within 5 minutes. +// 2. The API only can be used Pay-As-You-Go (PostPaid) instance +// +// You can read doc at https://www.alibabacloud.com/help/doc-detail/57633.htm +func (client *Client) ModifyInstanceSpec(args *ModifyInstanceSpecArgs) error { + response := ModifyInstanceSpecResponse{} + return client.Invoke("ModifyInstanceSpec", args, &response) +} + +type ModifyInstanceVpcAttributeArgs struct { + InstanceId string + VSwitchId string + PrivateIpAddress string +} + +type ModifyInstanceVpcAttributeResponse struct { + common.Response +} + +//ModifyInstanceVpcAttribute modify instance vswitchID and private ip address +// +// You can read doc at https://www.alibabacloud.com/help/doc-detail/25504.htm +func (client *Client) ModifyInstanceVpcAttribute(args *ModifyInstanceVpcAttributeArgs) error { + response := ModifyInstanceVpcAttributeResponse{} + return client.Invoke("ModifyInstanceVpcAttribute", args, &response) +} + +type ModifyInstanceChargeTypeArgs struct { + InstanceIds string + RegionId common.Region + Period int + PeriodUnit common.TimeType + IncludeDataDisks bool + DryRun bool + AutoPay bool + ClientToken string +} + +type ModifyInstanceChargeTypeResponse struct { + common.Response + Order string +} + +//ModifyInstanceChargeType modify instance charge type +// +// You can read doc at https://www.alibabacloud.com/help/doc-detail/25504.htm +func (client *Client) ModifyInstanceChargeType(args *ModifyInstanceChargeTypeArgs) (*ModifyInstanceChargeTypeResponse, error) { + response := &ModifyInstanceChargeTypeResponse{} + if err := client.Invoke("ModifyInstanceChargeType", args, response); err != nil { + return response, err + } + return response, nil +} + +type RenewalStatus string + +const ( + RenewAutoRenewal = RenewalStatus("AutoRenewal") + RenewNormal = RenewalStatus("Normal") + RenewNotRenewal = RenewalStatus("NotRenewal") +) + +type ModifyInstanceAutoRenewAttributeArgs struct { + InstanceId string + RegionId common.Region + Duration int + AutoRenew bool + RenewalStatus RenewalStatus +} + +// You can read doc at https://www.alibabacloud.com/help/doc-detail/52843.htm +func (client *Client) ModifyInstanceAutoRenewAttribute(args *ModifyInstanceAutoRenewAttributeArgs) error { + response := &common.Response{} + return client.Invoke("ModifyInstanceAutoRenewAttribute", args, response) +} + +type DescribeInstanceAutoRenewAttributeArgs struct { + InstanceId string + RegionId common.Region +} + +type InstanceRenewAttribute struct { + InstanceId string + Duration int + AutoRenewEnabled bool + PeriodUnit string + RenewalStatus RenewalStatus +} + +type DescribeInstanceAutoRenewAttributeResponse struct { + common.Response + InstanceRenewAttributes struct { + InstanceRenewAttribute []InstanceRenewAttribute + } +} + +// You can read doc at https://www.alibabacloud.com/help/doc-detail/52844.htm +func (client *Client) DescribeInstanceAutoRenewAttribute(args *DescribeInstanceAutoRenewAttributeArgs) (*DescribeInstanceAutoRenewAttributeResponse, error) { + response := &DescribeInstanceAutoRenewAttributeResponse{} + err := client.Invoke("DescribeInstanceAutoRenewAttribute", args, response) + return response, err +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/monitoring.go b/vendor/github.com/denverdino/aliyungo/ecs/monitoring.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/monitoring.go rename to vendor/github.com/denverdino/aliyungo/ecs/monitoring.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/nat_gateway.go b/vendor/github.com/denverdino/aliyungo/ecs/nat_gateway.go similarity index 93% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/nat_gateway.go rename to vendor/github.com/denverdino/aliyungo/ecs/nat_gateway.go index 10e00638e0f2..d104cf885f27 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/nat_gateway.go +++ b/vendor/github.com/denverdino/aliyungo/ecs/nat_gateway.go @@ -28,6 +28,16 @@ type SnatTableIdType struct { SnatTableId []string } +type IpListsType struct { + IpList []IpListItem +} + +type IpListItem struct { + IpAddress string + AllocationId string + UsingStatus string +} + type BandwidthPackageIdType struct { BandwidthPackageId []string } @@ -57,6 +67,7 @@ type NatGatewaySetType struct { BandwidthPackageIds BandwidthPackageIdType ForwardTableIds ForwardTableIdType SnatTableIds SnatTableIdType + IpLists IpListsType InstanceChargeType string Name string NatGatewayId string @@ -147,7 +158,8 @@ func (client *Client) DeleteNatGateway(args *DeleteNatGatewayArgs) error { } type DescribeBandwidthPackagesArgs struct { - RegionId common.Region + RegionId common.Region + common.Pagination BandwidthPackageId string NatGatewayId string } @@ -170,12 +182,13 @@ type DescribeBandwidthPackageType struct { type DescribeBandwidthPackagesResponse struct { common.Response + common.PaginationResult BandwidthPackages struct { BandwidthPackage []DescribeBandwidthPackageType } } -func (client *Client) DescribeBandwidthPackages(args *DescribeBandwidthPackagesArgs) ([]DescribeBandwidthPackageType, error) { +func (client *Client) DescribeBandwidthPackages(args *DescribeBandwidthPackagesArgs) (*DescribeBandwidthPackagesResponse, error) { response := &DescribeBandwidthPackagesResponse{} err := client.Invoke("DescribeBandwidthPackages", args, response) @@ -183,7 +196,7 @@ func (client *Client) DescribeBandwidthPackages(args *DescribeBandwidthPackagesA return nil, err } - return response.BandwidthPackages.BandwidthPackage, err + return response, err } type DeleteBandwidthPackageArgs struct { diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/networks.go b/vendor/github.com/denverdino/aliyungo/ecs/networks.go similarity index 80% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/networks.go rename to vendor/github.com/denverdino/aliyungo/ecs/networks.go index 4c4cd7150de4..eb6b0edaf96d 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/networks.go +++ b/vendor/github.com/denverdino/aliyungo/ecs/networks.go @@ -36,8 +36,9 @@ func (client *Client) AllocatePublicIpAddress(instanceId string) (ipAddress stri type ModifyInstanceNetworkSpec struct { InstanceId string - InternetMaxBandwidthOut int - InternetMaxBandwidthIn int + InternetMaxBandwidthOut *int + InternetMaxBandwidthIn *int + NetworkChargeType common.InternetChargeType } type ModifyInstanceNetworkSpecResponse struct { @@ -57,6 +58,7 @@ type AllocateEipAddressArgs struct { RegionId common.Region Bandwidth int InternetChargeType common.InternetChargeType + ISP string ClientToken string } @@ -81,9 +83,19 @@ func (client *Client) AllocateEipAddress(args *AllocateEipAddressArgs) (EipAddre return response.EipAddress, response.AllocationId, nil } +type EipInstanceType string + +const ( + EcsInstance = "EcsInstance" + SlbInstance = "SlbInstance" + Nat = "Nat" + HaVip = "HaVip" +) + type AssociateEipAddressArgs struct { AllocationId string InstanceId string + InstanceType EipInstanceType } type AssociateEipAddressResponse struct { @@ -102,6 +114,11 @@ func (client *Client) AssociateEipAddress(allocationId string, instanceId string return client.Invoke("AssociateEipAddress", &args, &response) } +func (client *Client) NewAssociateEipAddress(args *AssociateEipAddressArgs) error { + response := ModifyInstanceNetworkSpecResponse{} + return client.Invoke("AssociateEipAddress", args, &response) +} + // Status of disks type EipStatus string @@ -112,11 +129,22 @@ const ( EipStatusAvailable = EipStatus("Available") ) +type AssociatedInstanceType string + +const ( + AssociatedInstanceTypeEcsInstance = AssociatedInstanceType("EcsInstance") + AssociatedInstanceTypeSlbInstance = AssociatedInstanceType("SlbInstance") + AssociatedInstanceTypeNat = AssociatedInstanceType("Nat") + AssociatedInstanceTypeHaVip = AssociatedInstanceType("HaVip") +) + type DescribeEipAddressesArgs struct { - RegionId common.Region - Status EipStatus //enum Associating | Unassociating | InUse | Available - EipAddress string - AllocationId string + RegionId common.Region + Status EipStatus //enum Associating | Unassociating | InUse | Available + EipAddress string + AllocationId string + AssociatedInstanceType AssociatedInstanceType //enum EcsInstance | SlbInstance | Nat | HaVip + AssociatedInstanceId string //绑定的资æºçš„Id。 这是一个过滤器性质的å‚数,若ä¸æŒ‡å®šï¼Œåˆ™è¡¨ç¤ºä¸é€‚用该æ¡ä»¶å¯¹ç»“果进行过滤。 如果è¦ä½¿ç”¨è¯¥è¿‡æ»¤å™¨ï¼Œå¿…é¡»åŒæ—¶ä½¿ç”¨AssociatedInstanceType。若InstanceType为EcsInstance,则此处填写ECS实例Id。若InstanceType为SlbInstance,则此处填写VPC类型的ç§ç½‘SLB 的实例ID。若InstanceType为Nat,则此处填写NAT 的实例ID。。若InstanceType为HaVip,则此处填写HaVipId。 common.Pagination } @@ -128,6 +156,7 @@ type EipAddressSetType struct { AllocationId string Status EipStatus InstanceId string + InstanceType string Bandwidth string // Why string InternetChargeType common.InternetChargeType OperationLocks OperationLocksType diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/regions.go b/vendor/github.com/denverdino/aliyungo/ecs/regions.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/regions.go rename to vendor/github.com/denverdino/aliyungo/ecs/regions.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/route_tables.go b/vendor/github.com/denverdino/aliyungo/ecs/route_tables.go similarity index 97% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/route_tables.go rename to vendor/github.com/denverdino/aliyungo/ecs/route_tables.go index f8531a20b321..15d7c7b7d781 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/route_tables.go +++ b/vendor/github.com/denverdino/aliyungo/ecs/route_tables.go @@ -100,8 +100,8 @@ func (client *Client) DescribeRouteTablesWithRaw(args *DescribeRouteTablesArgs) type NextHopType string const ( - NextHopIntance = NextHopType("Instance") //Default - NextHopTunnel = NextHopType("Tunnel") + NextHopIntance = NextHopType("Instance") //Default + NextHopTunnel = NextHopType("Tunnel") NextHopTunnelRouterInterface = NextHopType("RouterInterface") ) diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/router_interface.go b/vendor/github.com/denverdino/aliyungo/ecs/router_interface.go similarity index 87% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/router_interface.go rename to vendor/github.com/denverdino/aliyungo/ecs/router_interface.go index 62af67860236..188bac89a5ba 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/router_interface.go +++ b/vendor/github.com/denverdino/aliyungo/ecs/router_interface.go @@ -1,6 +1,8 @@ package ecs import ( + "time" + "github.com/denverdino/aliyungo/common" ) @@ -19,6 +21,8 @@ const ( Idl = InterfaceStatus("Idl") Active = InterfaceStatus("Active") Inactive = InterfaceStatus("Inactive") + // 'Idle' means the router interface is not connected. 'Idl' may be a incorrect status. + Idle = InterfaceStatus("Idle") InitiatingSide = Role("InitiatingSide") AcceptingSide = Role("AcceptingSide") @@ -77,7 +81,7 @@ type Filter struct { type DescribeRouterInterfacesArgs struct { RegionId common.Region common.Pagination - Filter []Filter + Filter []Filter } type RouterInterfaceItemType struct { @@ -225,3 +229,29 @@ func (client *Client) DeleteRouterInterface(args *OperateRouterInterfaceArgs) (r } return response, nil } + +// WaitForRouterInterface waits for router interface to given status +func (client *Client) WaitForRouterInterfaceAsyn(regionId common.Region, interfaceId string, status InterfaceStatus, timeout int) error { + if timeout <= 0 { + timeout = InstanceDefaultTimeout + } + for { + interfaces, err := client.DescribeRouterInterfaces(&DescribeRouterInterfacesArgs{ + RegionId: regionId, + Filter: []Filter{Filter{Key: "RouterInterfaceId", Value: []string{interfaceId}}}, + }) + if err != nil { + return err + } else if interfaces != nil && InterfaceStatus(interfaces.RouterInterfaceSet.RouterInterfaceType[0].Status) == status { + //TODO + break + } + timeout = timeout - DefaultWaitForInterval + if timeout <= 0 { + return common.GetClientErrorFromString("Timeout") + } + time.Sleep(DefaultWaitForInterval * time.Second) + + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/security_groups.go b/vendor/github.com/denverdino/aliyungo/ecs/security_groups.go similarity index 89% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/security_groups.go rename to vendor/github.com/denverdino/aliyungo/ecs/security_groups.go index 54af3a798249..dbe854349d03 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/security_groups.go +++ b/vendor/github.com/denverdino/aliyungo/ecs/security_groups.go @@ -6,10 +6,15 @@ import ( ) type NicType string +type Direction string const ( NicTypeInternet = NicType("internet") NicTypeIntranet = NicType("intranet") + + DirectionIngress = Direction("ingress") + DirectionEgress = Direction("egress") + DirectionAll = Direction("all") ) type IpProtocol string @@ -29,11 +34,18 @@ const ( PermissionPolicyDrop = PermissionPolicy("drop") ) +type GroupInnerAccessPolicy string + +const ( + GroupInnerAccept = GroupInnerAccessPolicy("Accept") + GroupInnerDrop = GroupInnerAccessPolicy("Drop") +) + type DescribeSecurityGroupAttributeArgs struct { SecurityGroupId string RegionId common.Region - NicType NicType //enum for internet (default) |intranet - Direction string // enum ingress egress + NicType NicType //enum for internet (default) |intranet + Direction Direction // enum ingress egress } // @@ -64,7 +76,8 @@ type DescribeSecurityGroupAttributeResponse struct { Permissions struct { Permission []PermissionType } - VpcId string + VpcId string + InnerAccessPolicy GroupInnerAccessPolicy } // @@ -197,6 +210,21 @@ func (client *Client) ModifySecurityGroupAttribute(args *ModifySecurityGroupAttr return err } +type ModifySecurityGroupPolicyArgs struct { + RegionId common.Region + SecurityGroupId string + InnerAccessPolicy GroupInnerAccessPolicy +} + +// ModifySecurityGroupPolicy modifies inner access policy of security group +// +// You can read doc at https://www.alibabacloud.com/help/doc-detail/57315.htm +func (client *Client) ModifySecurityGroupPolicy(args *ModifySecurityGroupPolicyArgs) error { + response := common.Response{} + err := client.Invoke("ModifySecurityGroupPolicy", args, &response) + return err +} + type AuthorizeSecurityGroupArgs struct { SecurityGroupId string RegionId common.Region diff --git a/vendor/github.com/denverdino/aliyungo/ecs/snapshots.go b/vendor/github.com/denverdino/aliyungo/ecs/snapshots.go new file mode 100644 index 000000000000..0b7cbe87bf05 --- /dev/null +++ b/vendor/github.com/denverdino/aliyungo/ecs/snapshots.go @@ -0,0 +1,142 @@ +package ecs + +import ( + "time" + + "github.com/denverdino/aliyungo/common" + "github.com/denverdino/aliyungo/util" +) + +type DescribeSnapshotsArgs struct { + RegionId common.Region + InstanceId string + DiskId string + SnapshotIds []string //["s-xxxxxxxxx", "s-yyyyyyyyy", ..."s-zzzzzzzzz"] + common.Pagination +} + +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&snapshottype +type SnapshotType struct { + SnapshotId string + SnapshotName string + Description string + Progress string + SourceDiskId string + SourceDiskSize int + SourceDiskType string //enum for System | Data + ProductCode string + Status string + Usage string + CreationTime util.ISO6801Time +} + +type DescribeSnapshotsResponse struct { + common.Response + common.PaginationResult + Snapshots struct { + Snapshot []SnapshotType + } +} + +// DescribeSnapshots describe snapshots +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/snapshot&describesnapshots +func (client *Client) DescribeSnapshots(args *DescribeSnapshotsArgs) (snapshots []SnapshotType, pagination *common.PaginationResult, err error) { + response, err := client.DescribeSnapshotsWithRaw(args) + if err != nil { + return nil, nil, err + } + return response.Snapshots.Snapshot, &response.PaginationResult, nil + +} + +func (client *Client) DescribeSnapshotsWithRaw(args *DescribeSnapshotsArgs) (response *DescribeSnapshotsResponse, err error) { + args.Validate() + response = &DescribeSnapshotsResponse{} + + err = client.Invoke("DescribeSnapshots", args, response) + + if err != nil { + return nil, err + } + return response, nil + +} + +type DeleteSnapshotArgs struct { + SnapshotId string +} + +type DeleteSnapshotResponse struct { + common.Response +} + +// DeleteSnapshot deletes snapshot +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/snapshot&deletesnapshot +func (client *Client) DeleteSnapshot(snapshotId string) error { + args := DeleteSnapshotArgs{SnapshotId: snapshotId} + response := DeleteSnapshotResponse{} + + return client.Invoke("DeleteSnapshot", &args, &response) +} + +type CreateSnapshotArgs struct { + DiskId string + SnapshotName string + Description string + ClientToken string +} + +type CreateSnapshotResponse struct { + common.Response + SnapshotId string +} + +// CreateSnapshot creates a new snapshot +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/snapshot&createsnapshot +func (client *Client) CreateSnapshot(args *CreateSnapshotArgs) (snapshotId string, err error) { + + response := CreateSnapshotResponse{} + + err = client.Invoke("CreateSnapshot", args, &response) + if err == nil { + snapshotId = response.SnapshotId + } + return snapshotId, err +} + +// Default timeout value for WaitForSnapShotReady method +const SnapshotDefaultTimeout = 120 + +// WaitForSnapShotReady waits for snapshot ready +func (client *Client) WaitForSnapShotReady(regionId common.Region, snapshotId string, timeout int) error { + if timeout <= 0 { + timeout = SnapshotDefaultTimeout + } + for { + args := DescribeSnapshotsArgs{ + RegionId: regionId, + SnapshotIds: []string{snapshotId}, + } + + snapshots, _, err := client.DescribeSnapshots(&args) + if err != nil { + return err + } + if snapshots == nil || len(snapshots) == 0 { + return common.GetClientErrorFromString("Not found") + } + if snapshots[0].Progress == "100%" { + break + } + timeout = timeout - DefaultWaitForInterval + if timeout <= 0 { + return common.GetClientErrorFromString("Timeout") + } + time.Sleep(DefaultWaitForInterval * time.Second) + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/snat_entry.go b/vendor/github.com/denverdino/aliyungo/ecs/snat_entry.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/snat_entry.go rename to vendor/github.com/denverdino/aliyungo/ecs/snat_entry.go index d9806d769606..c2e20df85d02 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/snat_entry.go +++ b/vendor/github.com/denverdino/aliyungo/ecs/snat_entry.go @@ -78,7 +78,7 @@ func (client *Client) DescribeSnatTableEntries(args *DescribeSnatTableEntriesArg return response.SnatTableEntries.SnatTableEntry, &response.PaginationResult, nil } -func (client *Client) DescribeSnatTableEntriesWithRaw(args *DescribeSnatTableEntriesArgs) ( response *DescribeSnatTableEntriesResponse, err error) { +func (client *Client) DescribeSnatTableEntriesWithRaw(args *DescribeSnatTableEntriesArgs) (response *DescribeSnatTableEntriesResponse, err error) { args.Validate() response = &DescribeSnatTableEntriesResponse{} diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/ssh_key_pair.go b/vendor/github.com/denverdino/aliyungo/ecs/ssh_key_pair.go similarity index 94% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/ssh_key_pair.go rename to vendor/github.com/denverdino/aliyungo/ecs/ssh_key_pair.go index 76f1a3803488..9a0ad2e576a6 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/ssh_key_pair.go +++ b/vendor/github.com/denverdino/aliyungo/ecs/ssh_key_pair.go @@ -19,7 +19,7 @@ type CreateKeyPairResponse struct { // CreateKeyPair creates keypair // // You can read doc at https://help.aliyun.com/document_detail/51771.html?spm=5176.doc51775.6.910.cedjfr -func (client *Client) CreateKeyPair(args *CreateKeyPairArgs) (resp *CreateKeyPairResponse,err error) { +func (client *Client) CreateKeyPair(args *CreateKeyPairArgs) (resp *CreateKeyPairResponse, err error) { response := CreateKeyPairResponse{} err = client.Invoke("CreateKeyPair", args, &response) if err != nil { @@ -43,7 +43,7 @@ type ImportKeyPairResponse struct { // ImportKeyPair import keypair // // You can read doc at https://help.aliyun.com/document_detail/51774.html?spm=5176.doc51771.6.911.BicQq2 -func (client *Client) ImportKeyPair(args *ImportKeyPairArgs) (resp *ImportKeyPairResponse,err error) { +func (client *Client) ImportKeyPair(args *ImportKeyPairArgs) (resp *ImportKeyPairResponse, err error) { response := ImportKeyPairResponse{} err = client.Invoke("ImportKeyPair", args, &response) if err != nil { @@ -69,14 +69,14 @@ type DescribeKeyPairsResponse struct { common.PaginationResult RegionId common.Region KeyPairs struct { - KeyPair []KeyPairItemType + KeyPair []KeyPairItemType } } // DescribeKeyPairs describe keypairs // // You can read doc at https://help.aliyun.com/document_detail/51773.html?spm=5176.doc51774.6.912.lyE0iX -func (client *Client) DescribeKeyPairs(args *DescribeKeyPairsArgs) (KeyPairs []KeyPairItemType, pagination *common.PaginationResult, err error) { +func (client *Client) DescribeKeyPairs(args *DescribeKeyPairsArgs) (KeyPairs []KeyPairItemType, pagination *common.PaginationResult, err error) { response, err := client.DescribeKeyPairsWithRaw(args) if err != nil { return nil, nil, err @@ -149,5 +149,3 @@ func (client *Client) DeleteKeyPairs(args *DeleteKeyPairsArgs) (err error) { } return nil } - - diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/tags.go b/vendor/github.com/denverdino/aliyungo/ecs/tags.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/tags.go rename to vendor/github.com/denverdino/aliyungo/ecs/tags.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/vpcs.go b/vendor/github.com/denverdino/aliyungo/ecs/vpcs.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/vpcs.go rename to vendor/github.com/denverdino/aliyungo/ecs/vpcs.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/vrouters.go b/vendor/github.com/denverdino/aliyungo/ecs/vrouters.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/vrouters.go rename to vendor/github.com/denverdino/aliyungo/ecs/vrouters.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/vswitches.go b/vendor/github.com/denverdino/aliyungo/ecs/vswitches.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/ecs/vswitches.go rename to vendor/github.com/denverdino/aliyungo/ecs/vswitches.go diff --git a/vendor/github.com/denverdino/aliyungo/ecs/zones.go b/vendor/github.com/denverdino/aliyungo/ecs/zones.go new file mode 100644 index 000000000000..919e363a8652 --- /dev/null +++ b/vendor/github.com/denverdino/aliyungo/ecs/zones.go @@ -0,0 +1,158 @@ +package ecs + +import ( + "github.com/denverdino/aliyungo/common" +) + +type ResourceType string + +const ( + ResourceTypeInstance = ResourceType("Instance") + ResourceTypeDisk = ResourceType("Disk") + ResourceTypeVSwitch = ResourceType("VSwitch") + ResourceTypeIOOptimizedInstance = ResourceType("IoOptimized") +) + +// The sub-item of the type AvailableResourcesType +type SupportedResourceType string + +const ( + SupportedInstanceType = SupportedResourceType("supportedInstanceType") + SupportedInstanceTypeFamily = SupportedResourceType("supportedInstanceTypeFamily") + SupportedInstanceGeneration = SupportedResourceType("supportedInstanceGeneration") + SupportedSystemDiskCategory = SupportedResourceType("supportedSystemDiskCategory") + SupportedDataDiskCategory = SupportedResourceType("supportedDataDiskCategory") + SupportedNetworkCategory = SupportedResourceType("supportedNetworkCategory") +) + +// +// You can read doc at https://help.aliyun.com/document_detail/25670.html?spm=5176.doc25640.2.1.J24zQt +type ResourcesInfoType struct { + ResourcesInfo []AvailableResourcesType +} + +// Because the sub-item of AvailableResourcesType starts with supported and golang struct cann't refer them, this uses map to parse ResourcesInfo +type AvailableResourcesType struct { + IoOptimized bool + NetworkTypes map[SupportedResourceType][]string + InstanceGenerations map[SupportedResourceType][]string + InstanceTypeFamilies map[SupportedResourceType][]string + InstanceTypes map[SupportedResourceType][]string + SystemDiskCategories map[SupportedResourceType][]DiskCategory + DataDiskCategories map[SupportedResourceType][]DiskCategory +} + +type DescribeZonesArgs struct { + RegionId common.Region +} + +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&availableresourcecreationtype +type AvailableResourceCreationType struct { + ResourceTypes []ResourceType //enum for Instance, Disk, VSwitch +} + +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&availablediskcategoriestype +type AvailableDiskCategoriesType struct { + DiskCategories []DiskCategory //enum for cloud, ephemeral, ephemeral_ssd +} + +type AvailableInstanceTypesType struct { + InstanceTypes []string +} + +// +// You can read doc at http://docs.aliyun.com/#/pub/ecs/open-api/datatype&zonetype +type ZoneType struct { + ZoneId string + LocalName string + AvailableResources ResourcesInfoType + AvailableInstanceTypes AvailableInstanceTypesType + AvailableResourceCreation AvailableResourceCreationType + AvailableDiskCategories AvailableDiskCategoriesType +} + +type DescribeZonesResponse struct { + common.Response + Zones struct { + Zone []ZoneType + } +} + +// DescribeZones describes zones +func (client *Client) DescribeZones(regionId common.Region) (zones []ZoneType, err error) { + response, err := client.DescribeZonesWithRaw(regionId) + if err == nil { + return response.Zones.Zone, nil + } + + return []ZoneType{}, err +} + +func (client *Client) DescribeZonesWithRaw(regionId common.Region) (response *DescribeZonesResponse, err error) { + args := DescribeZonesArgs{ + RegionId: regionId, + } + response = &DescribeZonesResponse{} + + err = client.Invoke("DescribeZones", &args, response) + + if err == nil { + return response, nil + } + + return nil, err +} + +type DescribeAvailableResourceArgs struct { + RegionId string + DestinationResource string + ZoneId string + InstanceChargeType string + SpotStrategy string + IoOptimized string + InstanceType string + SystemDiskCategory string + DataDiskCategory string + NetworkCategory string +} + +type DescribeAvailableResourceResponse struct { + common.Response + AvailableZones struct { + AvailableZone []AvailableZoneType + } +} + +type AvailableZoneType struct { + RegionId string + ZoneId string + Status string + AvailableResources struct { + AvailableResource []NewAvailableResourcesType + } +} + +type NewAvailableResourcesType struct { + Type string + SupportedResources struct { + SupportedResource []SupportedResourcesType + } +} + +type SupportedResourcesType struct { + Value string + Status string + Min string + Max string + Unit string +} + +// https://www.alibabacloud.com/help/doc-detail/66186.htm +func (client *Client) DescribeAvailableResource(args *DescribeAvailableResourceArgs) (response *DescribeAvailableResourceResponse, err error) { + + response = &DescribeAvailableResourceResponse{} + err = client.Invoke("DescribeAvailableResource", args, response) + return response, err +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/util/attempt.go b/vendor/github.com/denverdino/aliyungo/util/attempt.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/util/attempt.go rename to vendor/github.com/denverdino/aliyungo/util/attempt.go diff --git a/vendor/github.com/denverdino/aliyungo/util/encoding.go b/vendor/github.com/denverdino/aliyungo/util/encoding.go new file mode 100644 index 000000000000..ec1a5b1372ec --- /dev/null +++ b/vendor/github.com/denverdino/aliyungo/util/encoding.go @@ -0,0 +1,331 @@ +package util + +import ( + "encoding/json" + "fmt" + "log" + "net/url" + "reflect" + "strconv" + "strings" + "time" +) + +// change instance=["a", "b"] +// to instance.1="a" instance.2="b" +func FlattenFn(fieldName string, field reflect.Value, values *url.Values) { + l := field.Len() + if l > 0 { + for i := 0; i < l; i++ { + str := field.Index(i).String() + values.Set(fieldName+"."+strconv.Itoa(i+1), str) + } + } +} + +func Underline2Dot(name string) string { + return strings.Replace(name, "_", ".", -1) +} + +//ConvertToQueryValues converts the struct to url.Values +func ConvertToQueryValues(ifc interface{}) url.Values { + values := url.Values{} + SetQueryValues(ifc, &values) + return values +} + +//SetQueryValues sets the struct to existing url.Values following ECS encoding rules +func SetQueryValues(ifc interface{}, values *url.Values) { + setQueryValues(ifc, values, "") +} + +func SetQueryValueByFlattenMethod(ifc interface{}, values *url.Values) { + setQueryValuesByFlattenMethod(ifc, values, "") +} + +func setQueryValues(i interface{}, values *url.Values, prefix string) { + // add to support url.Values + mapValues, ok := i.(url.Values) + if ok { + for k, _ := range mapValues { + values.Set(k, mapValues.Get(k)) + } + return + } + + elem := reflect.ValueOf(i) + if elem.Kind() == reflect.Ptr { + elem = elem.Elem() + } + elemType := elem.Type() + for i := 0; i < elem.NumField(); i++ { + + fieldName := elemType.Field(i).Name + anonymous := elemType.Field(i).Anonymous + tag := elemType.Field(i).Tag.Get("query") + argName := elemType.Field(i).Tag.Get("ArgName") + field := elem.Field(i) + // TODO Use Tag for validation + // tag := typ.Field(i).Tag.Get("tagname") + kind := field.Kind() + isPtr := false + if (kind == reflect.Ptr || kind == reflect.Array || kind == reflect.Slice || kind == reflect.Map || kind == reflect.Chan) && field.IsNil() { + continue + } + if kind == reflect.Ptr { + field = field.Elem() + kind = field.Kind() + isPtr = true + } + var value string + //switch field.Interface().(type) { + switch kind { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + i := field.Int() + if i != 0 || isPtr { + value = strconv.FormatInt(i, 10) + } + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + i := field.Uint() + if i != 0 || isPtr { + value = strconv.FormatUint(i, 10) + } + case reflect.Float32: + value = strconv.FormatFloat(field.Float(), 'f', 4, 32) + case reflect.Float64: + value = strconv.FormatFloat(field.Float(), 'f', 4, 64) + case reflect.Bool: + value = strconv.FormatBool(field.Bool()) + case reflect.String: + value = field.String() + case reflect.Map: + ifc := field.Interface() + m := ifc.(map[string]string) + if m != nil { + j := 0 + for k, v := range m { + j++ + keyName := fmt.Sprintf("%s.%d.Key", fieldName, j) + values.Set(keyName, k) + valueName := fmt.Sprintf("%s.%d.Value", fieldName, j) + values.Set(valueName, v) + } + } + case reflect.Slice: + switch field.Type().Elem().Kind() { + case reflect.Uint8: + value = string(field.Bytes()) + case reflect.String: + l := field.Len() + if l > 0 { + if tag == "list" { + name := argName + if argName == "" { + name = fieldName + } + for i := 0; i < l; i++ { + valueName := fmt.Sprintf("%s.%d", name, (i + 1)) + values.Set(valueName, field.Index(i).String()) + } + } else { + strArray := make([]string, l) + for i := 0; i < l; i++ { + strArray[i] = field.Index(i).String() + } + bytes, err := json.Marshal(strArray) + if err == nil { + value = string(bytes) + } else { + log.Printf("Failed to convert JSON: %v", err) + } + } + } + default: + l := field.Len() + for j := 0; j < l; j++ { + prefixName := fmt.Sprintf("%s.%d.", fieldName, (j + 1)) + ifc := field.Index(j).Interface() + //log.Printf("%s : %v", prefixName, ifc) + if ifc != nil { + setQueryValues(ifc, values, prefixName) + } + } + continue + } + + default: + switch field.Interface().(type) { + case ISO6801Time: + t := field.Interface().(ISO6801Time) + value = t.String() + case time.Time: + t := field.Interface().(time.Time) + value = GetISO8601TimeStamp(t) + default: + ifc := field.Interface() + if ifc != nil { + if anonymous { + SetQueryValues(ifc, values) + } else { + prefixName := fieldName + "." + setQueryValues(ifc, values, prefixName) + } + continue + } + } + } + if value != "" { + name := argName + if argName == "" { + name = fieldName + } + if prefix != "" { + name = prefix + name + } + values.Set(name, value) + } + } +} + +func setQueryValuesByFlattenMethod(i interface{}, values *url.Values, prefix string) { + // add to support url.Values + mapValues, ok := i.(url.Values) + if ok { + for k, _ := range mapValues { + values.Set(k, mapValues.Get(k)) + } + return + } + + elem := reflect.ValueOf(i) + if elem.Kind() == reflect.Ptr { + elem = elem.Elem() + } + elemType := elem.Type() + for i := 0; i < elem.NumField(); i++ { + + fieldName := elemType.Field(i).Name + anonymous := elemType.Field(i).Anonymous + field := elem.Field(i) + + // TODO Use Tag for validation + // tag := typ.Field(i).Tag.Get("tagname") + kind := field.Kind() + + isPtr := false + if (kind == reflect.Ptr || kind == reflect.Array || kind == reflect.Slice || kind == reflect.Map || kind == reflect.Chan) && field.IsNil() { + continue + } + if kind == reflect.Ptr { + field = field.Elem() + kind = field.Kind() + isPtr = true + } + + var value string + //switch field.Interface().(type) { + switch kind { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + i := field.Int() + if i != 0 || isPtr { + value = strconv.FormatInt(i, 10) + } + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + i := field.Uint() + if i != 0 || isPtr { + value = strconv.FormatUint(i, 10) + } + case reflect.Float32: + value = strconv.FormatFloat(field.Float(), 'f', 4, 32) + case reflect.Float64: + value = strconv.FormatFloat(field.Float(), 'f', 4, 64) + case reflect.Bool: + value = strconv.FormatBool(field.Bool()) + case reflect.String: + value = field.String() + case reflect.Map: + ifc := field.Interface() + m := ifc.(map[string]string) + if m != nil { + j := 0 + for k, v := range m { + j++ + keyName := fmt.Sprintf("%s.%d.Key", fieldName, j) + values.Set(keyName, k) + valueName := fmt.Sprintf("%s.%d.Value", fieldName, j) + values.Set(valueName, v) + } + } + case reflect.Slice: + if field.Type().Name() == "FlattenArray" { + FlattenFn(fieldName, field, values) + } else { + switch field.Type().Elem().Kind() { + case reflect.Uint8: + value = string(field.Bytes()) + case reflect.String: + l := field.Len() + if l > 0 { + strArray := make([]string, l) + for i := 0; i < l; i++ { + strArray[i] = field.Index(i).String() + } + bytes, err := json.Marshal(strArray) + if err == nil { + value = string(bytes) + } else { + log.Printf("Failed to convert JSON: %v", err) + } + } + default: + l := field.Len() + for j := 0; j < l; j++ { + prefixName := fmt.Sprintf("%s.%d.", fieldName, (j + 1)) + ifc := field.Index(j).Interface() + //log.Printf("%s : %v", prefixName, ifc) + if ifc != nil { + setQueryValuesByFlattenMethod(ifc, values, prefixName) + } + } + continue + } + } + + default: + switch field.Interface().(type) { + case ISO6801Time: + t := field.Interface().(ISO6801Time) + value = t.String() + case time.Time: + t := field.Interface().(time.Time) + value = GetISO8601TimeStamp(t) + default: + + ifc := field.Interface() + if ifc != nil { + if anonymous { + SetQueryValues(ifc, values) + } else { + prefixName := fieldName + "." + setQueryValuesByFlattenMethod(ifc, values, prefixName) + } + continue + } + } + } + if value != "" { + name := elemType.Field(i).Tag.Get("ArgName") + if name == "" { + name = fieldName + } + if prefix != "" { + name = prefix + name + } + // NOTE: here we will change name to underline style when the type is UnderlineString + if field.Type().Name() == "UnderlineString" { + name = Underline2Dot(name) + } + values.Set(name, value) + } + } +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/util/iso6801.go b/vendor/github.com/denverdino/aliyungo/util/iso6801.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/util/iso6801.go rename to vendor/github.com/denverdino/aliyungo/util/iso6801.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/util/signature.go b/vendor/github.com/denverdino/aliyungo/util/signature.go similarity index 99% rename from vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/util/signature.go rename to vendor/github.com/denverdino/aliyungo/util/signature.go index a00b27c19bc8..1be6d39c7c5b 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/aliyun/vendor/github.com/denverdino/aliyungo/util/signature.go +++ b/vendor/github.com/denverdino/aliyungo/util/signature.go @@ -35,6 +35,5 @@ func CreateSignatureForRequest(method string, values *url.Values, accessKeySecre canonicalizedQueryString := percentReplace(values.Encode()) stringToSign := method + "&%2F&" + url.QueryEscape(canonicalizedQueryString) - return CreateSignature(stringToSign, accessKeySecret) } diff --git a/vendor/github.com/denverdino/aliyungo/util/util.go b/vendor/github.com/denverdino/aliyungo/util/util.go new file mode 100644 index 000000000000..15a990da1b4f --- /dev/null +++ b/vendor/github.com/denverdino/aliyungo/util/util.go @@ -0,0 +1,185 @@ +package util + +import ( + "bytes" + srand "crypto/rand" + "encoding/binary" + "encoding/json" + "fmt" + "math/rand" + "net/http" + "net/url" + "sort" + "time" +) + +const dictionary = "_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + +//CreateRandomString create random string +func CreateRandomString() string { + b := make([]byte, 32) + l := len(dictionary) + + _, err := srand.Read(b) + + if err != nil { + // fail back to insecure rand + rand.Seed(time.Now().UnixNano()) + for i := range b { + b[i] = dictionary[rand.Int()%l] + } + } else { + for i, v := range b { + b[i] = dictionary[v%byte(l)] + } + } + + return string(b) +} + +// Encode encodes the values into ``URL encoded'' form +// ("acl&bar=baz&foo=quux") sorted by key. +func Encode(v url.Values) string { + if v == nil { + return "" + } + var buf bytes.Buffer + keys := make([]string, 0, len(v)) + for k := range v { + keys = append(keys, k) + } + sort.Strings(keys) + for _, k := range keys { + vs := v[k] + prefix := url.QueryEscape(k) + for _, v := range vs { + if buf.Len() > 0 { + buf.WriteByte('&') + } + buf.WriteString(prefix) + if v != "" { + buf.WriteString("=") + buf.WriteString(url.QueryEscape(v)) + } + } + } + return buf.String() +} + +// Like Encode, but key and value are not escaped +func EncodeWithoutEscape(v url.Values) string { + if v == nil { + return "" + } + var buf bytes.Buffer + keys := make([]string, 0, len(v)) + for k := range v { + keys = append(keys, k) + } + sort.Strings(keys) + for _, k := range keys { + vs := v[k] + prefix := k + for _, v := range vs { + if buf.Len() > 0 { + buf.WriteByte('&') + } + buf.WriteString(prefix) + if v != "" { + buf.WriteString("=") + buf.WriteString(v) + } + } + } + return buf.String() +} + +func GetGMTime() string { + return time.Now().UTC().Format(http.TimeFormat) +} + +// + +func randUint32() uint32 { + return randUint32Slice(1)[0] +} + +func randUint32Slice(c int) []uint32 { + b := make([]byte, c*4) + + _, err := srand.Read(b) + + if err != nil { + // fail back to insecure rand + rand.Seed(time.Now().UnixNano()) + for i := range b { + b[i] = byte(rand.Int()) + } + } + + n := make([]uint32, c) + + for i := range n { + n[i] = binary.BigEndian.Uint32(b[i*4 : i*4+4]) + } + + return n +} + +func toByte(n uint32, st, ed byte) byte { + return byte(n%uint32(ed-st+1) + uint32(st)) +} + +func toDigit(n uint32) byte { + return toByte(n, '0', '9') +} + +func toLowerLetter(n uint32) byte { + return toByte(n, 'a', 'z') +} + +func toUpperLetter(n uint32) byte { + return toByte(n, 'A', 'Z') +} + +type convFunc func(uint32) byte + +var convFuncs = []convFunc{toDigit, toLowerLetter, toUpperLetter} + +// tools for generating a random ECS instance password +// from 8 to 30 char MUST contain digit upper, case letter and upper case letter +// http://docs.aliyun.com/#/pub/ecs/open-api/instance&createinstance +func GenerateRandomECSPassword() string { + + // [8, 30] + l := int(randUint32()%23 + 8) + + n := randUint32Slice(l) + + b := make([]byte, l) + + b[0] = toDigit(n[0]) + b[1] = toLowerLetter(n[1]) + b[2] = toUpperLetter(n[2]) + + for i := 3; i < l; i++ { + b[i] = convFuncs[n[i]%3](n[i]) + } + + s := make([]byte, l) + perm := rand.Perm(l) + for i, v := range perm { + s[v] = b[i] + } + + return string(s) + +} + +func PrettyJson(object interface{}) string { + b, err := json.MarshalIndent(object, "", " ") + if err != nil { + fmt.Printf("ERROR: PrettyJson, %v\n %s\n", err, b) + } + return string(b) +} diff --git a/vendor/github.com/dgrijalva/jwt-go/.gitignore b/vendor/github.com/dgrijalva/jwt-go/.gitignore new file mode 100644 index 000000000000..80bed650ec03 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +bin + + diff --git a/vendor/github.com/dgrijalva/jwt-go/.travis.yml b/vendor/github.com/dgrijalva/jwt-go/.travis.yml new file mode 100644 index 000000000000..1027f56cd94d --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/.travis.yml @@ -0,0 +1,13 @@ +language: go + +script: + - go vet ./... + - go test -v ./... + +go: + - 1.3 + - 1.4 + - 1.5 + - 1.6 + - 1.7 + - tip diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/LICENSE b/vendor/github.com/dgrijalva/jwt-go/LICENSE similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/LICENSE rename to vendor/github.com/dgrijalva/jwt-go/LICENSE diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/MIGRATION_GUIDE.md b/vendor/github.com/dgrijalva/jwt-go/MIGRATION_GUIDE.md similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/MIGRATION_GUIDE.md rename to vendor/github.com/dgrijalva/jwt-go/MIGRATION_GUIDE.md diff --git a/vendor/github.com/dgrijalva/jwt-go/README.md b/vendor/github.com/dgrijalva/jwt-go/README.md new file mode 100644 index 000000000000..d358d881b8dd --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/README.md @@ -0,0 +1,100 @@ +# jwt-go + +[![Build Status](https://travis-ci.org/dgrijalva/jwt-go.svg?branch=master)](https://travis-ci.org/dgrijalva/jwt-go) +[![GoDoc](https://godoc.org/github.com/dgrijalva/jwt-go?status.svg)](https://godoc.org/github.com/dgrijalva/jwt-go) + +A [go](http://www.golang.org) (or 'golang' for search engine friendliness) implementation of [JSON Web Tokens](http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html) + +**NEW VERSION COMING:** There have been a lot of improvements suggested since the version 3.0.0 released in 2016. I'm working now on cutting two different releases: 3.2.0 will contain any non-breaking changes or enhancements. 4.0.0 will follow shortly which will include breaking changes. See the 4.0.0 milestone to get an idea of what's coming. If you have other ideas, or would like to participate in 4.0.0, now's the time. If you depend on this library and don't want to be interrupted, I recommend you use your dependency mangement tool to pin to version 3. + +**SECURITY NOTICE:** Some older versions of Go have a security issue in the cryotp/elliptic. Recommendation is to upgrade to at least 1.8.3. See issue #216 for more detail. + +**SECURITY NOTICE:** It's important that you [validate the `alg` presented is what you expect](https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/). This library attempts to make it easy to do the right thing by requiring key types match the expected alg, but you should take the extra step to verify it in your usage. See the examples provided. + +## What the heck is a JWT? + +JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web Tokens. + +In short, it's a signed JSON object that does something useful (for example, authentication). It's commonly used for `Bearer` tokens in Oauth 2. A token is made of three parts, separated by `.`'s. The first two parts are JSON objects, that have been [base64url](http://tools.ietf.org/html/rfc4648) encoded. The last part is the signature, encoded the same way. + +The first part is called the header. It contains the necessary information for verifying the last part, the signature. For example, which encryption method was used for signing and what key was used. + +The part in the middle is the interesting bit. It's called the Claims and contains the actual stuff you care about. Refer to [the RFC](http://self-issued.info/docs/draft-jones-json-web-token.html) for information about reserved keys and the proper way to add your own. + +## What's in the box? + +This library supports the parsing and verification as well as the generation and signing of JWTs. Current supported signing algorithms are HMAC SHA, RSA, RSA-PSS, and ECDSA, though hooks are present for adding your own. + +## Examples + +See [the project documentation](https://godoc.org/github.com/dgrijalva/jwt-go) for examples of usage: + +* [Simple example of parsing and validating a token](https://godoc.org/github.com/dgrijalva/jwt-go#example-Parse--Hmac) +* [Simple example of building and signing a token](https://godoc.org/github.com/dgrijalva/jwt-go#example-New--Hmac) +* [Directory of Examples](https://godoc.org/github.com/dgrijalva/jwt-go#pkg-examples) + +## Extensions + +This library publishes all the necessary components for adding your own signing methods. Simply implement the `SigningMethod` interface and register a factory method using `RegisterSigningMethod`. + +Here's an example of an extension that integrates with the Google App Engine signing tools: https://github.com/someone1/gcp-jwt-go + +## Compliance + +This library was last reviewed to comply with [RTF 7519](http://www.rfc-editor.org/info/rfc7519) dated May 2015 with a few notable differences: + +* In order to protect against accidental use of [Unsecured JWTs](http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#UnsecuredJWT), tokens using `alg=none` will only be accepted if the constant `jwt.UnsafeAllowNoneSignatureType` is provided as the key. + +## Project Status & Versioning + +This library is considered production ready. Feedback and feature requests are appreciated. The API should be considered stable. There should be very few backwards-incompatible changes outside of major version updates (and only with good reason). + +This project uses [Semantic Versioning 2.0.0](http://semver.org). Accepted pull requests will land on `master`. Periodically, versions will be tagged from `master`. You can find all the releases on [the project releases page](https://github.com/dgrijalva/jwt-go/releases). + +While we try to make it obvious when we make breaking changes, there isn't a great mechanism for pushing announcements out to users. You may want to use this alternative package include: `gopkg.in/dgrijalva/jwt-go.v3`. It will do the right thing WRT semantic versioning. + +**BREAKING CHANGES:*** +* Version 3.0.0 includes _a lot_ of changes from the 2.x line, including a few that break the API. We've tried to break as few things as possible, so there should just be a few type signature changes. A full list of breaking changes is available in `VERSION_HISTORY.md`. See `MIGRATION_GUIDE.md` for more information on updating your code. + +## Usage Tips + +### Signing vs Encryption + +A token is simply a JSON object that is signed by its author. this tells you exactly two things about the data: + +* The author of the token was in the possession of the signing secret +* The data has not been modified since it was signed + +It's important to know that JWT does not provide encryption, which means anyone who has access to the token can read its contents. If you need to protect (encrypt) the data, there is a companion spec, `JWE`, that provides this functionality. JWE is currently outside the scope of this library. + +### Choosing a Signing Method + +There are several signing methods available, and you should probably take the time to learn about the various options before choosing one. The principal design decision is most likely going to be symmetric vs asymmetric. + +Symmetric signing methods, such as HSA, use only a single secret. This is probably the simplest signing method to use since any `[]byte` can be used as a valid secret. They are also slightly computationally faster to use, though this rarely is enough to matter. Symmetric signing methods work the best when both producers and consumers of tokens are trusted, or even the same system. Since the same secret is used to both sign and validate tokens, you can't easily distribute the key for validation. + +Asymmetric signing methods, such as RSA, use different keys for signing and verifying tokens. This makes it possible to produce tokens with a private key, and allow any consumer to access the public key for verification. + +### Signing Methods and Key Types + +Each signing method expects a different object type for its signing keys. See the package documentation for details. Here are the most common ones: + +* The [HMAC signing method](https://godoc.org/github.com/dgrijalva/jwt-go#SigningMethodHMAC) (`HS256`,`HS384`,`HS512`) expect `[]byte` values for signing and validation +* The [RSA signing method](https://godoc.org/github.com/dgrijalva/jwt-go#SigningMethodRSA) (`RS256`,`RS384`,`RS512`) expect `*rsa.PrivateKey` for signing and `*rsa.PublicKey` for validation +* The [ECDSA signing method](https://godoc.org/github.com/dgrijalva/jwt-go#SigningMethodECDSA) (`ES256`,`ES384`,`ES512`) expect `*ecdsa.PrivateKey` for signing and `*ecdsa.PublicKey` for validation + +### JWT and OAuth + +It's worth mentioning that OAuth and JWT are not the same thing. A JWT token is simply a signed JSON object. It can be used anywhere such a thing is useful. There is some confusion, though, as JWT is the most common type of bearer token used in OAuth2 authentication. + +Without going too far down the rabbit hole, here's a description of the interaction of these technologies: + +* OAuth is a protocol for allowing an identity provider to be separate from the service a user is logging in to. For example, whenever you use Facebook to log into a different service (Yelp, Spotify, etc), you are using OAuth. +* OAuth defines several options for passing around authentication data. One popular method is called a "bearer token". A bearer token is simply a string that _should_ only be held by an authenticated user. Thus, simply presenting this token proves your identity. You can probably derive from here why a JWT might make a good bearer token. +* Because bearer tokens are used for authentication, it's important they're kept secret. This is why transactions that use bearer tokens typically happen over SSL. + +## More + +Documentation can be found [on godoc.org](http://godoc.org/github.com/dgrijalva/jwt-go). + +The command line utility included in this project (cmd/jwt) provides a straightforward example of token creation and parsing as well as a useful tool for debugging your own integration. You'll also find several implementation examples in the documentation. diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/VERSION_HISTORY.md b/vendor/github.com/dgrijalva/jwt-go/VERSION_HISTORY.md similarity index 92% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/VERSION_HISTORY.md rename to vendor/github.com/dgrijalva/jwt-go/VERSION_HISTORY.md index c21551f6bbdd..6370298313a6 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/VERSION_HISTORY.md +++ b/vendor/github.com/dgrijalva/jwt-go/VERSION_HISTORY.md @@ -1,5 +1,12 @@ ## `jwt-go` Version History +#### 3.2.0 + +* Added method `ParseUnverified` to allow users to split up the tasks of parsing and validation +* HMAC signing method returns `ErrInvalidKeyType` instead of `ErrInvalidKey` where appropriate +* Added options to `request.ParseFromRequest`, which allows for an arbitrary list of modifiers to parsing behavior. Initial set include `WithClaims` and `WithParser`. Existing usage of this function will continue to work as before. +* Deprecated `ParseFromRequestWithClaims` to simplify API in the future. + #### 3.1.0 * Improvements to `jwt` command line tool diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/claims.go b/vendor/github.com/dgrijalva/jwt-go/claims.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/claims.go rename to vendor/github.com/dgrijalva/jwt-go/claims.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/doc.go b/vendor/github.com/dgrijalva/jwt-go/doc.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/doc.go rename to vendor/github.com/dgrijalva/jwt-go/doc.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/ecdsa.go b/vendor/github.com/dgrijalva/jwt-go/ecdsa.go similarity index 97% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/ecdsa.go rename to vendor/github.com/dgrijalva/jwt-go/ecdsa.go index 2f59a2223638..f977381240e3 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/ecdsa.go +++ b/vendor/github.com/dgrijalva/jwt-go/ecdsa.go @@ -14,6 +14,7 @@ var ( ) // Implements the ECDSA family of signing methods signing methods +// Expects *ecdsa.PrivateKey for signing and *ecdsa.PublicKey for verification type SigningMethodECDSA struct { Name string Hash crypto.Hash diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go b/vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go rename to vendor/github.com/dgrijalva/jwt-go/ecdsa_utils.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/errors.go b/vendor/github.com/dgrijalva/jwt-go/errors.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/errors.go rename to vendor/github.com/dgrijalva/jwt-go/errors.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/hmac.go b/vendor/github.com/dgrijalva/jwt-go/hmac.go similarity index 96% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/hmac.go rename to vendor/github.com/dgrijalva/jwt-go/hmac.go index c22991925455..addbe5d40182 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/hmac.go +++ b/vendor/github.com/dgrijalva/jwt-go/hmac.go @@ -7,6 +7,7 @@ import ( ) // Implements the HMAC-SHA family of signing methods signing methods +// Expects key type of []byte for both signing and validation type SigningMethodHMAC struct { Name string Hash crypto.Hash @@ -90,5 +91,5 @@ func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) (string, return EncodeSegment(hasher.Sum(nil)), nil } - return "", ErrInvalidKey + return "", ErrInvalidKeyType } diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/map_claims.go b/vendor/github.com/dgrijalva/jwt-go/map_claims.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/map_claims.go rename to vendor/github.com/dgrijalva/jwt-go/map_claims.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/none.go b/vendor/github.com/dgrijalva/jwt-go/none.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/none.go rename to vendor/github.com/dgrijalva/jwt-go/none.go diff --git a/vendor/github.com/dgrijalva/jwt-go/parser.go b/vendor/github.com/dgrijalva/jwt-go/parser.go new file mode 100644 index 000000000000..d6901d9adb52 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/parser.go @@ -0,0 +1,148 @@ +package jwt + +import ( + "bytes" + "encoding/json" + "fmt" + "strings" +) + +type Parser struct { + ValidMethods []string // If populated, only these methods will be considered valid + UseJSONNumber bool // Use JSON Number format in JSON decoder + SkipClaimsValidation bool // Skip claims validation during token parsing +} + +// Parse, validate, and return a token. +// keyFunc will receive the parsed token and should return the key for validating. +// If everything is kosher, err will be nil +func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) { + return p.ParseWithClaims(tokenString, MapClaims{}, keyFunc) +} + +func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) { + token, parts, err := p.ParseUnverified(tokenString, claims) + if err != nil { + return token, err + } + + // Verify signing method is in the required set + if p.ValidMethods != nil { + var signingMethodValid = false + var alg = token.Method.Alg() + for _, m := range p.ValidMethods { + if m == alg { + signingMethodValid = true + break + } + } + if !signingMethodValid { + // signing method is not in the listed set + return token, NewValidationError(fmt.Sprintf("signing method %v is invalid", alg), ValidationErrorSignatureInvalid) + } + } + + // Lookup key + var key interface{} + if keyFunc == nil { + // keyFunc was not provided. short circuiting validation + return token, NewValidationError("no Keyfunc was provided.", ValidationErrorUnverifiable) + } + if key, err = keyFunc(token); err != nil { + // keyFunc returned an error + if ve, ok := err.(*ValidationError); ok { + return token, ve + } + return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable} + } + + vErr := &ValidationError{} + + // Validate Claims + if !p.SkipClaimsValidation { + if err := token.Claims.Valid(); err != nil { + + // If the Claims Valid returned an error, check if it is a validation error, + // If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set + if e, ok := err.(*ValidationError); !ok { + vErr = &ValidationError{Inner: err, Errors: ValidationErrorClaimsInvalid} + } else { + vErr = e + } + } + } + + // Perform validation + token.Signature = parts[2] + if err = token.Method.Verify(strings.Join(parts[0:2], "."), token.Signature, key); err != nil { + vErr.Inner = err + vErr.Errors |= ValidationErrorSignatureInvalid + } + + if vErr.valid() { + token.Valid = true + return token, nil + } + + return token, vErr +} + +// WARNING: Don't use this method unless you know what you're doing +// +// This method parses the token but doesn't validate the signature. It's only +// ever useful in cases where you know the signature is valid (because it has +// been checked previously in the stack) and you want to extract values from +// it. +func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Token, parts []string, err error) { + parts = strings.Split(tokenString, ".") + if len(parts) != 3 { + return nil, parts, NewValidationError("token contains an invalid number of segments", ValidationErrorMalformed) + } + + token = &Token{Raw: tokenString} + + // parse Header + var headerBytes []byte + if headerBytes, err = DecodeSegment(parts[0]); err != nil { + if strings.HasPrefix(strings.ToLower(tokenString), "bearer ") { + return token, parts, NewValidationError("tokenstring should not contain 'bearer '", ValidationErrorMalformed) + } + return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} + } + if err = json.Unmarshal(headerBytes, &token.Header); err != nil { + return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} + } + + // parse Claims + var claimBytes []byte + token.Claims = claims + + if claimBytes, err = DecodeSegment(parts[1]); err != nil { + return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} + } + dec := json.NewDecoder(bytes.NewBuffer(claimBytes)) + if p.UseJSONNumber { + dec.UseNumber() + } + // JSON Decode. Special case for map type to avoid weird pointer behavior + if c, ok := token.Claims.(MapClaims); ok { + err = dec.Decode(&c) + } else { + err = dec.Decode(&claims) + } + // Handle decode error + if err != nil { + return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed} + } + + // Lookup signature method + if method, ok := token.Header["alg"].(string); ok { + if token.Method = GetSigningMethod(method); token.Method == nil { + return token, parts, NewValidationError("signing method (alg) is unavailable.", ValidationErrorUnverifiable) + } + } else { + return token, parts, NewValidationError("signing method (alg) is unspecified.", ValidationErrorUnverifiable) + } + + return token, parts, nil +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/rsa.go b/vendor/github.com/dgrijalva/jwt-go/rsa.go similarity index 91% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/rsa.go rename to vendor/github.com/dgrijalva/jwt-go/rsa.go index 0ae0b1984e5a..e4caf1ca4a11 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/rsa.go +++ b/vendor/github.com/dgrijalva/jwt-go/rsa.go @@ -7,6 +7,7 @@ import ( ) // Implements the RSA family of signing methods signing methods +// Expects *rsa.PrivateKey for signing and *rsa.PublicKey for validation type SigningMethodRSA struct { Name string Hash crypto.Hash @@ -44,7 +45,7 @@ func (m *SigningMethodRSA) Alg() string { } // Implements the Verify method from SigningMethod -// For this signing method, must be an rsa.PublicKey structure. +// For this signing method, must be an *rsa.PublicKey structure. func (m *SigningMethodRSA) Verify(signingString, signature string, key interface{}) error { var err error @@ -73,7 +74,7 @@ func (m *SigningMethodRSA) Verify(signingString, signature string, key interface } // Implements the Sign method from SigningMethod -// For this signing method, must be an rsa.PrivateKey structure. +// For this signing method, must be an *rsa.PrivateKey structure. func (m *SigningMethodRSA) Sign(signingString string, key interface{}) (string, error) { var rsaKey *rsa.PrivateKey var ok bool diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/rsa_pss.go b/vendor/github.com/dgrijalva/jwt-go/rsa_pss.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/rsa_pss.go rename to vendor/github.com/dgrijalva/jwt-go/rsa_pss.go diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go b/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go new file mode 100644 index 000000000000..a5ababf956c4 --- /dev/null +++ b/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go @@ -0,0 +1,101 @@ +package jwt + +import ( + "crypto/rsa" + "crypto/x509" + "encoding/pem" + "errors" +) + +var ( + ErrKeyMustBePEMEncoded = errors.New("Invalid Key: Key must be PEM encoded PKCS1 or PKCS8 private key") + ErrNotRSAPrivateKey = errors.New("Key is not a valid RSA private key") + ErrNotRSAPublicKey = errors.New("Key is not a valid RSA public key") +) + +// Parse PEM encoded PKCS1 or PKCS8 private key +func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + var parsedKey interface{} + if parsedKey, err = x509.ParsePKCS1PrivateKey(block.Bytes); err != nil { + if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { + return nil, err + } + } + + var pkey *rsa.PrivateKey + var ok bool + if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { + return nil, ErrNotRSAPrivateKey + } + + return pkey, nil +} + +// Parse PEM encoded PKCS1 or PKCS8 private key protected with password +func ParseRSAPrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + var parsedKey interface{} + + var blockDecrypted []byte + if blockDecrypted, err = x509.DecryptPEMBlock(block, []byte(password)); err != nil { + return nil, err + } + + if parsedKey, err = x509.ParsePKCS1PrivateKey(blockDecrypted); err != nil { + if parsedKey, err = x509.ParsePKCS8PrivateKey(blockDecrypted); err != nil { + return nil, err + } + } + + var pkey *rsa.PrivateKey + var ok bool + if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok { + return nil, ErrNotRSAPrivateKey + } + + return pkey, nil +} + +// Parse PEM encoded PKCS1 or PKCS8 public key +func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey interface{} + if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { + if cert, err := x509.ParseCertificate(block.Bytes); err == nil { + parsedKey = cert.PublicKey + } else { + return nil, err + } + } + + var pkey *rsa.PublicKey + var ok bool + if pkey, ok = parsedKey.(*rsa.PublicKey); !ok { + return nil, ErrNotRSAPublicKey + } + + return pkey, nil +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/signing_method.go b/vendor/github.com/dgrijalva/jwt-go/signing_method.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/signing_method.go rename to vendor/github.com/dgrijalva/jwt-go/signing_method.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/token.go b/vendor/github.com/dgrijalva/jwt-go/token.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dgrijalva/jwt-go/token.go rename to vendor/github.com/dgrijalva/jwt-go/token.go diff --git a/vendor/github.com/digitalocean/godo/.gitignore b/vendor/github.com/digitalocean/godo/.gitignore new file mode 100644 index 000000000000..48b8bf9072d8 --- /dev/null +++ b/vendor/github.com/digitalocean/godo/.gitignore @@ -0,0 +1 @@ +vendor/ diff --git a/vendor/github.com/digitalocean/godo/.travis.yml b/vendor/github.com/digitalocean/godo/.travis.yml new file mode 100644 index 000000000000..5bbdb40f0fec --- /dev/null +++ b/vendor/github.com/digitalocean/godo/.travis.yml @@ -0,0 +1,8 @@ +language: go + +go: + - 1.7 + - 1.8 + - 1.9 + - "1.10" + - tip diff --git a/vendor/github.com/digitalocean/godo/CHANGELOG.md b/vendor/github.com/digitalocean/godo/CHANGELOG.md new file mode 100644 index 000000000000..e0e4b88ac6fe --- /dev/null +++ b/vendor/github.com/digitalocean/godo/CHANGELOG.md @@ -0,0 +1,102 @@ +# Change Log + +## [v1.10.0] - 2019-03-20 + +- #215 Add support for Databases - @mikejholly + +## [v1.9.0] - 2019-03-18 + +- #214 add support for enable_proxy_protocol. - @mregmi + +## [v1.8.0] - 2019-03-13 + +- #210 Expose tags on storage volume create/list/get. - @jcodybaker + +## [v1.7.5] - 2019-03-04 + +- #207 Add support for custom subdomains for Spaces CDN [beta] - @xornivore + +## [v1.7.4] - 2019-02-08 + +- #202 Allow tagging volumes - @mchitten + +## [v1.7.3] - 2018-12-18 + +- #196 Expose tag support for creating Load Balancers. + +## [v1.7.2] - 2018-12-04 + +- #192 Exposes more options for Kubernetes clusters. + +## [v1.7.1] - 2018-11-27 + +- #190 Expose constants for the state of Kubernetes clusters. + +## [v1.7.0] - 2018-11-13 + +- #188 Kubernetes support [beta] - @aybabtme + +## [v1.6.0] - 2018-10-16 + +- #185 Projects support [beta] - @mchitten + +## [v1.5.0] - 2018-10-01 + +- #181 Adding tagging images support - @hugocorbucci + +## [v1.4.2] - 2018-08-30 + +- #178 Allowing creating domain records with weight of 0 - @TFaga +- #177 Adding `VolumeLimit` to account - @lxfontes + +## [v1.4.1] - 2018-08-23 + +- #176 Fix cdn flush cache API endpoint - @sunny-b + +## [v1.4.0] - 2018-08-22 + +- #175 Add support for Spaces CDN - @sunny-b + +## [v1.3.0] - 2018-05-24 + +- #170 Add support for volume formatting - @adamwg + +## [v1.2.0] - 2018-05-08 + +- #166 Remove support for Go 1.6 - @iheanyi +- #165 Add support for Let's Encrypt Certificates - @viola + +## [v1.1.3] - 2018-03-07 + +- #156 Handle non-json errors from the API - @aknuds1 +- #158 Update droplet example to use latest instance type - @dan-v + +## [v1.1.2] - 2018-03-06 + +- #157 storage: list volumes should handle only name or only region params - @andrewsykim +- #154 docs: replace first example with fully-runnable example - @xmudrii +- #152 Handle flags & tag properties of domain record - @jaymecd + +## [v1.1.1] - 2017-09-29 + +- #151 Following user agent field recommendations - @joonas +- #148 AsRequest method to create load balancers requests - @lukegb + +## [v1.1.0] - 2017-06-06 + +### Added +- #145 Add FirewallsService for managing Firewalls with the DigitalOcean API. - @viola +- #139 Add TTL field to the Domains. - @xmudrii + +### Fixed +- #143 Fix oauth2.NoContext depreciation. - @jbowens +- #141 Fix DropletActions on tagged resources. - @xmudrii + +## [v1.0.0] - 2017-03-10 + +### Added +- #130 Add Convert to ImageActionsService. - @xmudrii +- #126 Add CertificatesService for managing certificates with the DigitalOcean API. - @viola +- #125 Add LoadBalancersService for managing load balancers with the DigitalOcean API. - @viola +- #122 Add GetVolumeByName to StorageService. - @protochron +- #113 Add context.Context to all calls. - @aybabtme diff --git a/vendor/github.com/digitalocean/godo/CONTRIBUTING.md b/vendor/github.com/digitalocean/godo/CONTRIBUTING.md new file mode 100644 index 000000000000..daad280a5656 --- /dev/null +++ b/vendor/github.com/digitalocean/godo/CONTRIBUTING.md @@ -0,0 +1,48 @@ +# Contributing + +If you submit a pull request, please keep the following guidelines in mind: + +1. Code should be `go fmt` compliant. +2. Types, structs and funcs should be documented. +3. Tests pass. + +## Getting set up + +Assuming your `$GOPATH` is set up according to your desires, run: + +```sh +go get github.com/digitalocean/godo +go get -u github.com/stretchr/testify/assert +``` + +## Running tests + +When working on code in this repository, tests can be run via: + +```sh +go test . +``` + +## Versioning + +Godo follows [semver](https://www.semver.org) versioning semantics. New functionality should be accompanied by increment to the minor version number. The current strategy is to release often. Any code which is complete, tested, reviewed, and merged to master is worthy of release. + +## Releasing + +Releasing a new version of godo is currently a manual process. + +1. Update the `CHANGELOG.md` with your changes. If a version header for the next (unreleased) version does not exist, create one. Include one bullet point for each piece of new functionality in the release, including the pull request ID, description, and author(s). + +``` +## [v1.8.0] - 2019-03-13 + +- #210 Expose tags on storage volume create/list/get. - @jcodybaker +- #123 Update test dependencies - @digitalocean +``` + +2. Update the `libraryVersion` number in `godo.go`. +3. Make a pull request with these changes. This PR should be separate from the PR containing the godo changes. +4. Once the pull request has been merged, visit [https://github.com/digitalocean/godo/releases](https://github.com/digitalocean/godo/release) and click `Draft a new release`. +5. Update the `Tag version` and `Release title` field with the new godo version. Be sure the version has a `v` prefixed in both places. Ex `v1.8.0`. +6. Copy the changelog bullet points to the description field. +7. Publish the release. \ No newline at end of file diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/LICENSE.txt b/vendor/github.com/digitalocean/godo/LICENSE.txt similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/LICENSE.txt rename to vendor/github.com/digitalocean/godo/LICENSE.txt diff --git a/vendor/github.com/digitalocean/godo/README.md b/vendor/github.com/digitalocean/godo/README.md new file mode 100644 index 000000000000..ffd3988b7abc --- /dev/null +++ b/vendor/github.com/digitalocean/godo/README.md @@ -0,0 +1,150 @@ +[![Build Status](https://travis-ci.org/digitalocean/godo.svg)](https://travis-ci.org/digitalocean/godo) + +# Godo + +Godo is a Go client library for accessing the DigitalOcean V2 API. + +You can view the client API docs here: [http://godoc.org/github.com/digitalocean/godo](http://godoc.org/github.com/digitalocean/godo) + +You can view DigitalOcean API docs here: [https://developers.digitalocean.com/documentation/v2/](https://developers.digitalocean.com/documentation/v2/) + + +## Usage + +```go +import "github.com/digitalocean/godo" +``` + +Create a new DigitalOcean client, then use the exposed services to +access different parts of the DigitalOcean API. + +### Authentication + +Currently, Personal Access Token (PAT) is the only method of +authenticating with the API. You can manage your tokens +at the DigitalOcean Control Panel [Applications Page](https://cloud.digitalocean.com/settings/applications). + +You can then use your token to create a new client: + +```go +package main + +import ( + "context" + "github.com/digitalocean/godo" + "golang.org/x/oauth2" +) + +const ( + pat = "mytoken" +) + +type TokenSource struct { + AccessToken string +} + +func (t *TokenSource) Token() (*oauth2.Token, error) { + token := &oauth2.Token{ + AccessToken: t.AccessToken, + } + return token, nil +} + +func main() { + tokenSource := &TokenSource{ + AccessToken: pat, + } + + oauthClient := oauth2.NewClient(context.Background(), tokenSource) + client := godo.NewClient(oauthClient) +} +``` + +## Examples + + +To create a new Droplet: + +```go +dropletName := "super-cool-droplet" + +createRequest := &godo.DropletCreateRequest{ + Name: dropletName, + Region: "nyc3", + Size: "s-1vcpu-1gb", + Image: godo.DropletCreateImage{ + Slug: "ubuntu-14-04-x64", + }, +} + +ctx := context.TODO() + +newDroplet, _, err := client.Droplets.Create(ctx, createRequest) + +if err != nil { + fmt.Printf("Something bad happened: %s\n\n", err) + return err +} +``` + +### Pagination + +If a list of items is paginated by the API, you must request pages individually. For example, to fetch all Droplets: + +```go +func DropletList(ctx context.Context, client *godo.Client) ([]godo.Droplet, error) { + // create a list to hold our droplets + list := []godo.Droplet{} + + // create options. initially, these will be blank + opt := &godo.ListOptions{} + for { + droplets, resp, err := client.Droplets.List(ctx, opt) + if err != nil { + return nil, err + } + + // append the current page's droplets to our list + for _, d := range droplets { + list = append(list, d) + } + + // if we are at the last page, break out the for loop + if resp.Links == nil || resp.Links.IsLastPage() { + break + } + + page, err := resp.Links.CurrentPage() + if err != nil { + return nil, err + } + + // set the page we want for the next request + opt.Page = page + 1 + } + + return list, nil +} +``` + +## Versioning + +Each version of the client is tagged and the version is updated accordingly. + +Since Go does not have a built-in versioning, a package management tool is +recommended - a good one that works with git tags is +[gopkg.in](http://labix.org/gopkg.in). + +To see the list of past versions, run `git tag`. + + +## Documentation + +For a comprehensive list of examples, check out the [API documentation](https://developers.digitalocean.com/documentation/v2/). + +For details on all the functionality in this library, see the [GoDoc](http://godoc.org/github.com/digitalocean/godo) documentation. + + +## Contributing + +We love pull requests! Please see the [contribution guidelines](CONTRIBUTING.md). diff --git a/vendor/github.com/digitalocean/godo/account.go b/vendor/github.com/digitalocean/godo/account.go new file mode 100644 index 000000000000..7d3e105d34f6 --- /dev/null +++ b/vendor/github.com/digitalocean/godo/account.go @@ -0,0 +1,60 @@ +package godo + +import ( + "context" + "net/http" +) + +// AccountService is an interface for interfacing with the Account +// endpoints of the DigitalOcean API +// See: https://developers.digitalocean.com/documentation/v2/#account +type AccountService interface { + Get(context.Context) (*Account, *Response, error) +} + +// AccountServiceOp handles communication with the Account related methods of +// the DigitalOcean API. +type AccountServiceOp struct { + client *Client +} + +var _ AccountService = &AccountServiceOp{} + +// Account represents a DigitalOcean Account +type Account struct { + DropletLimit int `json:"droplet_limit,omitempty"` + FloatingIPLimit int `json:"floating_ip_limit,omitempty"` + VolumeLimit int `json:"volume_limit,omitempty"` + Email string `json:"email,omitempty"` + UUID string `json:"uuid,omitempty"` + EmailVerified bool `json:"email_verified,omitempty"` + Status string `json:"status,omitempty"` + StatusMessage string `json:"status_message,omitempty"` +} + +type accountRoot struct { + Account *Account `json:"account"` +} + +func (r Account) String() string { + return Stringify(r) +} + +// Get DigitalOcean account info +func (s *AccountServiceOp) Get(ctx context.Context) (*Account, *Response, error) { + + path := "v2/account" + + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(accountRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.Account, resp, err +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/action.go b/vendor/github.com/digitalocean/godo/action.go similarity index 98% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/action.go rename to vendor/github.com/digitalocean/godo/action.go index 3990f5644666..67ef3ab8d51d 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/action.go +++ b/vendor/github.com/digitalocean/godo/action.go @@ -1,10 +1,9 @@ package godo import ( + "context" "fmt" "net/http" - - "github.com/digitalocean/godo/context" ) const ( diff --git a/vendor/github.com/digitalocean/godo/cdn.go b/vendor/github.com/digitalocean/godo/cdn.go new file mode 100644 index 000000000000..2e8f475aa73f --- /dev/null +++ b/vendor/github.com/digitalocean/godo/cdn.go @@ -0,0 +1,214 @@ +package godo + +import ( + "context" + "fmt" + "net/http" + "time" +) + +const cdnBasePath = "v2/cdn/endpoints" + +// CDNService is an interface for managing Spaces CDN with the DigitalOcean API. +type CDNService interface { + List(context.Context, *ListOptions) ([]CDN, *Response, error) + Get(context.Context, string) (*CDN, *Response, error) + Create(context.Context, *CDNCreateRequest) (*CDN, *Response, error) + UpdateTTL(context.Context, string, *CDNUpdateTTLRequest) (*CDN, *Response, error) + UpdateCustomDomain(context.Context, string, *CDNUpdateCustomDomainRequest) (*CDN, *Response, error) + FlushCache(context.Context, string, *CDNFlushCacheRequest) (*Response, error) + Delete(context.Context, string) (*Response, error) +} + +// CDNServiceOp handles communication with the CDN related methods of the +// DigitalOcean API. +type CDNServiceOp struct { + client *Client +} + +var _ CDNService = &CDNServiceOp{} + +// CDN represents a DigitalOcean CDN +type CDN struct { + ID string `json:"id"` + Origin string `json:"origin"` + Endpoint string `json:"endpoint"` + CreatedAt time.Time `json:"created_at"` + TTL uint32 `json:"ttl"` + CertificateID string `json:"certificate_id,omitempty"` + CustomDomain string `json:"custom_domain,omitempty"` +} + +// CDNRoot represents a response from the DigitalOcean API +type cdnRoot struct { + Endpoint *CDN `json:"endpoint"` +} + +type cdnsRoot struct { + Endpoints []CDN `json:"endpoints"` + Links *Links `json:"links"` +} + +// CDNCreateRequest represents a request to create a CDN. +type CDNCreateRequest struct { + Origin string `json:"origin"` + TTL uint32 `json:"ttl"` + CustomDomain string `json:"custom_domain,omitempty"` + CertificateID string `json:"certificate_id,omitempty"` +} + +// CDNUpdateTTLRequest represents a request to update the ttl of a CDN. +type CDNUpdateTTLRequest struct { + TTL uint32 `json:"ttl"` +} + +// CDNUpdateCustomDomainRequest represents a request to update the custom domain of a CDN. +type CDNUpdateCustomDomainRequest struct { + CustomDomain string `json:"custom_domain"` + CertificateID string `json:"certificate_id"` +} + +// CDNFlushCacheRequest represents a request to flush cache of a CDN. +type CDNFlushCacheRequest struct { + Files []string `json:"files"` +} + +// List all CDN endpoints +func (c CDNServiceOp) List(ctx context.Context, opt *ListOptions) ([]CDN, *Response, error) { + path, err := addOptions(cdnBasePath, opt) + if err != nil { + return nil, nil, err + } + + req, err := c.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(cdnsRoot) + resp, err := c.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + if l := root.Links; l != nil { + resp.Links = l + } + + return root.Endpoints, resp, err +} + +// Get individual CDN. It requires a non-empty cdn id. +func (c CDNServiceOp) Get(ctx context.Context, id string) (*CDN, *Response, error) { + if len(id) == 0 { + return nil, nil, NewArgError("id", "cannot be an empty string") + } + + path := fmt.Sprintf("%s/%s", cdnBasePath, id) + + req, err := c.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(cdnRoot) + resp, err := c.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.Endpoint, resp, err +} + +// Create a new CDN +func (c CDNServiceOp) Create(ctx context.Context, createRequest *CDNCreateRequest) (*CDN, *Response, error) { + if createRequest == nil { + return nil, nil, NewArgError("createRequest", "cannot be nil") + } + + req, err := c.client.NewRequest(ctx, http.MethodPost, cdnBasePath, createRequest) + if err != nil { + return nil, nil, err + } + + root := new(cdnRoot) + resp, err := c.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.Endpoint, resp, err +} + +// UpdateTTL updates the ttl of an individual CDN +func (c CDNServiceOp) UpdateTTL(ctx context.Context, id string, updateRequest *CDNUpdateTTLRequest) (*CDN, *Response, error) { + return c.update(ctx, id, updateRequest) +} + +// UpdateCustomDomain sets or removes the custom domain of an individual CDN +func (c CDNServiceOp) UpdateCustomDomain(ctx context.Context, id string, updateRequest *CDNUpdateCustomDomainRequest) (*CDN, *Response, error) { + return c.update(ctx, id, updateRequest) +} + +func (c CDNServiceOp) update(ctx context.Context, id string, updateRequest interface{}) (*CDN, *Response, error) { + if updateRequest == nil { + return nil, nil, NewArgError("updateRequest", "cannot be nil") + } + + if len(id) == 0 { + return nil, nil, NewArgError("id", "cannot be an empty string") + } + path := fmt.Sprintf("%s/%s", cdnBasePath, id) + + req, err := c.client.NewRequest(ctx, http.MethodPut, path, updateRequest) + if err != nil { + return nil, nil, err + } + + root := new(cdnRoot) + resp, err := c.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.Endpoint, resp, err +} + +// FlushCache flushes the cache of an individual CDN. Requires a non-empty slice of file paths and/or wildcards +func (c CDNServiceOp) FlushCache(ctx context.Context, id string, flushCacheRequest *CDNFlushCacheRequest) (*Response, error) { + if flushCacheRequest == nil { + return nil, NewArgError("flushCacheRequest", "cannot be nil") + } + + if len(id) == 0 { + return nil, NewArgError("id", "cannot be an empty string") + } + + path := fmt.Sprintf("%s/%s/cache", cdnBasePath, id) + + req, err := c.client.NewRequest(ctx, http.MethodDelete, path, flushCacheRequest) + if err != nil { + return nil, err + } + + resp, err := c.client.Do(ctx, req, nil) + + return resp, err +} + +// Delete an individual CDN +func (c CDNServiceOp) Delete(ctx context.Context, id string) (*Response, error) { + if len(id) == 0 { + return nil, NewArgError("id", "cannot be an empty string") + } + + path := fmt.Sprintf("%s/%s", cdnBasePath, id) + + req, err := c.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + + resp, err := c.client.Do(ctx, req, nil) + + return resp, err +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/certificates.go b/vendor/github.com/digitalocean/godo/certificates.go similarity index 79% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/certificates.go rename to vendor/github.com/digitalocean/godo/certificates.go index ca95cee756f1..cbc3e16ae822 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/certificates.go +++ b/vendor/github.com/digitalocean/godo/certificates.go @@ -1,10 +1,9 @@ package godo import ( + "context" "net/http" "path" - - "github.com/digitalocean/godo/context" ) const certificatesBasePath = "/v2/certificates" @@ -20,19 +19,24 @@ type CertificatesService interface { // Certificate represents a DigitalOcean certificate configuration. type Certificate struct { - ID string `json:"id,omitempty"` - Name string `json:"name,omitempty"` - NotAfter string `json:"not_after,omitempty"` - SHA1Fingerprint string `json:"sha1_fingerprint,omitempty"` - Created string `json:"created_at,omitempty"` + ID string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + DNSNames []string `json:"dns_names,omitempty"` + NotAfter string `json:"not_after,omitempty"` + SHA1Fingerprint string `json:"sha1_fingerprint,omitempty"` + Created string `json:"created_at,omitempty"` + State string `json:"state,omitempty"` + Type string `json:"type,omitempty"` } // CertificateRequest represents configuration for a new certificate. type CertificateRequest struct { - Name string `json:"name,omitempty"` - PrivateKey string `json:"private_key,omitempty"` - LeafCertificate string `json:"leaf_certificate,omitempty"` - CertificateChain string `json:"certificate_chain,omitempty"` + Name string `json:"name,omitempty"` + DNSNames []string `json:"dns_names,omitempty"` + PrivateKey string `json:"private_key,omitempty"` + LeafCertificate string `json:"leaf_certificate,omitempty"` + CertificateChain string `json:"certificate_chain,omitempty"` + Type string `json:"type,omitempty"` } type certificateRoot struct { diff --git a/vendor/github.com/digitalocean/godo/databases.go b/vendor/github.com/digitalocean/godo/databases.go new file mode 100644 index 000000000000..5c4edc26c2c6 --- /dev/null +++ b/vendor/github.com/digitalocean/godo/databases.go @@ -0,0 +1,614 @@ +package godo + +import ( + "context" + "fmt" + "net/http" + "time" +) + +const ( + databaseBasePath = "/v2/databases" + databaseSinglePath = databaseBasePath + "/%s" + databaseResizePath = databaseBasePath + "/%s/resize" + databaseMigratePath = databaseBasePath + "/%s/migrate" + databaseMaintenancePath = databaseBasePath + "/%s/maintenance" + databaseBackupsPath = databaseBasePath + "/%s/backups" + databaseUsersPath = databaseBasePath + "/%s/users" + databaseUserPath = databaseBasePath + "/%s/users/%s" + databaseDBPath = databaseBasePath + "/%s/dbs/%s" + databaseDBsPath = databaseBasePath + "/%s/dbs" + databasePoolPath = databaseBasePath + "/%s/pools/%s" + databasePoolsPath = databaseBasePath + "/%s/pools" + databaseReplicaPath = databaseBasePath + "/%s/replicas/%s" + databaseReplicasPath = databaseBasePath + "/%s/replicas" +) + +// DatabasesService is an interface for interfacing with the databases endpoints +// of the DigitalOcean API. +// See: https://developers.digitalocean.com/documentation/v2#databases +type DatabasesService interface { + List(context.Context, *ListOptions) ([]Database, *Response, error) + Get(context.Context, string) (*Database, *Response, error) + Create(context.Context, *DatabaseCreateRequest) (*Database, *Response, error) + Delete(context.Context, string) (*Response, error) + Resize(context.Context, string, *DatabaseResizeRequest) (*Response, error) + Migrate(context.Context, string, *DatabaseMigrateRequest) (*Response, error) + UpdateMaintenance(context.Context, string, *DatabaseUpdateMaintenanceRequest) (*Response, error) + ListBackups(context.Context, string, *ListOptions) ([]DatabaseBackup, *Response, error) + GetUser(context.Context, string, string) (*DatabaseUser, *Response, error) + ListUsers(context.Context, string, *ListOptions) ([]DatabaseUser, *Response, error) + CreateUser(context.Context, string, *DatabaseCreateUserRequest) (*DatabaseUser, *Response, error) + DeleteUser(context.Context, string, string) (*Response, error) + ListDBs(context.Context, string, *ListOptions) ([]DatabaseDB, *Response, error) + CreateDB(context.Context, string, *DatabaseCreateDBRequest) (*DatabaseDB, *Response, error) + GetDB(context.Context, string, string) (*DatabaseDB, *Response, error) + DeleteDB(context.Context, string, string) (*Response, error) + ListPools(context.Context, string, *ListOptions) ([]DatabasePool, *Response, error) + CreatePool(context.Context, string, *DatabaseCreatePoolRequest) (*DatabasePool, *Response, error) + GetPool(context.Context, string, string) (*DatabasePool, *Response, error) + DeletePool(context.Context, string, string) (*Response, error) + GetReplica(context.Context, string, string) (*DatabaseReplica, *Response, error) + ListReplicas(context.Context, string, *ListOptions) ([]DatabaseReplica, *Response, error) + CreateReplica(context.Context, string, *DatabaseCreateReplicaRequest) (*DatabaseReplica, *Response, error) + DeleteReplica(context.Context, string, string) (*Response, error) +} + +// DatabasesServiceOp handles communication with the Databases related methods +// of the DigitalOcean API. +type DatabasesServiceOp struct { + client *Client +} + +var _ DatabasesService = &DatabasesServiceOp{} + +// Database represents a DigitalOcean managed database product. These managed databases +// are usually comprised of a cluster of database nodes, a primary and 0 or more replicas. +// The EngineSlug is a string which indicates the type of database service. Some examples are +// "pg", "mysql" or "redis". A Database also includes connection information and other +// properties of the service like region, size and current status. +type Database struct { + ID string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + EngineSlug string `json:"engine,omitempty"` + VersionSlug string `json:"version,omitempty"` + Connection *DatabaseConnection `json:"connection,omitempty"` + Users []DatabaseUser `json:"users,omitempty"` + NumNodes int `json:"num_nodes,omitempty"` + SizeSlug string `json:"size,omitempty"` + DBNames []string `json:"db_names,omitempty"` + RegionSlug string `json:"region,omitempty"` + Status string `json:"status,omitempty"` + MaintenanceWindow *DatabaseMaintenanceWindow `json:"maintenance_window,omitempty"` + CreatedAt time.Time `json:"created_at,omitempty"` +} + +// DatabaseConnection represents a database connection +type DatabaseConnection struct { + URI string `json:"uri,omitempty"` + Database string `json:"database,omitempty"` + Host string `json:"host,omitempty"` + Port int `json:"port,omitempty"` + User string `json:"user,omitempty"` + Password string `json:"password,omitempty"` + SSL bool `json:"ssl,omitempty"` +} + +// DatabaseUser represents a user in the database +type DatabaseUser struct { + Name string `json:"name,omitempty"` + Role string `json:"role,omitempty"` + Password string `json:"password,omitempty"` +} + +// DatabaseMaintenanceWindow represents the maintenance_window of a database +// cluster +type DatabaseMaintenanceWindow struct { + Day string `json:"day,omitempty"` + Hour string `json:"hour,omitempty"` + Pending bool `json:"pending,omitempty"` + Description []string `json:"description,omitempty"` +} + +// DatabaseBackup represents a database backup. +type DatabaseBackup struct { + CreatedAt time.Time `json:"created_at,omitempty"` + SizeGigabytes float64 `json:"size_gigabytes,omitempty"` +} + +// DatabaseCreateRequest represents a request to create a database cluster +type DatabaseCreateRequest struct { + Name string `json:"name,omitempty"` + EngineSlug string `json:"engine,omitempty"` + Version string `json:"version,omitempty"` + SizeSlug string `json:"size,omitempty"` + Region string `json:"region,omitempty"` + NumNodes int `json:"num_nodes,omitempty"` +} + +// DatabaseResizeRequest can be used to initiate a database resize operation. +type DatabaseResizeRequest struct { + SizeSlug string `json:"size,omitempty"` + NumNodes int `json:"num_nodes,omitempty"` +} + +// DatabaseMigrateRequest can be used to initiate a database migrate operation. +type DatabaseMigrateRequest struct { + Region string `json:"region,omitempty"` +} + +// DatabaseUpdateMaintenanceRequest can be used to update the database's maintenance window. +type DatabaseUpdateMaintenanceRequest struct { + Day string `json:"day,omitempty"` + Hour string `json:"hour,omitempty"` +} + +// DatabaseDB represents an engine-specific database created within a database cluster. For SQL +// databases like PostgreSQL or MySQL, a "DB" refers to a database created on the RDBMS. For instance, +// a PostgreSQL database server can contain many database schemas, each with it's own settings, access +// permissions and data. ListDBs will return all databases present on the server. +type DatabaseDB struct { + Name string `json:"name"` +} + +// DatabaseReplica represents a read-only replica of a particular database +type DatabaseReplica struct { + Name string `json:"name"` + Connection *DatabaseConnection `json:"connection"` + Region string `json:"region"` + Status string `json:"status"` + CreatedAt time.Time `json:"created_at"` +} + +// DatabasePool represents a database connection pool +type DatabasePool struct { + User string `json:"user"` + Name string `json:"name"` + Size int `json:"size"` + Database string `json:"database"` + Mode string `json:"mode"` + Connection *DatabaseConnection `json:"connection"` +} + +// DatabaseCreatePoolRequest is used to create a new database connection pool +type DatabaseCreatePoolRequest struct { + Pool *DatabasePool `json:"pool"` +} + +// DatabaseCreateUserRequest is used to create a new database user +type DatabaseCreateUserRequest struct { + Name string `json:"name"` +} + +// DatabaseCreateDBRequest is used to create a new engine-specific database within the cluster +type DatabaseCreateDBRequest struct { + Name string `json:"name"` +} + +// DatabaseCreateReplicaRequest is used to create a new read-only replica +type DatabaseCreateReplicaRequest struct { + Name string `json:"name"` + Region string `json:"region"` + Size string `json:"size"` +} + +type databaseUserRoot struct { + User *DatabaseUser `json:"user"` +} + +type databaseUsersRoot struct { + Users []DatabaseUser `json:"users"` +} + +type databaseDBRoot struct { + DB *DatabaseDB `json:"db"` +} + +type databaseDBsRoot struct { + DBs []DatabaseDB `json:"dbs"` +} + +type databasesRoot struct { + Databases []Database `json:"databases"` +} + +type databaseRoot struct { + Database *Database `json:"database"` +} + +type databaseBackupsRoot struct { + Backups []DatabaseBackup `json:"backups"` +} + +type databasePoolRoot struct { + Pool *DatabasePool `json:"pool"` +} + +type databasePoolsRoot struct { + Pools []DatabasePool `json:"pools"` +} + +type databaseReplicaRoot struct { + Replica *DatabaseReplica `json:"replica"` +} + +type databaseReplicasRoot struct { + Replicas []DatabaseReplica `json:"replicas"` +} + +// List returns a list of the Databases visible with the caller's API token +func (svc *DatabasesServiceOp) List(ctx context.Context, opts *ListOptions) ([]Database, *Response, error) { + path := databaseBasePath + path, err := addOptions(path, opts) + if err != nil { + return nil, nil, err + } + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(databasesRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Databases, resp, nil +} + +// Get retrieves the details of a database cluster +func (svc *DatabasesServiceOp) Get(ctx context.Context, databaseID string) (*Database, *Response, error) { + path := fmt.Sprintf(databaseSinglePath, databaseID) + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(databaseRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Database, resp, nil +} + +// Create creates a database cluster +func (svc *DatabasesServiceOp) Create(ctx context.Context, create *DatabaseCreateRequest) (*Database, *Response, error) { + path := databaseBasePath + req, err := svc.client.NewRequest(ctx, http.MethodPost, path, create) + if err != nil { + return nil, nil, err + } + root := new(databaseRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Database, resp, nil +} + +// Delete deletes a database cluster. There is no way to recover a cluster once +// it has been destroyed. +func (svc *DatabasesServiceOp) Delete(ctx context.Context, databaseID string) (*Response, error) { + path := fmt.Sprintf("%s/%s", databaseBasePath, databaseID) + req, err := svc.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + resp, err := svc.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// Resize resizes a database cluster by number of nodes or size +func (svc *DatabasesServiceOp) Resize(ctx context.Context, databaseID string, resize *DatabaseResizeRequest) (*Response, error) { + path := fmt.Sprintf(databaseResizePath, databaseID) + req, err := svc.client.NewRequest(ctx, http.MethodPut, path, resize) + if err != nil { + return nil, err + } + resp, err := svc.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// Migrate migrates a database cluster to a new region +func (svc *DatabasesServiceOp) Migrate(ctx context.Context, databaseID string, migrate *DatabaseMigrateRequest) (*Response, error) { + path := fmt.Sprintf(databaseMigratePath, databaseID) + req, err := svc.client.NewRequest(ctx, http.MethodPut, path, migrate) + if err != nil { + return nil, err + } + resp, err := svc.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// UpdateMaintenance updates the maintenance window on a cluster +func (svc *DatabasesServiceOp) UpdateMaintenance(ctx context.Context, databaseID string, maintenance *DatabaseUpdateMaintenanceRequest) (*Response, error) { + path := fmt.Sprintf(databaseMaintenancePath, databaseID) + req, err := svc.client.NewRequest(ctx, http.MethodPut, path, maintenance) + if err != nil { + return nil, err + } + resp, err := svc.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// ListBackups returns a list of the current backups of a database +func (svc *DatabasesServiceOp) ListBackups(ctx context.Context, databaseID string, opts *ListOptions) ([]DatabaseBackup, *Response, error) { + path := fmt.Sprintf(databaseBackupsPath, databaseID) + path, err := addOptions(path, opts) + if err != nil { + return nil, nil, err + } + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(databaseBackupsRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Backups, resp, nil +} + +// GetUser returns the database user identified by userID +func (svc *DatabasesServiceOp) GetUser(ctx context.Context, databaseID, userID string) (*DatabaseUser, *Response, error) { + path := fmt.Sprintf(databaseUserPath, databaseID, userID) + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(databaseUserRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.User, resp, nil +} + +// ListUsers returns all database users for the database +func (svc *DatabasesServiceOp) ListUsers(ctx context.Context, databaseID string, opts *ListOptions) ([]DatabaseUser, *Response, error) { + path := fmt.Sprintf(databaseUsersPath, databaseID) + path, err := addOptions(path, opts) + if err != nil { + return nil, nil, err + } + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(databaseUsersRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Users, resp, nil +} + +// CreateUser will create a new database user +func (svc *DatabasesServiceOp) CreateUser(ctx context.Context, databaseID string, createUser *DatabaseCreateUserRequest) (*DatabaseUser, *Response, error) { + path := fmt.Sprintf(databaseUsersPath, databaseID) + req, err := svc.client.NewRequest(ctx, http.MethodPost, path, createUser) + if err != nil { + return nil, nil, err + } + root := new(databaseUserRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.User, resp, nil +} + +// DeleteUser will delete an existing database user +func (svc *DatabasesServiceOp) DeleteUser(ctx context.Context, databaseID, userID string) (*Response, error) { + path := fmt.Sprintf(databaseUserPath, databaseID, userID) + req, err := svc.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + resp, err := svc.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// ListDBs returns all databases for a given database cluster +func (svc *DatabasesServiceOp) ListDBs(ctx context.Context, databaseID string, opts *ListOptions) ([]DatabaseDB, *Response, error) { + path := fmt.Sprintf(databaseDBsPath, databaseID) + path, err := addOptions(path, opts) + if err != nil { + return nil, nil, err + } + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(databaseDBsRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.DBs, resp, nil +} + +// GetDB returns a single database by name +func (svc *DatabasesServiceOp) GetDB(ctx context.Context, databaseID, name string) (*DatabaseDB, *Response, error) { + path := fmt.Sprintf(databaseDBPath, databaseID, name) + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(databaseDBRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.DB, resp, nil +} + +// CreateDB will create a new database +func (svc *DatabasesServiceOp) CreateDB(ctx context.Context, databaseID string, createDB *DatabaseCreateDBRequest) (*DatabaseDB, *Response, error) { + path := fmt.Sprintf(databaseDBsPath, databaseID) + req, err := svc.client.NewRequest(ctx, http.MethodPost, path, createDB) + if err != nil { + return nil, nil, err + } + root := new(databaseDBRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.DB, resp, nil +} + +// DeleteDB will delete an existing database +func (svc *DatabasesServiceOp) DeleteDB(ctx context.Context, databaseID, name string) (*Response, error) { + path := fmt.Sprintf(databaseDBPath, databaseID, name) + req, err := svc.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + resp, err := svc.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// ListPools returns all connection pools for a given database cluster +func (svc *DatabasesServiceOp) ListPools(ctx context.Context, databaseID string, opts *ListOptions) ([]DatabasePool, *Response, error) { + path := fmt.Sprintf(databasePoolsPath, databaseID) + path, err := addOptions(path, opts) + if err != nil { + return nil, nil, err + } + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(databasePoolsRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Pools, resp, nil +} + +// GetPool returns a single database connection pool by name +func (svc *DatabasesServiceOp) GetPool(ctx context.Context, databaseID, name string) (*DatabasePool, *Response, error) { + path := fmt.Sprintf(databasePoolPath, databaseID, name) + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(databasePoolRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Pool, resp, nil +} + +// CreatePool will create a new database connection pool +func (svc *DatabasesServiceOp) CreatePool(ctx context.Context, databaseID string, createPool *DatabaseCreatePoolRequest) (*DatabasePool, *Response, error) { + path := fmt.Sprintf(databasePoolsPath, databaseID) + req, err := svc.client.NewRequest(ctx, http.MethodPost, path, createPool) + if err != nil { + return nil, nil, err + } + root := new(databasePoolRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Pool, resp, nil +} + +// DeletePool will delete an existing database connection pool +func (svc *DatabasesServiceOp) DeletePool(ctx context.Context, databaseID, name string) (*Response, error) { + path := fmt.Sprintf(databasePoolPath, databaseID, name) + req, err := svc.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + resp, err := svc.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// GetReplica returns a single database replica +func (svc *DatabasesServiceOp) GetReplica(ctx context.Context, databaseID, name string) (*DatabaseReplica, *Response, error) { + path := fmt.Sprintf(databaseReplicaPath, databaseID, name) + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(databaseReplicaRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Replica, resp, nil +} + +// ListReplicas returns all read-only replicas for a given database cluster +func (svc *DatabasesServiceOp) ListReplicas(ctx context.Context, databaseID string, opts *ListOptions) ([]DatabaseReplica, *Response, error) { + path := fmt.Sprintf(databaseReplicasPath, databaseID) + path, err := addOptions(path, opts) + if err != nil { + return nil, nil, err + } + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(databaseReplicasRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Replicas, resp, nil +} + +// CreateReplica will create a new database connection pool +func (svc *DatabasesServiceOp) CreateReplica(ctx context.Context, databaseID string, createReplica *DatabaseCreateReplicaRequest) (*DatabaseReplica, *Response, error) { + path := fmt.Sprintf(databaseReplicasPath, databaseID) + req, err := svc.client.NewRequest(ctx, http.MethodPost, path, createReplica) + if err != nil { + return nil, nil, err + } + root := new(databaseReplicaRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Replica, resp, nil +} + +// DeleteReplica will delete an existing database replica +func (svc *DatabasesServiceOp) DeleteReplica(ctx context.Context, databaseID, name string) (*Response, error) { + path := fmt.Sprintf(databaseReplicaPath, databaseID, name) + req, err := svc.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + resp, err := svc.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + return resp, nil +} diff --git a/vendor/github.com/digitalocean/godo/doc.go b/vendor/github.com/digitalocean/godo/doc.go new file mode 100644 index 000000000000..e22f69333c77 --- /dev/null +++ b/vendor/github.com/digitalocean/godo/doc.go @@ -0,0 +1,11 @@ +// Package godo is the DigtalOcean API v2 client for Go +// +// Databases +// +// The Databases service provides access to the DigitalOcean managed database +// suite of products. Customers can create new database clusters, migrate them +// between regions, create replicas and interact with their configurations. +// Each database service is refered to as a Database. A SQL database service +// can have multiple databases residing in the system. To help make these +// entities distinct from Databases in godo, we refer to them here as DatabaseDBs. +package godo diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/domains.go b/vendor/github.com/digitalocean/godo/domains.go similarity index 93% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/domains.go rename to vendor/github.com/digitalocean/godo/domains.go index 091f0d97a48b..1014e9b9588f 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/domains.go +++ b/vendor/github.com/digitalocean/godo/domains.go @@ -1,10 +1,9 @@ package godo import ( + "context" "fmt" "net/http" - - "github.com/digitalocean/godo/context" ) const domainsBasePath = "v2/domains" @@ -53,7 +52,7 @@ type domainsRoot struct { // DomainCreateRequest respresents a request to create a domain. type DomainCreateRequest struct { Name string `json:"name"` - IPAddress string `json:"ip_address"` + IPAddress string `json:"ip_address,omitempty"` } // DomainRecordRoot is the root of an individual Domain Record response @@ -73,10 +72,12 @@ type DomainRecord struct { Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` Data string `json:"data,omitempty"` - Priority int `json:"priority,omitempty"` + Priority int `json:"priority"` Port int `json:"port,omitempty"` TTL int `json:"ttl,omitempty"` - Weight int `json:"weight,omitempty"` + Weight int `json:"weight"` + Flags int `json:"flags"` + Tag string `json:"tag,omitempty"` } // DomainRecordEditRequest represents a request to update a domain record. @@ -84,16 +85,22 @@ type DomainRecordEditRequest struct { Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` Data string `json:"data,omitempty"` - Priority int `json:"priority,omitempty"` + Priority int `json:"priority"` Port int `json:"port,omitempty"` TTL int `json:"ttl,omitempty"` - Weight int `json:"weight,omitempty"` + Weight int `json:"weight"` + Flags int `json:"flags"` + Tag string `json:"tag,omitempty"` } func (d Domain) String() string { return Stringify(d) } +func (d Domain) URN() string { + return ToURN("Domain", d.Name) +} + // List all domains. func (s DomainsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Domain, *Response, error) { path := domainsBasePath @@ -287,18 +294,18 @@ func (s *DomainsServiceOp) EditRecord(ctx context.Context, path := fmt.Sprintf("%s/%s/records/%d", domainsBasePath, domain, id) - req, err := s.client.NewRequest(ctx, "PUT", path, editRequest) + req, err := s.client.NewRequest(ctx, http.MethodPut, path, editRequest) if err != nil { return nil, nil, err } - d := new(DomainRecord) - resp, err := s.client.Do(ctx, req, d) + root := new(domainRecordRoot) + resp, err := s.client.Do(ctx, req, root) if err != nil { return nil, resp, err } - return d, resp, err + return root.DomainRecord, resp, err } // CreateRecord creates a record using a DomainRecordEditRequest diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/droplet_actions.go b/vendor/github.com/digitalocean/godo/droplet_actions.go similarity index 97% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/droplet_actions.go rename to vendor/github.com/digitalocean/godo/droplet_actions.go index a40d19700725..ddeacfc86249 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/droplet_actions.go +++ b/vendor/github.com/digitalocean/godo/droplet_actions.go @@ -1,11 +1,10 @@ package godo import ( + "context" "fmt" "net/http" "net/url" - - "github.com/digitalocean/godo/context" ) // ActionRequest reprents DigitalOcean Action Request @@ -41,7 +40,6 @@ type DropletActionsService interface { EnableIPv6ByTag(context.Context, string) ([]Action, *Response, error) EnablePrivateNetworking(context.Context, int) (*Action, *Response, error) EnablePrivateNetworkingByTag(context.Context, string) ([]Action, *Response, error) - Upgrade(context.Context, int) (*Action, *Response, error) Get(context.Context, int, int) (*Action, *Response, error) GetByURI(context.Context, string) (*Action, *Response, error) } @@ -231,12 +229,6 @@ func (s *DropletActionsServiceOp) EnablePrivateNetworkingByTag(ctx context.Conte return s.doActionByTag(ctx, tag, request) } -// Upgrade a Droplet. -func (s *DropletActionsServiceOp) Upgrade(ctx context.Context, id int) (*Action, *Response, error) { - request := &ActionRequest{"type": "upgrade"} - return s.doAction(ctx, id, request) -} - func (s *DropletActionsServiceOp) doAction(ctx context.Context, id int, request *ActionRequest) (*Action, *Response, error) { if id < 1 { return nil, nil, NewArgError("id", "cannot be less than 1") diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/droplets.go b/vendor/github.com/digitalocean/godo/droplets.go similarity index 99% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/droplets.go rename to vendor/github.com/digitalocean/godo/droplets.go index 5ec898b2cb2a..ab508f1c080e 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/droplets.go +++ b/vendor/github.com/digitalocean/godo/droplets.go @@ -1,12 +1,11 @@ package godo import ( + "context" "encoding/json" "errors" "fmt" "net/http" - - "github.com/digitalocean/godo/context" ) const dropletBasePath = "v2/droplets" @@ -126,6 +125,10 @@ func (d Droplet) String() string { return Stringify(d) } +func (d Droplet) URN() string { + return ToURN("Droplet", d.ID) +} + // DropletRoot represents a Droplet root type dropletRoot struct { Droplet *Droplet `json:"droplet"` diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/errors.go b/vendor/github.com/digitalocean/godo/errors.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/errors.go rename to vendor/github.com/digitalocean/godo/errors.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/firewalls.go b/vendor/github.com/digitalocean/godo/firewalls.go similarity index 99% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/firewalls.go rename to vendor/github.com/digitalocean/godo/firewalls.go index afc0af323350..c28cac03b816 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/firewalls.go +++ b/vendor/github.com/digitalocean/godo/firewalls.go @@ -1,11 +1,10 @@ package godo import ( + "context" "net/http" "path" "strconv" - - "github.com/digitalocean/godo/context" ) const firewallsBasePath = "/v2/firewalls" @@ -50,6 +49,10 @@ func (fw Firewall) String() string { return Stringify(fw) } +func (fw Firewall) URN() string { + return ToURN("Firewall", fw.ID) +} + // FirewallRequest represents the configuration to be applied to an existing or a new Firewall. type FirewallRequest struct { Name string `json:"name"` diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/floating_ips.go b/vendor/github.com/digitalocean/godo/floating_ips.go similarity index 97% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/floating_ips.go rename to vendor/github.com/digitalocean/godo/floating_ips.go index a9187dca78e2..4545e90373f7 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/floating_ips.go +++ b/vendor/github.com/digitalocean/godo/floating_ips.go @@ -1,10 +1,9 @@ package godo import ( + "context" "fmt" "net/http" - - "github.com/digitalocean/godo/context" ) const floatingBasePath = "v2/floating_ips" @@ -38,6 +37,10 @@ func (f FloatingIP) String() string { return Stringify(f) } +func (f FloatingIP) URN() string { + return ToURN("FloatingIP", f.IP) +} + type floatingIPsRoot struct { FloatingIPs []FloatingIP `json:"floating_ips"` Links *Links `json:"links"` diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/floating_ips_actions.go b/vendor/github.com/digitalocean/godo/floating_ips_actions.go similarity index 98% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/floating_ips_actions.go rename to vendor/github.com/digitalocean/godo/floating_ips_actions.go index 2fd2393ce491..74ad279f9500 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/floating_ips_actions.go +++ b/vendor/github.com/digitalocean/godo/floating_ips_actions.go @@ -1,10 +1,9 @@ package godo import ( + "context" "fmt" "net/http" - - "github.com/digitalocean/godo/context" ) // FloatingIPActionsService is an interface for interfacing with the diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/godo.go b/vendor/github.com/digitalocean/godo/godo.go similarity index 91% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/godo.go rename to vendor/github.com/digitalocean/godo/godo.go index 9dfef2a31e91..7f298732ed85 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/godo.go +++ b/vendor/github.com/digitalocean/godo/godo.go @@ -2,6 +2,7 @@ package godo import ( "bytes" + "context" "encoding/json" "fmt" "io" @@ -13,13 +14,10 @@ import ( "time" "github.com/google/go-querystring/query" - headerLink "github.com/tent/http-link-go" - - "github.com/digitalocean/godo/context" ) const ( - libraryVersion = "1.1.0" + libraryVersion = "1.10.0" defaultBaseURL = "https://api.digitalocean.com/" userAgent = "godo/" + libraryVersion mediaType = "application/json" @@ -47,6 +45,7 @@ type Client struct { // Services used for communicating with the API Account AccountService Actions ActionsService + CDNs CDNService Domains DomainsService Droplets DropletsService DropletActions DropletActionsService @@ -64,6 +63,9 @@ type Client struct { LoadBalancers LoadBalancersService Certificates CertificatesService Firewalls FirewallsService + Projects ProjectsService + Kubernetes KubernetesService + Databases DatabasesService // Optional function called after every successful request made to the DO APIs onRequestCompleted RequestCompletionCallback @@ -158,23 +160,27 @@ func NewClient(httpClient *http.Client) *Client { c := &Client{client: httpClient, BaseURL: baseURL, UserAgent: userAgent} c.Account = &AccountServiceOp{client: c} c.Actions = &ActionsServiceOp{client: c} + c.CDNs = &CDNServiceOp{client: c} + c.Certificates = &CertificatesServiceOp{client: c} c.Domains = &DomainsServiceOp{client: c} c.Droplets = &DropletsServiceOp{client: c} c.DropletActions = &DropletActionsServiceOp{client: c} + c.Firewalls = &FirewallsServiceOp{client: c} c.FloatingIPs = &FloatingIPsServiceOp{client: c} c.FloatingIPActions = &FloatingIPActionsServiceOp{client: c} c.Images = &ImagesServiceOp{client: c} c.ImageActions = &ImageActionsServiceOp{client: c} c.Keys = &KeysServiceOp{client: c} + c.LoadBalancers = &LoadBalancersServiceOp{client: c} + c.Projects = &ProjectsServiceOp{client: c} c.Regions = &RegionsServiceOp{client: c} - c.Snapshots = &SnapshotsServiceOp{client: c} c.Sizes = &SizesServiceOp{client: c} + c.Snapshots = &SnapshotsServiceOp{client: c} c.Storage = &StorageServiceOp{client: c} c.StorageActions = &StorageActionsServiceOp{client: c} c.Tags = &TagsServiceOp{client: c} - c.LoadBalancers = &LoadBalancersServiceOp{client: c} - c.Certificates = &CertificatesServiceOp{client: c} - c.Firewalls = &FirewallsServiceOp{client: c} + c.Kubernetes = &KubernetesServiceOp{client: c} + c.Databases = &DatabasesServiceOp{client: c} return c } @@ -210,7 +216,7 @@ func SetBaseURL(bu string) ClientOpt { // SetUserAgent is a client option for setting the user agent. func SetUserAgent(ua string) ClientOpt { return func(c *Client) error { - c.UserAgent = fmt.Sprintf("%s+%s", ua, c.UserAgent) + c.UserAgent = fmt.Sprintf("%s %s", ua, c.UserAgent) return nil } } @@ -258,25 +264,6 @@ func newResponse(r *http.Response) *Response { return &response } -func (r *Response) links() (map[string]headerLink.Link, error) { - if linkText, ok := r.Response.Header["Link"]; ok { - links, err := headerLink.Parse(linkText[0]) - - if err != nil { - return nil, err - } - - linkMap := map[string]headerLink.Link{} - for _, link := range links { - linkMap[link.Rel] = link - } - - return linkMap, nil - } - - return map[string]headerLink.Link{}, nil -} - // populateRate parses the rate related headers and populates the response Rate. func (r *Response) populateRate() { if limit := r.Header.Get(headerRateLimit); limit != "" { @@ -296,7 +283,7 @@ func (r *Response) populateRate() { // pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, // the raw response will be written to v, without attempting to decode it. func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Response, error) { - resp, err := context.DoRequestWithClient(ctx, c.client, req) + resp, err := DoRequestWithClient(ctx, c.client, req) if err != nil { return nil, err } @@ -334,6 +321,21 @@ func (c *Client) Do(ctx context.Context, req *http.Request, v interface{}) (*Res return response, err } + +// DoRequest submits an HTTP request. +func DoRequest(ctx context.Context, req *http.Request) (*http.Response, error) { + return DoRequestWithClient(ctx, http.DefaultClient, req) +} + +// DoRequestWithClient submits an HTTP request using the specified client. +func DoRequestWithClient( + ctx context.Context, + client *http.Client, + req *http.Request) (*http.Response, error) { + req = req.WithContext(ctx) + return client.Do(req) +} + func (r *ErrorResponse) Error() string { if r.RequestID != "" { return fmt.Sprintf("%v %v: %d (request %q) %v", @@ -356,7 +358,7 @@ func CheckResponse(r *http.Response) error { if err == nil && len(data) > 0 { err := json.Unmarshal(data, errorResponse) if err != nil { - return err + errorResponse.Message = string(data) } } diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/image_actions.go b/vendor/github.com/digitalocean/godo/image_actions.go similarity index 98% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/image_actions.go rename to vendor/github.com/digitalocean/godo/image_actions.go index 1e9fa31222c2..976f7c687243 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/image_actions.go +++ b/vendor/github.com/digitalocean/godo/image_actions.go @@ -1,10 +1,9 @@ package godo import ( + "context" "fmt" "net/http" - - "github.com/digitalocean/godo/context" ) // ImageActionsService is an interface for interfacing with the image actions diff --git a/vendor/github.com/digitalocean/godo/images.go b/vendor/github.com/digitalocean/godo/images.go new file mode 100644 index 000000000000..69de4c075017 --- /dev/null +++ b/vendor/github.com/digitalocean/godo/images.go @@ -0,0 +1,241 @@ +package godo + +import ( + "context" + "fmt" + "net/http" +) + +const imageBasePath = "v2/images" + +// ImagesService is an interface for interfacing with the images +// endpoints of the DigitalOcean API +// See: https://developers.digitalocean.com/documentation/v2#images +type ImagesService interface { + List(context.Context, *ListOptions) ([]Image, *Response, error) + ListDistribution(ctx context.Context, opt *ListOptions) ([]Image, *Response, error) + ListApplication(ctx context.Context, opt *ListOptions) ([]Image, *Response, error) + ListUser(ctx context.Context, opt *ListOptions) ([]Image, *Response, error) + ListByTag(ctx context.Context, tag string, opt *ListOptions) ([]Image, *Response, error) + GetByID(context.Context, int) (*Image, *Response, error) + GetBySlug(context.Context, string) (*Image, *Response, error) + Create(context.Context, *CustomImageCreateRequest) (*Image, *Response, error) + Update(context.Context, int, *ImageUpdateRequest) (*Image, *Response, error) + Delete(context.Context, int) (*Response, error) +} + +// ImagesServiceOp handles communication with the image related methods of the +// DigitalOcean API. +type ImagesServiceOp struct { + client *Client +} + +var _ ImagesService = &ImagesServiceOp{} + +// Image represents a DigitalOcean Image +type Image struct { + ID int `json:"id,float64,omitempty"` + Name string `json:"name,omitempty"` + Type string `json:"type,omitempty"` + Distribution string `json:"distribution,omitempty"` + Slug string `json:"slug,omitempty"` + Public bool `json:"public,omitempty"` + Regions []string `json:"regions,omitempty"` + MinDiskSize int `json:"min_disk_size,omitempty"` + SizeGigaBytes float64 `json:"size_gigabytes,omitempty"` + Created string `json:"created_at,omitempty"` + Description string `json:"description,omitempty"` + Tags []string `json:"tags,omitempty"` + Status string `json:"status,omitempty"` + ErrorMessage string `json:"error_message,omitempty"` +} + +// ImageUpdateRequest represents a request to update an image. +type ImageUpdateRequest struct { + Name string `json:"name"` +} + +// CustomImageCreateRequest represents a request to create a custom image. +type CustomImageCreateRequest struct { + Name string `json:"name"` + Url string `json:"url"` + Region string `json:"region"` + Distribution string `json:"distribution,omitempty"` + Description string `json:"description,omitempty"` + Tags []string `json:"tags,omitempty"` +} + +type imageRoot struct { + Image *Image +} + +type imagesRoot struct { + Images []Image + Links *Links `json:"links"` +} + +type listImageOptions struct { + Private bool `url:"private,omitempty"` + Type string `url:"type,omitempty"` + Tag string `url:"tag_name,omitempty"` +} + +func (i Image) String() string { + return Stringify(i) +} + +// List lists all the images available. +func (s *ImagesServiceOp) List(ctx context.Context, opt *ListOptions) ([]Image, *Response, error) { + return s.list(ctx, opt, nil) +} + +// ListDistribution lists all the distribution images. +func (s *ImagesServiceOp) ListDistribution(ctx context.Context, opt *ListOptions) ([]Image, *Response, error) { + listOpt := listImageOptions{Type: "distribution"} + return s.list(ctx, opt, &listOpt) +} + +// ListApplication lists all the application images. +func (s *ImagesServiceOp) ListApplication(ctx context.Context, opt *ListOptions) ([]Image, *Response, error) { + listOpt := listImageOptions{Type: "application"} + return s.list(ctx, opt, &listOpt) +} + +// ListUser lists all the user images. +func (s *ImagesServiceOp) ListUser(ctx context.Context, opt *ListOptions) ([]Image, *Response, error) { + listOpt := listImageOptions{Private: true} + return s.list(ctx, opt, &listOpt) +} + +// ListByTag lists all images with a specific tag applied. +func (s *ImagesServiceOp) ListByTag(ctx context.Context, tag string, opt *ListOptions) ([]Image, *Response, error) { + listOpt := listImageOptions{Tag: tag} + return s.list(ctx, opt, &listOpt) +} + +// GetByID retrieves an image by id. +func (s *ImagesServiceOp) GetByID(ctx context.Context, imageID int) (*Image, *Response, error) { + if imageID < 1 { + return nil, nil, NewArgError("imageID", "cannot be less than 1") + } + + return s.get(ctx, interface{}(imageID)) +} + +// GetBySlug retrieves an image by slug. +func (s *ImagesServiceOp) GetBySlug(ctx context.Context, slug string) (*Image, *Response, error) { + if len(slug) < 1 { + return nil, nil, NewArgError("slug", "cannot be blank") + } + + return s.get(ctx, interface{}(slug)) +} + +func (s *ImagesServiceOp) Create(ctx context.Context, createRequest *CustomImageCreateRequest) (*Image, *Response, error) { + if createRequest == nil { + return nil, nil, NewArgError("createRequest", "cannot be nil") + } + + req, err := s.client.NewRequest(ctx, http.MethodPost, imageBasePath, createRequest) + if err != nil { + return nil, nil, err + } + + root := new(imageRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.Image, resp, err +} + +// Update an image name. +func (s *ImagesServiceOp) Update(ctx context.Context, imageID int, updateRequest *ImageUpdateRequest) (*Image, *Response, error) { + if imageID < 1 { + return nil, nil, NewArgError("imageID", "cannot be less than 1") + } + + if updateRequest == nil { + return nil, nil, NewArgError("updateRequest", "cannot be nil") + } + + path := fmt.Sprintf("%s/%d", imageBasePath, imageID) + req, err := s.client.NewRequest(ctx, http.MethodPut, path, updateRequest) + if err != nil { + return nil, nil, err + } + + root := new(imageRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.Image, resp, err +} + +// Delete an image. +func (s *ImagesServiceOp) Delete(ctx context.Context, imageID int) (*Response, error) { + if imageID < 1 { + return nil, NewArgError("imageID", "cannot be less than 1") + } + + path := fmt.Sprintf("%s/%d", imageBasePath, imageID) + + req, err := s.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + + return resp, err +} + +// Helper method for getting an individual image +func (s *ImagesServiceOp) get(ctx context.Context, ID interface{}) (*Image, *Response, error) { + path := fmt.Sprintf("%s/%v", imageBasePath, ID) + + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(imageRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.Image, resp, err +} + +// Helper method for listing images +func (s *ImagesServiceOp) list(ctx context.Context, opt *ListOptions, listOpt *listImageOptions) ([]Image, *Response, error) { + path := imageBasePath + path, err := addOptions(path, opt) + if err != nil { + return nil, nil, err + } + path, err = addOptions(path, listOpt) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(imagesRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + if l := root.Links; l != nil { + resp.Links = l + } + + return root.Images, resp, err +} diff --git a/vendor/github.com/digitalocean/godo/keys.go b/vendor/github.com/digitalocean/godo/keys.go new file mode 100644 index 000000000000..9695c21f48b1 --- /dev/null +++ b/vendor/github.com/digitalocean/godo/keys.go @@ -0,0 +1,226 @@ +package godo + +import ( + "context" + "fmt" + "net/http" +) + +const keysBasePath = "v2/account/keys" + +// KeysService is an interface for interfacing with the keys +// endpoints of the DigitalOcean API +// See: https://developers.digitalocean.com/documentation/v2#keys +type KeysService interface { + List(context.Context, *ListOptions) ([]Key, *Response, error) + GetByID(context.Context, int) (*Key, *Response, error) + GetByFingerprint(context.Context, string) (*Key, *Response, error) + Create(context.Context, *KeyCreateRequest) (*Key, *Response, error) + UpdateByID(context.Context, int, *KeyUpdateRequest) (*Key, *Response, error) + UpdateByFingerprint(context.Context, string, *KeyUpdateRequest) (*Key, *Response, error) + DeleteByID(context.Context, int) (*Response, error) + DeleteByFingerprint(context.Context, string) (*Response, error) +} + +// KeysServiceOp handles communication with key related method of the +// DigitalOcean API. +type KeysServiceOp struct { + client *Client +} + +var _ KeysService = &KeysServiceOp{} + +// Key represents a DigitalOcean Key. +type Key struct { + ID int `json:"id,float64,omitempty"` + Name string `json:"name,omitempty"` + Fingerprint string `json:"fingerprint,omitempty"` + PublicKey string `json:"public_key,omitempty"` +} + +// KeyUpdateRequest represents a request to update a DigitalOcean key. +type KeyUpdateRequest struct { + Name string `json:"name"` +} + +type keysRoot struct { + SSHKeys []Key `json:"ssh_keys"` + Links *Links `json:"links"` +} + +type keyRoot struct { + SSHKey *Key `json:"ssh_key"` +} + +func (s Key) String() string { + return Stringify(s) +} + +// KeyCreateRequest represents a request to create a new key. +type KeyCreateRequest struct { + Name string `json:"name"` + PublicKey string `json:"public_key"` +} + +// List all keys +func (s *KeysServiceOp) List(ctx context.Context, opt *ListOptions) ([]Key, *Response, error) { + path := keysBasePath + path, err := addOptions(path, opt) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(keysRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + if l := root.Links; l != nil { + resp.Links = l + } + + return root.SSHKeys, resp, err +} + +// Performs a get given a path +func (s *KeysServiceOp) get(ctx context.Context, path string) (*Key, *Response, error) { + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(keyRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.SSHKey, resp, err +} + +// GetByID gets a Key by id +func (s *KeysServiceOp) GetByID(ctx context.Context, keyID int) (*Key, *Response, error) { + if keyID < 1 { + return nil, nil, NewArgError("keyID", "cannot be less than 1") + } + + path := fmt.Sprintf("%s/%d", keysBasePath, keyID) + return s.get(ctx, path) +} + +// GetByFingerprint gets a Key by by fingerprint +func (s *KeysServiceOp) GetByFingerprint(ctx context.Context, fingerprint string) (*Key, *Response, error) { + if len(fingerprint) < 1 { + return nil, nil, NewArgError("fingerprint", "cannot not be empty") + } + + path := fmt.Sprintf("%s/%s", keysBasePath, fingerprint) + return s.get(ctx, path) +} + +// Create a key using a KeyCreateRequest +func (s *KeysServiceOp) Create(ctx context.Context, createRequest *KeyCreateRequest) (*Key, *Response, error) { + if createRequest == nil { + return nil, nil, NewArgError("createRequest", "cannot be nil") + } + + req, err := s.client.NewRequest(ctx, http.MethodPost, keysBasePath, createRequest) + if err != nil { + return nil, nil, err + } + + root := new(keyRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.SSHKey, resp, err +} + +// UpdateByID updates a key name by ID. +func (s *KeysServiceOp) UpdateByID(ctx context.Context, keyID int, updateRequest *KeyUpdateRequest) (*Key, *Response, error) { + if keyID < 1 { + return nil, nil, NewArgError("keyID", "cannot be less than 1") + } + + if updateRequest == nil { + return nil, nil, NewArgError("updateRequest", "cannot be nil") + } + + path := fmt.Sprintf("%s/%d", keysBasePath, keyID) + req, err := s.client.NewRequest(ctx, "PUT", path, updateRequest) + if err != nil { + return nil, nil, err + } + + root := new(keyRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.SSHKey, resp, err +} + +// UpdateByFingerprint updates a key name by fingerprint. +func (s *KeysServiceOp) UpdateByFingerprint(ctx context.Context, fingerprint string, updateRequest *KeyUpdateRequest) (*Key, *Response, error) { + if len(fingerprint) < 1 { + return nil, nil, NewArgError("fingerprint", "cannot be empty") + } + + if updateRequest == nil { + return nil, nil, NewArgError("updateRequest", "cannot be nil") + } + + path := fmt.Sprintf("%s/%s", keysBasePath, fingerprint) + req, err := s.client.NewRequest(ctx, "PUT", path, updateRequest) + if err != nil { + return nil, nil, err + } + + root := new(keyRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.SSHKey, resp, err +} + +// Delete key using a path +func (s *KeysServiceOp) delete(ctx context.Context, path string) (*Response, error) { + req, err := s.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + + return resp, err +} + +// DeleteByID deletes a key by its id +func (s *KeysServiceOp) DeleteByID(ctx context.Context, keyID int) (*Response, error) { + if keyID < 1 { + return nil, NewArgError("keyID", "cannot be less than 1") + } + + path := fmt.Sprintf("%s/%d", keysBasePath, keyID) + return s.delete(ctx, path) +} + +// DeleteByFingerprint deletes a key by its fingerprint +func (s *KeysServiceOp) DeleteByFingerprint(ctx context.Context, fingerprint string) (*Response, error) { + if len(fingerprint) < 1 { + return nil, NewArgError("fingerprint", "cannot be empty") + } + + path := fmt.Sprintf("%s/%s", keysBasePath, fingerprint) + return s.delete(ctx, path) +} diff --git a/vendor/github.com/digitalocean/godo/kubernetes.go b/vendor/github.com/digitalocean/godo/kubernetes.go new file mode 100644 index 000000000000..4466059cb19b --- /dev/null +++ b/vendor/github.com/digitalocean/godo/kubernetes.go @@ -0,0 +1,432 @@ +package godo + +import ( + "bytes" + "context" + "encoding" + "fmt" + "net/http" + "strings" + "time" +) + +const ( + kubernetesBasePath = "/v2/kubernetes" + kubernetesClustersPath = kubernetesBasePath + "/clusters" + kubernetesOptionsPath = kubernetesBasePath + "/options" +) + +// KubernetesService is an interface for interfacing with the kubernetes endpoints +// of the DigitalOcean API. +// See: https://developers.digitalocean.com/documentation/v2#kubernetes +type KubernetesService interface { + Create(context.Context, *KubernetesClusterCreateRequest) (*KubernetesCluster, *Response, error) + Get(context.Context, string) (*KubernetesCluster, *Response, error) + GetKubeConfig(context.Context, string) (*KubernetesClusterConfig, *Response, error) + List(context.Context, *ListOptions) ([]*KubernetesCluster, *Response, error) + Update(context.Context, string, *KubernetesClusterUpdateRequest) (*KubernetesCluster, *Response, error) + Delete(context.Context, string) (*Response, error) + + CreateNodePool(ctx context.Context, clusterID string, req *KubernetesNodePoolCreateRequest) (*KubernetesNodePool, *Response, error) + GetNodePool(ctx context.Context, clusterID, poolID string) (*KubernetesNodePool, *Response, error) + ListNodePools(ctx context.Context, clusterID string, opts *ListOptions) ([]*KubernetesNodePool, *Response, error) + UpdateNodePool(ctx context.Context, clusterID, poolID string, req *KubernetesNodePoolUpdateRequest) (*KubernetesNodePool, *Response, error) + RecycleNodePoolNodes(ctx context.Context, clusterID, poolID string, req *KubernetesNodePoolRecycleNodesRequest) (*Response, error) + DeleteNodePool(ctx context.Context, clusterID, poolID string) (*Response, error) + + GetOptions(context.Context) (*KubernetesOptions, *Response, error) +} + +var _ KubernetesService = &KubernetesServiceOp{} + +// KubernetesServiceOp handles communication with Kubernetes methods of the DigitalOcean API. +type KubernetesServiceOp struct { + client *Client +} + +// KubernetesClusterCreateRequest represents a request to create a Kubernetes cluster. +type KubernetesClusterCreateRequest struct { + Name string `json:"name,omitempty"` + RegionSlug string `json:"region,omitempty"` + VersionSlug string `json:"version,omitempty"` + Tags []string `json:"tags,omitempty"` + + NodePools []*KubernetesNodePoolCreateRequest `json:"node_pools,omitempty"` +} + +// KubernetesClusterUpdateRequest represents a request to update a Kubernetes cluster. +type KubernetesClusterUpdateRequest struct { + Name string `json:"name,omitempty"` + Tags []string `json:"tags,omitempty"` +} + +// KubernetesNodePoolCreateRequest represents a request to create a node pool for a +// Kubernetes cluster. +type KubernetesNodePoolCreateRequest struct { + Name string `json:"name,omitempty"` + Size string `json:"size,omitempty"` + Count int `json:"count,omitempty"` + Tags []string `json:"tags,omitempty"` +} + +// KubernetesNodePoolUpdateRequest represents a request to update a node pool in a +// Kubernetes cluster. +type KubernetesNodePoolUpdateRequest struct { + Name string `json:"name,omitempty"` + Count int `json:"count,omitempty"` + Tags []string `json:"tags,omitempty"` +} + +// KubernetesNodePoolRecycleNodesRequest represents a request to recycle a set of +// nodes in a node pool. This will recycle the nodes by ID. +type KubernetesNodePoolRecycleNodesRequest struct { + Nodes []string `json:"nodes,omitempty"` +} + +// KubernetesCluster represents a Kubernetes cluster. +type KubernetesCluster struct { + ID string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + RegionSlug string `json:"region,omitempty"` + VersionSlug string `json:"version,omitempty"` + ClusterSubnet string `json:"cluster_subnet,omitempty"` + ServiceSubnet string `json:"service_subnet,omitempty"` + IPv4 string `json:"ipv4,omitempty"` + Endpoint string `json:"endpoint,omitempty"` + Tags []string `json:"tags,omitempty"` + + NodePools []*KubernetesNodePool `json:"node_pools,omitempty"` + + Status *KubernetesClusterStatus `json:"status,omitempty"` + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` +} + +// Possible states for a cluster. +const ( + KubernetesClusterStatusProvisioning = KubernetesClusterStatusState("provisioning") + KubernetesClusterStatusRunning = KubernetesClusterStatusState("running") + KubernetesClusterStatusDegraded = KubernetesClusterStatusState("degraded") + KubernetesClusterStatusError = KubernetesClusterStatusState("error") + KubernetesClusterStatusDeleted = KubernetesClusterStatusState("deleted") + KubernetesClusterStatusInvalid = KubernetesClusterStatusState("invalid") +) + +// KubernetesClusterStatusState represents states for a cluster. +type KubernetesClusterStatusState string + +var _ encoding.TextUnmarshaler = (*KubernetesClusterStatusState)(nil) + +// UnmarshalText unmarshals the state. +func (s *KubernetesClusterStatusState) UnmarshalText(text []byte) error { + switch KubernetesClusterStatusState(strings.ToLower(string(text))) { + case KubernetesClusterStatusProvisioning: + *s = KubernetesClusterStatusProvisioning + case KubernetesClusterStatusRunning: + *s = KubernetesClusterStatusRunning + case KubernetesClusterStatusDegraded: + *s = KubernetesClusterStatusDegraded + case KubernetesClusterStatusError: + *s = KubernetesClusterStatusError + case KubernetesClusterStatusDeleted: + *s = KubernetesClusterStatusDeleted + case "", KubernetesClusterStatusInvalid: + *s = KubernetesClusterStatusInvalid + default: + return fmt.Errorf("unknown cluster state %q", string(text)) + } + return nil +} + +// KubernetesClusterStatus describes the status of a cluster. +type KubernetesClusterStatus struct { + State KubernetesClusterStatusState `json:"state,omitempty"` + Message string `json:"message,omitempty"` +} + +// KubernetesNodePool represents a node pool in a Kubernetes cluster. +type KubernetesNodePool struct { + ID string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + Size string `json:"size,omitempty"` + Count int `json:"count,omitempty"` + Tags []string `json:"tags,omitempty"` + + Nodes []*KubernetesNode `json:"nodes,omitempty"` +} + +// KubernetesNode represents a Node in a node pool in a Kubernetes cluster. +type KubernetesNode struct { + ID string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + Status *KubernetesNodeStatus `json:"status,omitempty"` + + CreatedAt time.Time `json:"created_at,omitempty"` + UpdatedAt time.Time `json:"updated_at,omitempty"` +} + +// KubernetesNodeStatus represents the status of a particular Node in a Kubernetes cluster. +type KubernetesNodeStatus struct { + State string `json:"state,omitempty"` + Message string `json:"message,omitempty"` +} + +// KubernetesOptions represents options available for creating Kubernetes clusters. +type KubernetesOptions struct { + Versions []*KubernetesVersion `json:"versions,omitempty"` + Regions []*KubernetesRegion `json:"regions,omitempty"` + Sizes []*KubernetesNodeSize `json:"sizes,omitempty"` +} + +// KubernetesVersion is a DigitalOcean Kubernetes release. +type KubernetesVersion struct { + Slug string `json:"slug,omitempty"` + KubernetesVersion string `json:"kubernetes_version,omitempty"` +} + +// KubernetesNodeSize is a node sizes supported for Kubernetes clusters. +type KubernetesNodeSize struct { + Name string `json:"name"` + Slug string `json:"slug"` +} + +// KubernetesRegion is a region usable by Kubernetes clusters. +type KubernetesRegion struct { + Name string `json:"name"` + Slug string `json:"slug"` +} + +type kubernetesClustersRoot struct { + Clusters []*KubernetesCluster `json:"kubernetes_clusters,omitempty"` + Links *Links `json:"links,omitempty"` +} + +type kubernetesClusterRoot struct { + Cluster *KubernetesCluster `json:"kubernetes_cluster,omitempty"` +} + +type kubernetesNodePoolRoot struct { + NodePool *KubernetesNodePool `json:"node_pool,omitempty"` +} + +type kubernetesNodePoolsRoot struct { + NodePools []*KubernetesNodePool `json:"node_pools,omitempty"` + Links *Links `json:"links,omitempty"` +} + +// Get retrieves the details of a Kubernetes cluster. +func (svc *KubernetesServiceOp) Get(ctx context.Context, clusterID string) (*KubernetesCluster, *Response, error) { + path := fmt.Sprintf("%s/%s", kubernetesClustersPath, clusterID) + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(kubernetesClusterRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Cluster, resp, nil +} + +// Create creates a Kubernetes cluster. +func (svc *KubernetesServiceOp) Create(ctx context.Context, create *KubernetesClusterCreateRequest) (*KubernetesCluster, *Response, error) { + path := kubernetesClustersPath + req, err := svc.client.NewRequest(ctx, http.MethodPost, path, create) + if err != nil { + return nil, nil, err + } + root := new(kubernetesClusterRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Cluster, resp, nil +} + +// Delete deletes a Kubernetes cluster. There is no way to recover a cluster +// once it has been destroyed. +func (svc *KubernetesServiceOp) Delete(ctx context.Context, clusterID string) (*Response, error) { + path := fmt.Sprintf("%s/%s", kubernetesClustersPath, clusterID) + req, err := svc.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + resp, err := svc.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// List returns a list of the Kubernetes clusters visible with the caller's API token. +func (svc *KubernetesServiceOp) List(ctx context.Context, opts *ListOptions) ([]*KubernetesCluster, *Response, error) { + path := kubernetesClustersPath + path, err := addOptions(path, opts) + if err != nil { + return nil, nil, err + } + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(kubernetesClustersRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Clusters, resp, nil +} + +// KubernetesClusterConfig is the content of a Kubernetes config file, which can be +// used to interact with your Kubernetes cluster using `kubectl`. +// See: https://kubernetes.io/docs/tasks/tools/install-kubectl/ +type KubernetesClusterConfig struct { + KubeconfigYAML []byte +} + +// GetKubeConfig returns a Kubernetes config file for the specified cluster. +func (svc *KubernetesServiceOp) GetKubeConfig(ctx context.Context, clusterID string) (*KubernetesClusterConfig, *Response, error) { + path := fmt.Sprintf("%s/%s/kubeconfig", kubernetesClustersPath, clusterID) + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + configBytes := bytes.NewBuffer(nil) + resp, err := svc.client.Do(ctx, req, configBytes) + if err != nil { + return nil, resp, err + } + res := &KubernetesClusterConfig{ + KubeconfigYAML: configBytes.Bytes(), + } + return res, resp, nil +} + +// Update updates a Kubernetes cluster's properties. +func (svc *KubernetesServiceOp) Update(ctx context.Context, clusterID string, update *KubernetesClusterUpdateRequest) (*KubernetesCluster, *Response, error) { + path := fmt.Sprintf("%s/%s", kubernetesClustersPath, clusterID) + req, err := svc.client.NewRequest(ctx, http.MethodPut, path, update) + if err != nil { + return nil, nil, err + } + root := new(kubernetesClusterRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Cluster, resp, nil +} + +// CreateNodePool creates a new node pool in an existing Kubernetes cluster. +func (svc *KubernetesServiceOp) CreateNodePool(ctx context.Context, clusterID string, create *KubernetesNodePoolCreateRequest) (*KubernetesNodePool, *Response, error) { + path := fmt.Sprintf("%s/%s/node_pools", kubernetesClustersPath, clusterID) + req, err := svc.client.NewRequest(ctx, http.MethodPost, path, create) + if err != nil { + return nil, nil, err + } + root := new(kubernetesNodePoolRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.NodePool, resp, nil +} + +// GetNodePool retrieves an existing node pool in a Kubernetes cluster. +func (svc *KubernetesServiceOp) GetNodePool(ctx context.Context, clusterID, poolID string) (*KubernetesNodePool, *Response, error) { + path := fmt.Sprintf("%s/%s/node_pools/%s", kubernetesClustersPath, clusterID, poolID) + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(kubernetesNodePoolRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.NodePool, resp, nil +} + +// ListNodePools lists all the node pools found in a Kubernetes cluster. +func (svc *KubernetesServiceOp) ListNodePools(ctx context.Context, clusterID string, opts *ListOptions) ([]*KubernetesNodePool, *Response, error) { + path := fmt.Sprintf("%s/%s/node_pools", kubernetesClustersPath, clusterID) + path, err := addOptions(path, opts) + if err != nil { + return nil, nil, err + } + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(kubernetesNodePoolsRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.NodePools, resp, nil +} + +// UpdateNodePool updates the details of an existing node pool. +func (svc *KubernetesServiceOp) UpdateNodePool(ctx context.Context, clusterID, poolID string, update *KubernetesNodePoolUpdateRequest) (*KubernetesNodePool, *Response, error) { + path := fmt.Sprintf("%s/%s/node_pools/%s", kubernetesClustersPath, clusterID, poolID) + req, err := svc.client.NewRequest(ctx, http.MethodPut, path, update) + if err != nil { + return nil, nil, err + } + root := new(kubernetesNodePoolRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.NodePool, resp, nil +} + +// RecycleNodePoolNodes schedules nodes in a node pool for recycling. +func (svc *KubernetesServiceOp) RecycleNodePoolNodes(ctx context.Context, clusterID, poolID string, recycle *KubernetesNodePoolRecycleNodesRequest) (*Response, error) { + path := fmt.Sprintf("%s/%s/node_pools/%s/recycle", kubernetesClustersPath, clusterID, poolID) + req, err := svc.client.NewRequest(ctx, http.MethodPost, path, recycle) + if err != nil { + return nil, err + } + resp, err := svc.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// DeleteNodePool deletes a node pool, and subsequently all the nodes in that pool. +func (svc *KubernetesServiceOp) DeleteNodePool(ctx context.Context, clusterID, poolID string) (*Response, error) { + path := fmt.Sprintf("%s/%s/node_pools/%s", kubernetesClustersPath, clusterID, poolID) + req, err := svc.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + resp, err := svc.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +type kubernetesOptionsRoot struct { + Options *KubernetesOptions `json:"options,omitempty"` + Links *Links `json:"links,omitempty"` +} + +// GetOptions returns options about the Kubernetes service, such as the versions available for +// cluster creation. +func (svc *KubernetesServiceOp) GetOptions(ctx context.Context) (*KubernetesOptions, *Response, error) { + path := kubernetesOptionsPath + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(kubernetesOptionsRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Options, resp, nil +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/links.go b/vendor/github.com/digitalocean/godo/links.go similarity index 97% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/links.go rename to vendor/github.com/digitalocean/godo/links.go index 0c611021011e..2098441729df 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/links.go +++ b/vendor/github.com/digitalocean/godo/links.go @@ -1,10 +1,9 @@ package godo import ( + "context" "net/url" "strconv" - - "github.com/digitalocean/godo/context" ) // Links manages links that are returned along with a List diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/load_balancers.go b/vendor/github.com/digitalocean/godo/load_balancers.go similarity index 87% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/load_balancers.go rename to vendor/github.com/digitalocean/godo/load_balancers.go index b4b5300b3fc3..7bac255c764d 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/load_balancers.go +++ b/vendor/github.com/digitalocean/godo/load_balancers.go @@ -1,10 +1,9 @@ package godo import ( + "context" "fmt" "net/http" - - "github.com/digitalocean/godo/context" ) const loadBalancersBasePath = "/v2/load_balancers" @@ -27,6 +26,7 @@ type LoadBalancersService interface { } // LoadBalancer represents a DigitalOcean load balancer configuration. +// Tags can only be provided upon the creation of a Load Balancer. type LoadBalancer struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` @@ -40,7 +40,9 @@ type LoadBalancer struct { Region *Region `json:"region,omitempty"` DropletIDs []int `json:"droplet_ids,omitempty"` Tag string `json:"tag,omitempty"` + Tags []string `json:"tags,omitempty"` RedirectHttpToHttps bool `json:"redirect_http_to_https,omitempty"` + EnableProxyProtocol bool `json:"enable_proxy_protocol,omitempty"` } // String creates a human-readable description of a LoadBalancer. @@ -48,6 +50,38 @@ func (l LoadBalancer) String() string { return Stringify(l) } +func (l LoadBalancer) URN() string { + return ToURN("LoadBalancer", l.ID) +} + +// AsRequest creates a LoadBalancerRequest that can be submitted to Update with the current values of the LoadBalancer. +// Modifying the returned LoadBalancerRequest will not modify the original LoadBalancer. +func (l LoadBalancer) AsRequest() *LoadBalancerRequest { + r := LoadBalancerRequest{ + Name: l.Name, + Algorithm: l.Algorithm, + ForwardingRules: append([]ForwardingRule(nil), l.ForwardingRules...), + DropletIDs: append([]int(nil), l.DropletIDs...), + Tag: l.Tag, + RedirectHttpToHttps: l.RedirectHttpToHttps, + EnableProxyProtocol: l.EnableProxyProtocol, + HealthCheck: l.HealthCheck, + } + + if l.HealthCheck != nil { + r.HealthCheck = &HealthCheck{} + *r.HealthCheck = *l.HealthCheck + } + if l.StickySessions != nil { + r.StickySessions = &StickySessions{} + *r.StickySessions = *l.StickySessions + } + if l.Region != nil { + r.Region = l.Region.Slug + } + return &r +} + // ForwardingRule represents load balancer forwarding rules. type ForwardingRule struct { EntryProtocol string `json:"entry_protocol,omitempty"` @@ -101,7 +135,9 @@ type LoadBalancerRequest struct { StickySessions *StickySessions `json:"sticky_sessions,omitempty"` DropletIDs []int `json:"droplet_ids,omitempty"` Tag string `json:"tag,omitempty"` + Tags []string `json:"tags,omitempty"` RedirectHttpToHttps bool `json:"redirect_http_to_https,omitempty"` + EnableProxyProtocol bool `json:"enable_proxy_protocol,omitempty"` } // String creates a human-readable description of a LoadBalancerRequest. diff --git a/vendor/github.com/digitalocean/godo/projects.go b/vendor/github.com/digitalocean/godo/projects.go new file mode 100644 index 000000000000..f78308cfe3a5 --- /dev/null +++ b/vendor/github.com/digitalocean/godo/projects.go @@ -0,0 +1,302 @@ +package godo + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "path" +) + +const ( + // DefaultProject is the ID you should use if you are working with your + // default project. + DefaultProject = "default" + + projectsBasePath = "/v2/projects" +) + +// ProjectsService is an interface for creating and managing Projects with the DigitalOcean API. +// See: https://developers.digitalocean.com/documentation/documentation/v2/#projects +type ProjectsService interface { + List(context.Context, *ListOptions) ([]Project, *Response, error) + GetDefault(context.Context) (*Project, *Response, error) + Get(context.Context, string) (*Project, *Response, error) + Create(context.Context, *CreateProjectRequest) (*Project, *Response, error) + Update(context.Context, string, *UpdateProjectRequest) (*Project, *Response, error) + Delete(context.Context, string) (*Response, error) + + ListResources(context.Context, string, *ListOptions) ([]ProjectResource, *Response, error) + AssignResources(context.Context, string, ...interface{}) ([]ProjectResource, *Response, error) +} + +// ProjectsServiceOp handles communication with Projects methods of the DigitalOcean API. +type ProjectsServiceOp struct { + client *Client +} + +// Project represents a DigitalOcean Project configuration. +type Project struct { + ID string `json:"id"` + OwnerUUID string `json:"owner_uuid"` + OwnerID uint64 `json:"owner_id"` + Name string `json:"name"` + Description string `json:"description"` + Purpose string `json:"purpose"` + Environment string `json:"environment"` + IsDefault bool `json:"is_default"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` +} + +// String creates a human-readable description of a Project. +func (p Project) String() string { + return Stringify(p) +} + +// CreateProjectRequest represents the request to create a new project. +type CreateProjectRequest struct { + Name string `json:"name"` + Description string `json:"description"` + Purpose string `json:"purpose"` + Environment string `json:"environment"` +} + +// UpdateProjectRequest represents the request to update project information. +// This type expects certain attribute types, but is built this way to allow +// nil values as well. See `updateProjectRequest` for the "real" types. +type UpdateProjectRequest struct { + Name interface{} + Description interface{} + Purpose interface{} + Environment interface{} + IsDefault interface{} +} + +type updateProjectRequest struct { + Name *string `json:"name"` + Description *string `json:"description"` + Purpose *string `json:"purpose"` + Environment *string `json:"environment"` + IsDefault *bool `json:"is_default"` +} + +// MarshalJSON takes an UpdateRequest and converts it to the "typed" request +// which is sent to the projects API. This is a PATCH request, which allows +// partial attributes, so `null` values are OK. +func (upr *UpdateProjectRequest) MarshalJSON() ([]byte, error) { + d := &updateProjectRequest{} + if str, ok := upr.Name.(string); ok { + d.Name = &str + } + if str, ok := upr.Description.(string); ok { + d.Description = &str + } + if str, ok := upr.Purpose.(string); ok { + d.Purpose = &str + } + if str, ok := upr.Environment.(string); ok { + d.Environment = &str + } + if val, ok := upr.IsDefault.(bool); ok { + d.IsDefault = &val + } + + return json.Marshal(d) +} + +type assignResourcesRequest struct { + Resources []string `json:"resources"` +} + +// ProjectResource is the projects API's representation of a resource. +type ProjectResource struct { + URN string `json:"urn"` + AssignedAt string `json:"assigned_at"` + Links *ProjectResourceLinks `json:"links"` + Status string `json:"status,omitempty"` +} + +// ProjetResourceLinks specify the link for more information about the resource. +type ProjectResourceLinks struct { + Self string `json:"self"` +} + +type projectsRoot struct { + Projects []Project `json:"projects"` + Links *Links `json:"links"` +} + +type projectRoot struct { + Project *Project `json:"project"` +} + +type projectResourcesRoot struct { + Resources []ProjectResource `json:"resources"` + Links *Links `json:"links,omitempty"` +} + +var _ ProjectsService = &ProjectsServiceOp{} + +// List Projects. +func (p *ProjectsServiceOp) List(ctx context.Context, opts *ListOptions) ([]Project, *Response, error) { + path, err := addOptions(projectsBasePath, opts) + if err != nil { + return nil, nil, err + } + + req, err := p.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(projectsRoot) + resp, err := p.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + if l := root.Links; l != nil { + resp.Links = l + } + + return root.Projects, resp, err +} + +// GetDefault project. +func (p *ProjectsServiceOp) GetDefault(ctx context.Context) (*Project, *Response, error) { + return p.getHelper(ctx, "default") +} + +// Get retrieves a single project by its ID. +func (p *ProjectsServiceOp) Get(ctx context.Context, projectID string) (*Project, *Response, error) { + return p.getHelper(ctx, projectID) +} + +// Create a new project. +func (p *ProjectsServiceOp) Create(ctx context.Context, cr *CreateProjectRequest) (*Project, *Response, error) { + req, err := p.client.NewRequest(ctx, http.MethodPost, projectsBasePath, cr) + if err != nil { + return nil, nil, err + } + + root := new(projectRoot) + resp, err := p.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.Project, resp, err +} + +// Update an existing project. +func (p *ProjectsServiceOp) Update(ctx context.Context, projectID string, ur *UpdateProjectRequest) (*Project, *Response, error) { + path := path.Join(projectsBasePath, projectID) + req, err := p.client.NewRequest(ctx, http.MethodPatch, path, ur) + if err != nil { + return nil, nil, err + } + + root := new(projectRoot) + resp, err := p.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.Project, resp, err +} + +// Delete an existing project. You cannot have any resources in a project +// before deleting it. See the API documentation for more details. +func (p *ProjectsServiceOp) Delete(ctx context.Context, projectID string) (*Response, error) { + path := path.Join(projectsBasePath, projectID) + req, err := p.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + + return p.client.Do(ctx, req, nil) +} + +// ListResources lists all resources in a project. +func (p *ProjectsServiceOp) ListResources(ctx context.Context, projectID string, opts *ListOptions) ([]ProjectResource, *Response, error) { + basePath := path.Join(projectsBasePath, projectID, "resources") + path, err := addOptions(basePath, opts) + if err != nil { + return nil, nil, err + } + + req, err := p.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(projectResourcesRoot) + resp, err := p.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + if l := root.Links; l != nil { + resp.Links = l + } + + return root.Resources, resp, err +} + +// AssignResources assigns one or more resources to a project. AssignResources +// accepts resources in two possible formats: + +// 1. The resource type, like `&Droplet{ID: 1}` or `&FloatingIP{IP: "1.2.3.4"}` +// 2. A valid DO URN as a string, like "do:droplet:1234" +// +// There is no unassign. To move a resource to another project, just assign +// it to that other project. +func (p *ProjectsServiceOp) AssignResources(ctx context.Context, projectID string, resources ...interface{}) ([]ProjectResource, *Response, error) { + path := path.Join(projectsBasePath, projectID, "resources") + + ar := &assignResourcesRequest{ + Resources: make([]string, len(resources)), + } + + for i, resource := range resources { + switch resource := resource.(type) { + case ResourceWithURN: + ar.Resources[i] = resource.URN() + case string: + ar.Resources[i] = resource + default: + return nil, nil, fmt.Errorf("%T must either be a string or have a valid URN method", resource) + } + } + req, err := p.client.NewRequest(ctx, http.MethodPost, path, ar) + if err != nil { + return nil, nil, err + } + + root := new(projectResourcesRoot) + resp, err := p.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + if l := root.Links; l != nil { + resp.Links = l + } + + return root.Resources, resp, err +} + +func (p *ProjectsServiceOp) getHelper(ctx context.Context, projectID string) (*Project, *Response, error) { + path := path.Join(projectsBasePath, projectID) + + req, err := p.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(projectRoot) + resp, err := p.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.Project, resp, err +} diff --git a/vendor/github.com/digitalocean/godo/regions.go b/vendor/github.com/digitalocean/godo/regions.go new file mode 100644 index 000000000000..409959d951df --- /dev/null +++ b/vendor/github.com/digitalocean/godo/regions.go @@ -0,0 +1,64 @@ +package godo + +import ( + "context" + "net/http" +) + +// RegionsService is an interface for interfacing with the regions +// endpoints of the DigitalOcean API +// See: https://developers.digitalocean.com/documentation/v2#regions +type RegionsService interface { + List(context.Context, *ListOptions) ([]Region, *Response, error) +} + +// RegionsServiceOp handles communication with the region related methods of the +// DigitalOcean API. +type RegionsServiceOp struct { + client *Client +} + +var _ RegionsService = &RegionsServiceOp{} + +// Region represents a DigitalOcean Region +type Region struct { + Slug string `json:"slug,omitempty"` + Name string `json:"name,omitempty"` + Sizes []string `json:"sizes,omitempty"` + Available bool `json:"available,omitempty"` + Features []string `json:"features,omitempty"` +} + +type regionsRoot struct { + Regions []Region + Links *Links `json:"links"` +} + +func (r Region) String() string { + return Stringify(r) +} + +// List all regions +func (s *RegionsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Region, *Response, error) { + path := "v2/regions" + path, err := addOptions(path, opt) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(regionsRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + if l := root.Links; l != nil { + resp.Links = l + } + + return root.Regions, resp, err +} diff --git a/vendor/github.com/digitalocean/godo/sizes.go b/vendor/github.com/digitalocean/godo/sizes.go new file mode 100644 index 000000000000..da8207c08919 --- /dev/null +++ b/vendor/github.com/digitalocean/godo/sizes.go @@ -0,0 +1,68 @@ +package godo + +import ( + "context" + "net/http" +) + +// SizesService is an interface for interfacing with the size +// endpoints of the DigitalOcean API +// See: https://developers.digitalocean.com/documentation/v2#sizes +type SizesService interface { + List(context.Context, *ListOptions) ([]Size, *Response, error) +} + +// SizesServiceOp handles communication with the size related methods of the +// DigitalOcean API. +type SizesServiceOp struct { + client *Client +} + +var _ SizesService = &SizesServiceOp{} + +// Size represents a DigitalOcean Size +type Size struct { + Slug string `json:"slug,omitempty"` + Memory int `json:"memory,omitempty"` + Vcpus int `json:"vcpus,omitempty"` + Disk int `json:"disk,omitempty"` + PriceMonthly float64 `json:"price_monthly,omitempty"` + PriceHourly float64 `json:"price_hourly,omitempty"` + Regions []string `json:"regions,omitempty"` + Available bool `json:"available,omitempty"` + Transfer float64 `json:"transfer,omitempty"` +} + +func (s Size) String() string { + return Stringify(s) +} + +type sizesRoot struct { + Sizes []Size + Links *Links `json:"links"` +} + +// List all images +func (s *SizesServiceOp) List(ctx context.Context, opt *ListOptions) ([]Size, *Response, error) { + path := "v2/sizes" + path, err := addOptions(path, opt) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(sizesRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + if l := root.Links; l != nil { + resp.Links = l + } + + return root.Sizes, resp, err +} diff --git a/vendor/github.com/digitalocean/godo/snapshots.go b/vendor/github.com/digitalocean/godo/snapshots.go new file mode 100644 index 000000000000..181188db2c4e --- /dev/null +++ b/vendor/github.com/digitalocean/godo/snapshots.go @@ -0,0 +1,140 @@ +package godo + +import ( + "context" + "fmt" + "net/http" +) + +const snapshotBasePath = "v2/snapshots" + +// SnapshotsService is an interface for interfacing with the snapshots +// endpoints of the DigitalOcean API +// See: https://developers.digitalocean.com/documentation/v2#snapshots +type SnapshotsService interface { + List(context.Context, *ListOptions) ([]Snapshot, *Response, error) + ListVolume(context.Context, *ListOptions) ([]Snapshot, *Response, error) + ListDroplet(context.Context, *ListOptions) ([]Snapshot, *Response, error) + Get(context.Context, string) (*Snapshot, *Response, error) + Delete(context.Context, string) (*Response, error) +} + +// SnapshotsServiceOp handles communication with the snapshot related methods of the +// DigitalOcean API. +type SnapshotsServiceOp struct { + client *Client +} + +var _ SnapshotsService = &SnapshotsServiceOp{} + +// Snapshot represents a DigitalOcean Snapshot +type Snapshot struct { + ID string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + ResourceID string `json:"resource_id,omitempty"` + ResourceType string `json:"resource_type,omitempty"` + Regions []string `json:"regions,omitempty"` + MinDiskSize int `json:"min_disk_size,omitempty"` + SizeGigaBytes float64 `json:"size_gigabytes,omitempty"` + Created string `json:"created_at,omitempty"` +} + +type snapshotRoot struct { + Snapshot *Snapshot `json:"snapshot"` +} + +type snapshotsRoot struct { + Snapshots []Snapshot `json:"snapshots"` + Links *Links `json:"links,omitempty"` +} + +type listSnapshotOptions struct { + ResourceType string `url:"resource_type,omitempty"` +} + +func (s Snapshot) String() string { + return Stringify(s) +} + +// List lists all the snapshots available. +func (s *SnapshotsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Snapshot, *Response, error) { + return s.list(ctx, opt, nil) +} + +// ListDroplet lists all the Droplet snapshots. +func (s *SnapshotsServiceOp) ListDroplet(ctx context.Context, opt *ListOptions) ([]Snapshot, *Response, error) { + listOpt := listSnapshotOptions{ResourceType: "droplet"} + return s.list(ctx, opt, &listOpt) +} + +// ListVolume lists all the volume snapshots. +func (s *SnapshotsServiceOp) ListVolume(ctx context.Context, opt *ListOptions) ([]Snapshot, *Response, error) { + listOpt := listSnapshotOptions{ResourceType: "volume"} + return s.list(ctx, opt, &listOpt) +} + +// Get retrieves an snapshot by id. +func (s *SnapshotsServiceOp) Get(ctx context.Context, snapshotID string) (*Snapshot, *Response, error) { + return s.get(ctx, snapshotID) +} + +// Delete an snapshot. +func (s *SnapshotsServiceOp) Delete(ctx context.Context, snapshotID string) (*Response, error) { + path := fmt.Sprintf("%s/%s", snapshotBasePath, snapshotID) + + req, err := s.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + + return resp, err +} + +// Helper method for getting an individual snapshot +func (s *SnapshotsServiceOp) get(ctx context.Context, ID string) (*Snapshot, *Response, error) { + path := fmt.Sprintf("%s/%s", snapshotBasePath, ID) + + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(snapshotRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.Snapshot, resp, err +} + +// Helper method for listing snapshots +func (s *SnapshotsServiceOp) list(ctx context.Context, opt *ListOptions, listOpt *listSnapshotOptions) ([]Snapshot, *Response, error) { + path := snapshotBasePath + path, err := addOptions(path, opt) + if err != nil { + return nil, nil, err + } + path, err = addOptions(path, listOpt) + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(snapshotsRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + if l := root.Links; l != nil { + resp.Links = l + } + + return root.Snapshots, resp, err +} diff --git a/vendor/github.com/digitalocean/godo/storage.go b/vendor/github.com/digitalocean/godo/storage.go new file mode 100644 index 000000000000..88fd8a401662 --- /dev/null +++ b/vendor/github.com/digitalocean/godo/storage.go @@ -0,0 +1,253 @@ +package godo + +import ( + "context" + "fmt" + "net/http" + "time" +) + +const ( + storageBasePath = "v2" + storageAllocPath = storageBasePath + "/volumes" + storageSnapPath = storageBasePath + "/snapshots" +) + +// StorageService is an interface for interfacing with the storage +// endpoints of the Digital Ocean API. +// See: https://developers.digitalocean.com/documentation/v2#storage +type StorageService interface { + ListVolumes(context.Context, *ListVolumeParams) ([]Volume, *Response, error) + GetVolume(context.Context, string) (*Volume, *Response, error) + CreateVolume(context.Context, *VolumeCreateRequest) (*Volume, *Response, error) + DeleteVolume(context.Context, string) (*Response, error) + ListSnapshots(ctx context.Context, volumeID string, opts *ListOptions) ([]Snapshot, *Response, error) + GetSnapshot(context.Context, string) (*Snapshot, *Response, error) + CreateSnapshot(context.Context, *SnapshotCreateRequest) (*Snapshot, *Response, error) + DeleteSnapshot(context.Context, string) (*Response, error) +} + +// StorageServiceOp handles communication with the storage volumes related methods of the +// DigitalOcean API. +type StorageServiceOp struct { + client *Client +} + +// ListVolumeParams stores the options you can set for a ListVolumeCall +type ListVolumeParams struct { + Region string `json:"region"` + Name string `json:"name"` + ListOptions *ListOptions `json:"list_options,omitempty"` +} + +var _ StorageService = &StorageServiceOp{} + +// Volume represents a Digital Ocean block store volume. +type Volume struct { + ID string `json:"id"` + Region *Region `json:"region"` + Name string `json:"name"` + SizeGigaBytes int64 `json:"size_gigabytes"` + Description string `json:"description"` + DropletIDs []int `json:"droplet_ids"` + CreatedAt time.Time `json:"created_at"` + FilesystemType string `json:"filesystem_type"` + FilesystemLabel string `json:"filesystem_label"` + Tags []string `json:"tags"` +} + +func (f Volume) String() string { + return Stringify(f) +} + +func (f Volume) URN() string { + return ToURN("Volume", f.ID) +} + +type storageVolumesRoot struct { + Volumes []Volume `json:"volumes"` + Links *Links `json:"links"` +} + +type storageVolumeRoot struct { + Volume *Volume `json:"volume"` + Links *Links `json:"links,omitempty"` +} + +// VolumeCreateRequest represents a request to create a block store +// volume. +type VolumeCreateRequest struct { + Region string `json:"region"` + Name string `json:"name"` + Description string `json:"description"` + SizeGigaBytes int64 `json:"size_gigabytes"` + SnapshotID string `json:"snapshot_id"` + FilesystemType string `json:"filesystem_type"` + FilesystemLabel string `json:"filesystem_label"` + Tags []string `json:"tags"` +} + +// ListVolumes lists all storage volumes. +func (svc *StorageServiceOp) ListVolumes(ctx context.Context, params *ListVolumeParams) ([]Volume, *Response, error) { + path := storageAllocPath + if params != nil { + if params.Region != "" && params.Name != "" { + path = fmt.Sprintf("%s?name=%s®ion=%s", path, params.Name, params.Region) + } else if params.Region != "" { + path = fmt.Sprintf("%s?region=%s", path, params.Region) + } else if params.Name != "" { + path = fmt.Sprintf("%s?name=%s", path, params.Name) + } + + if params.ListOptions != nil { + var err error + path, err = addOptions(path, params.ListOptions) + if err != nil { + return nil, nil, err + } + } + } + + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(storageVolumesRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + if l := root.Links; l != nil { + resp.Links = l + } + + return root.Volumes, resp, nil +} + +// CreateVolume creates a storage volume. The name must be unique. +func (svc *StorageServiceOp) CreateVolume(ctx context.Context, createRequest *VolumeCreateRequest) (*Volume, *Response, error) { + path := storageAllocPath + + req, err := svc.client.NewRequest(ctx, http.MethodPost, path, createRequest) + if err != nil { + return nil, nil, err + } + + root := new(storageVolumeRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Volume, resp, nil +} + +// GetVolume retrieves an individual storage volume. +func (svc *StorageServiceOp) GetVolume(ctx context.Context, id string) (*Volume, *Response, error) { + path := fmt.Sprintf("%s/%s", storageAllocPath, id) + + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(storageVolumeRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.Volume, resp, nil +} + +// DeleteVolume deletes a storage volume. +func (svc *StorageServiceOp) DeleteVolume(ctx context.Context, id string) (*Response, error) { + path := fmt.Sprintf("%s/%s", storageAllocPath, id) + + req, err := svc.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + return svc.client.Do(ctx, req, nil) +} + +// SnapshotCreateRequest represents a request to create a block store +// volume. +type SnapshotCreateRequest struct { + VolumeID string `json:"volume_id"` + Name string `json:"name"` + Description string `json:"description"` +} + +// ListSnapshots lists all snapshots related to a storage volume. +func (svc *StorageServiceOp) ListSnapshots(ctx context.Context, volumeID string, opt *ListOptions) ([]Snapshot, *Response, error) { + path := fmt.Sprintf("%s/%s/snapshots", storageAllocPath, volumeID) + path, err := addOptions(path, opt) + if err != nil { + return nil, nil, err + } + + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(snapshotsRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + if l := root.Links; l != nil { + resp.Links = l + } + + return root.Snapshots, resp, nil +} + +// CreateSnapshot creates a snapshot of a storage volume. +func (svc *StorageServiceOp) CreateSnapshot(ctx context.Context, createRequest *SnapshotCreateRequest) (*Snapshot, *Response, error) { + path := fmt.Sprintf("%s/%s/snapshots", storageAllocPath, createRequest.VolumeID) + + req, err := svc.client.NewRequest(ctx, http.MethodPost, path, createRequest) + if err != nil { + return nil, nil, err + } + + root := new(snapshotRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Snapshot, resp, nil +} + +// GetSnapshot retrieves an individual snapshot. +func (svc *StorageServiceOp) GetSnapshot(ctx context.Context, id string) (*Snapshot, *Response, error) { + path := fmt.Sprintf("%s/%s", storageSnapPath, id) + + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(snapshotRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.Snapshot, resp, nil +} + +// DeleteSnapshot deletes a snapshot. +func (svc *StorageServiceOp) DeleteSnapshot(ctx context.Context, id string) (*Response, error) { + path := fmt.Sprintf("%s/%s", storageSnapPath, id) + + req, err := svc.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + return svc.client.Do(ctx, req, nil) +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/storage_actions.go b/vendor/github.com/digitalocean/godo/storage_actions.go similarity index 99% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/storage_actions.go rename to vendor/github.com/digitalocean/godo/storage_actions.go index fe916ac852c6..9488975681c8 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/storage_actions.go +++ b/vendor/github.com/digitalocean/godo/storage_actions.go @@ -1,10 +1,9 @@ package godo import ( + "context" "fmt" "net/http" - - "github.com/digitalocean/godo/context" ) // StorageActionsService is an interface for interfacing with the diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/strings.go b/vendor/github.com/digitalocean/godo/strings.go similarity index 87% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/strings.go rename to vendor/github.com/digitalocean/godo/strings.go index 4a8bfb636c8b..4d5c0ad22079 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/strings.go +++ b/vendor/github.com/digitalocean/godo/strings.go @@ -5,10 +5,20 @@ import ( "fmt" "io" "reflect" + "strings" ) var timestampType = reflect.TypeOf(Timestamp{}) +type ResourceWithURN interface { + URN() string +} + +// ToURN converts the resource type and ID to a valid DO API URN. +func ToURN(resourceType string, id interface{}) string { + return fmt.Sprintf("%s:%s:%v", "do", strings.ToLower(resourceType), id) +} + // Stringify attempts to create a string representation of DigitalOcean types func Stringify(message interface{}) string { var buf bytes.Buffer diff --git a/vendor/github.com/digitalocean/godo/tags.go b/vendor/github.com/digitalocean/godo/tags.go new file mode 100644 index 000000000000..295a2e9778e8 --- /dev/null +++ b/vendor/github.com/digitalocean/godo/tags.go @@ -0,0 +1,231 @@ +package godo + +import ( + "context" + "fmt" + "net/http" +) + +const tagsBasePath = "v2/tags" + +// TagsService is an interface for interfacing with the tags +// endpoints of the DigitalOcean API +// See: https://developers.digitalocean.com/documentation/v2#tags +type TagsService interface { + List(context.Context, *ListOptions) ([]Tag, *Response, error) + Get(context.Context, string) (*Tag, *Response, error) + Create(context.Context, *TagCreateRequest) (*Tag, *Response, error) + Delete(context.Context, string) (*Response, error) + + TagResources(context.Context, string, *TagResourcesRequest) (*Response, error) + UntagResources(context.Context, string, *UntagResourcesRequest) (*Response, error) +} + +// TagsServiceOp handles communication with tag related method of the +// DigitalOcean API. +type TagsServiceOp struct { + client *Client +} + +var _ TagsService = &TagsServiceOp{} + +// ResourceType represents a class of resource, currently only droplet are supported +type ResourceType string + +const ( + //DropletResourceType holds the string representing our ResourceType of Droplet. + DropletResourceType ResourceType = "droplet" + //ImageResourceType holds the string representing our ResourceType of Image. + ImageResourceType ResourceType = "image" + //VolumeResourceType holds the string representing our ResourceType of Volume. + VolumeResourceType ResourceType = "volume" + //LoadBalancerResourceType holds the string representing our ResourceType of LoadBalancer. + LoadBalancerResourceType ResourceType = "load_balancer" +) + +// Resource represent a single resource for associating/disassociating with tags +type Resource struct { + ID string `json:"resource_id,omit_empty"` + Type ResourceType `json:"resource_type,omit_empty"` +} + +// TaggedResources represent the set of resources a tag is attached to +type TaggedResources struct { + Count int `json:"count"` + LastTaggedURI string `json:"last_tagged_uri,omitempty"` + Droplets *TaggedDropletsResources `json:"droplets,omitempty"` + Images *TaggedImagesResources `json:"images"` + Volumes *TaggedVolumesResources `json:"volumes"` +} + +// TaggedDropletsResources represent the droplet resources a tag is attached to +type TaggedDropletsResources struct { + Count int `json:"count,float64,omitempty"` + LastTagged *Droplet `json:"last_tagged,omitempty"` + LastTaggedURI string `json:"last_tagged_uri,omitempty"` +} + +// TaggedResourcesData represent the generic resources a tag is attached to +type TaggedResourcesData struct { + Count int `json:"count,float64,omitempty"` + LastTaggedURI string `json:"last_tagged_uri,omitempty"` +} + +// TaggedImagesResources represent the image resources a tag is attached to +type TaggedImagesResources TaggedResourcesData + +// TaggedVolumesResources represent the volume resources a tag is attached to +type TaggedVolumesResources TaggedResourcesData + +// Tag represent DigitalOcean tag +type Tag struct { + Name string `json:"name,omitempty"` + Resources *TaggedResources `json:"resources,omitempty"` +} + +//TagCreateRequest represents the JSON structure of a request of that type. +type TagCreateRequest struct { + Name string `json:"name"` +} + +// TagResourcesRequest represents the JSON structure of a request of that type. +type TagResourcesRequest struct { + Resources []Resource `json:"resources"` +} + +// UntagResourcesRequest represents the JSON structure of a request of that type. +type UntagResourcesRequest struct { + Resources []Resource `json:"resources"` +} + +type tagsRoot struct { + Tags []Tag `json:"tags"` + Links *Links `json:"links"` +} + +type tagRoot struct { + Tag *Tag `json:"tag"` +} + +// List all tags +func (s *TagsServiceOp) List(ctx context.Context, opt *ListOptions) ([]Tag, *Response, error) { + path := tagsBasePath + path, err := addOptions(path, opt) + + if err != nil { + return nil, nil, err + } + + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(tagsRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + if l := root.Links; l != nil { + resp.Links = l + } + + return root.Tags, resp, err +} + +// Get a single tag +func (s *TagsServiceOp) Get(ctx context.Context, name string) (*Tag, *Response, error) { + path := fmt.Sprintf("%s/%s", tagsBasePath, name) + + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(tagRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.Tag, resp, err +} + +// Create a new tag +func (s *TagsServiceOp) Create(ctx context.Context, createRequest *TagCreateRequest) (*Tag, *Response, error) { + if createRequest == nil { + return nil, nil, NewArgError("createRequest", "cannot be nil") + } + + req, err := s.client.NewRequest(ctx, http.MethodPost, tagsBasePath, createRequest) + if err != nil { + return nil, nil, err + } + + root := new(tagRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.Tag, resp, err +} + +// Delete an existing tag +func (s *TagsServiceOp) Delete(ctx context.Context, name string) (*Response, error) { + if name == "" { + return nil, NewArgError("name", "cannot be empty") + } + + path := fmt.Sprintf("%s/%s", tagsBasePath, name) + req, err := s.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + + return resp, err +} + +// TagResources associates resources with a given Tag. +func (s *TagsServiceOp) TagResources(ctx context.Context, name string, tagRequest *TagResourcesRequest) (*Response, error) { + if name == "" { + return nil, NewArgError("name", "cannot be empty") + } + + if tagRequest == nil { + return nil, NewArgError("tagRequest", "cannot be nil") + } + + path := fmt.Sprintf("%s/%s/resources", tagsBasePath, name) + req, err := s.client.NewRequest(ctx, http.MethodPost, path, tagRequest) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + + return resp, err +} + +// UntagResources dissociates resources with a given Tag. +func (s *TagsServiceOp) UntagResources(ctx context.Context, name string, untagRequest *UntagResourcesRequest) (*Response, error) { + if name == "" { + return nil, NewArgError("name", "cannot be empty") + } + + if untagRequest == nil { + return nil, NewArgError("tagRequest", "cannot be nil") + } + + path := fmt.Sprintf("%s/%s/resources", tagsBasePath, name) + req, err := s.client.NewRequest(ctx, http.MethodDelete, path, untagRequest) + if err != nil { + return nil, err + } + + resp, err := s.client.Do(ctx, req, nil) + + return resp, err +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/timestamp.go b/vendor/github.com/digitalocean/godo/timestamp.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/digitalocean/godo/timestamp.go rename to vendor/github.com/digitalocean/godo/timestamp.go diff --git a/vendor/github.com/dimchansky/utfbom/.gitignore b/vendor/github.com/dimchansky/utfbom/.gitignore new file mode 100644 index 000000000000..d7ec5cebb98d --- /dev/null +++ b/vendor/github.com/dimchansky/utfbom/.gitignore @@ -0,0 +1,37 @@ +# Binaries for programs and plugins +*.exe +*.dll +*.so +*.dylib +*.o +*.a + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.prof + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 +.glide/ + +# Gogland +.idea/ \ No newline at end of file diff --git a/vendor/github.com/dimchansky/utfbom/.travis.yml b/vendor/github.com/dimchansky/utfbom/.travis.yml new file mode 100644 index 000000000000..3512c85190d7 --- /dev/null +++ b/vendor/github.com/dimchansky/utfbom/.travis.yml @@ -0,0 +1,18 @@ +language: go + +go: + - '1.10' + - '1.11' + +# sudo=false makes the build run using a container +sudo: false + +before_install: + - go get github.com/mattn/goveralls + - go get golang.org/x/tools/cmd/cover + - go get golang.org/x/tools/cmd/goimports + - go get github.com/golang/lint/golint +script: + - gofiles=$(find ./ -name '*.go') && [ -z "$gofiles" ] || unformatted=$(goimports -l $gofiles) && [ -z "$unformatted" ] || (echo >&2 "Go files must be formatted with gofmt. Following files has problem:\n $unformatted" && false) + - golint ./... # This won't break the build, just show warnings + - $HOME/gopath/bin/goveralls -service=travis-ci diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dimchansky/utfbom/LICENSE b/vendor/github.com/dimchansky/utfbom/LICENSE similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dimchansky/utfbom/LICENSE rename to vendor/github.com/dimchansky/utfbom/LICENSE diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dimchansky/utfbom/README.md b/vendor/github.com/dimchansky/utfbom/README.md similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dimchansky/utfbom/README.md rename to vendor/github.com/dimchansky/utfbom/README.md diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dimchansky/utfbom/go.mod b/vendor/github.com/dimchansky/utfbom/go.mod similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dimchansky/utfbom/go.mod rename to vendor/github.com/dimchansky/utfbom/go.mod diff --git a/vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dimchansky/utfbom/utfbom.go b/vendor/github.com/dimchansky/utfbom/utfbom.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/azure/vendor/github.com/dimchansky/utfbom/utfbom.go rename to vendor/github.com/dimchansky/utfbom/utfbom.go diff --git a/vendor/github.com/docker/cli/AUTHORS b/vendor/github.com/docker/cli/AUTHORS new file mode 100644 index 000000000000..04edcf794e2d --- /dev/null +++ b/vendor/github.com/docker/cli/AUTHORS @@ -0,0 +1,716 @@ +# This file lists all individuals having contributed content to the repository. +# For how it is generated, see `scripts/docs/generate-authors.sh`. + +Aanand Prasad +Aaron L. Xu +Aaron Lehmann +Aaron.L.Xu +Abdur Rehman +Abhinandan Prativadi +Abin Shahab +Ace Tang +Addam Hardy +Adolfo Ochagavía +Adrien Duermael +Adrien Folie +Ahmet Alp Balkan +Aidan Feldman +Aidan Hobson Sayers +AJ Bowen +Akihiro Suda +Akim Demaille +Alan Thompson +Albert Callarisa +Aleksa Sarai +Alessandro Boch +Alex Mavrogiannis +Alex Mayer +Alexander Boyd +Alexander Larsson +Alexander Morozov +Alexander Ryabov +Alexandre González +Alfred Landrum +Alicia Lauerman +Allen Sun +Alvin Deng +Amen Belayneh +Amir Goldstein +Amit Krishnan +Amit Shukla +Amy Lindburg +Anda Xu +Andrea Luzzardi +Andreas Köhler +Andrew France +Andrew Hsu +Andrew Macpherson +Andrew McDonnell +Andrew Po +Andrey Petrov +André Martins +Andy Goldstein +Andy Rothfusz +Anil Madhavapeddy +Ankush Agarwal +Anne Henmi +Anton Polonskiy +Antonio Murdaca +Antonis Kalipetis +Anusha Ragunathan +Ao Li +Arash Deshmeh +Arnaud Porterie +Ashwini Oruganti +Azat Khuyiyakhmetov +Bardia Keyoumarsi +Barnaby Gray +Bastiaan Bakker +BastianHofmann +Ben Bonnefoy +Ben Creasy +Ben Firshman +Benjamin Boudreau +Benoit Sigoure +Bhumika Bayani +Bill Wang +Bin Liu +Bingshen Wang +Boaz Shuster +Bogdan Anton +Boris Pruessmann +Bradley Cicenas +Brandon Mitchell +Brandon Philips +Brent Salisbury +Bret Fisher +Brian (bex) Exelbierd +Brian Goff +Bryan Bess +Bryan Boreham +Bryan Murphy +bryfry +Cameron Spear +Cao Weiwei +Carlo Mion +Carlos Alexandro Becker +Ce Gao +Cedric Davies +Cezar Sa Espinola +Chad Faragher +Chao Wang +Charles Chan +Charles Law +Charles Smith +Charlie Drage +ChaYoung You +Chen Chuanliang +Chen Hanxiao +Chen Mingjie +Chen Qiu +Chris Gavin +Chris Gibson +Chris McKinnel +Chris Snow +Chris Weyl +Christian Persson +Christian Stefanescu +Christophe Robin +Christophe Vidal +Christopher Biscardi +Christopher Crone +Christopher Jones +Christy Norman +Chun Chen +Clinton Kitson +Coenraad Loubser +Colin Hebert +Collin Guarino +Colm Hally +Corey Farrell +Corey Quon +Craig Wilhite +Cristian Staretu +Daehyeok Mun +Dafydd Crosby +dalanlan +Damien Nadé +Dan Cotora +Daniel Dao +Daniel Farrell +Daniel Gasienica +Daniel Goosen +Daniel Hiltgen +Daniel J Walsh +Daniel Nephin +Daniel Norberg +Daniel Watkins +Daniel Zhang +Danny Berger +Darren Shepherd +Darren Stahl +Dattatraya Kumbhar +Dave Goodchild +Dave Henderson +Dave Tucker +David Beitey +David Calavera +David Cramer +David Dooling +David Gageot +David Lechner +David Scott +David Sheets +David Williamson +David Xia +David Young +Deng Guangxing +Denis Defreyne +Denis Gladkikh +Denis Ollier +Dennis Docter +Derek McGowan +Deshi Xiao +Dharmit Shah +Dhawal Yogesh Bhanushali +Dieter Reuter +Dima Stopel +Dimitry Andric +Ding Fei +Diogo Monica +Dmitry Gusev +Dmitry Smirnov +Dmitry V. Krivenok +Don Kjer +Dong Chen +Doug Davis +Drew Erny +Ed Costello +Elango Sivanandam +Eli Uriegas +Eli Uriegas +Elias Faxö +Elliot Luo <956941328@qq.com> +Eric Curtin +Eric G. Noriega +Eric Rosenberg +Eric Sage +Eric-Olivier Lamey +Erica Windisch +Erik Hollensbe +Erik St. Martin +Essam A. Hassan +Ethan Haynes +Euan Kemp +Eugene Yakubovich +Evan Allrich +Evan Hazlett +Evan Krall +Evelyn Xu +Everett Toews +Fabio Falci +Fabrizio Soppelsa +Felix Hupfeld +Felix Rabe +Filip JareÅ¡ +Flavio Crisciani +Florian Klein +Foysal Iqbal +François Scala +Fred Lifton +Frederic Hemberger +Frederick F. Kautz IV +Frederik Nordahl Jul Sabroe +Frieder Bluemle +Gabriel Nicolas Avellaneda +Gaetan de Villele +Gang Qiao +Gary Schaetz +Genki Takiuchi +George MacRorie +George Xie +Gianluca Borello +Gildas Cuisinier +Gou Rao +Grant Reaber +Greg Pflaum +Guilhem Lettron +Guillaume J. Charmes +Guillaume Le Floch +gwx296173 +Günther Jungbluth +Hakan Özler +Hao Zhang <21521210@zju.edu.cn> +Harald Albers +Harold Cooper +Harry Zhang +He Simei +Helen Xie +Henning Sprang +Henry N +Hernan Garcia +Hongbin Lu +Hu Keping +Huayi Zhang +huqun +Huu Nguyen +Hyzhou Zhy +Ian Campbell +Ian Philpot +Ignacio Capurro +Ilya Dmitrichenko +Ilya Khlopotov +Ilya Sotkov +Ioan Eugen Stan +Isabel Jimenez +Ivan Grcic +Ivan Markin +Jacob Atzen +Jacob Tomlinson +Jaivish Kothari +Jake Lambert +Jake Sanders +James Nesbitt +James Turnbull +Jamie Hannaford +Jan Koprowski +Jan Pazdziora +Jan-Jaap Driessen +Jana Radhakrishnan +Jared Hocutt +Jasmine Hegman +Jason Heiss +Jason Plum +Jay Kamat +Jean Rouge +Jean-Christophe Sirot +Jean-Pierre Huynh +Jeff Lindsay +Jeff Nickoloff +Jeff Silberman +Jeremy Chambers +Jeremy Unruh +Jeremy Yallop +Jeroen Franse +Jesse Adametz +Jessica Frazelle +Jezeniel Zapanta +Jian Zhang +Jie Luo +Jilles Oldenbeuving +Jim Galasyn +Jimmy Leger +Jimmy Song +jimmyxian +Jintao Zhang +Joao Fernandes +Joe Doliner +Joe Gordon +Joel Handwell +Joey Geiger +Joffrey F +Johan Euphrosine +Johannes 'fish' Ziemke +John Feminella +John Harris +John Howard (VM) +John Laswell +John Maguire +John Mulhausen +John Starks +John Stephens +John Tims +John V. Martinez +John Willis +Jonathan Boulle +Jonathan Lee +Jonathan Lomas +Jonathan McCrohan +Jonh Wendell +Jordan Jennings +Joseph Kern +Josh Bodah +Josh Chorlton +Josh Hawn +Josh Horwitz +Josh Soref +Julien Barbier +Julien Kassar +Julien Maitrehenry +Justas Brazauskas +Justin Cormack +Justin Simonelis +Justyn Temme +Jyrki Puttonen +Jérémie Drouet +Jérôme Petazzoni +Jörg Thalheim +Kai Blin +Kai Qiang Wu (Kennan) +Kara Alexandra +Kareem Khazem +Karthik Nayak +Kat Samperi +Katie McLaughlin +Ke Xu +Kei Ohmura +Keith Hudgins +Ken Cochrane +Ken ICHIKAWA +Kenfe-Mickaël Laventure +Kevin Burke +Kevin Feyrer +Kevin Kern +Kevin Kirsche +Kevin Meredith +Kevin Richardson +khaled souf +Kim Eik +Kir Kolyshkin +Kotaro Yoshimatsu +Krasi Georgiev +Kris-Mikael Krister +Kun Zhang +Kunal Kushwaha +Kyle Spiers +Lachlan Cooper +Lai Jiangshan +Lars Kellogg-Stedman +Laura Frank +Laurent Erignoux +Lee Gaines +Lei Jitang +Lennie +Leo Gallucci +Lewis Daly +Li Yi +Li Yi +Liang-Chi Hsieh +Lifubang +Lihua Tang +Lily Guo +Lin Lu +Linus Heckemann +Liping Xue +Liron Levin +liwenqi +lixiaobing10051267 +Lloyd Dewolf +Lorenzo Fontana +Louis Opter +Luca Favatella +Luca Marturana +Lucas Chan +Luka Hartwig +Lukasz Zajaczkowski +Lydell Manganti +Lénaïc Huard +Ma Shimiao +Mabin +Madhav Puri +Madhu Venugopal +Malte Janduda +Manjunath A Kumatagi +Mansi Nahar +mapk0y +Marc Bihlmaier +Marco Mariani +Marco Vedovati +Marcus Martins +Marianna Tessel +Marius Sturm +Mark Oates +Marsh Macy +Martin Mosegaard Amdisen +Mary Anthony +Mason Fish +Mason Malone +Mateusz Major +Mathieu Champlon +Matt Gucci +Matt Robenolt +Matteo Orefice +Matthew Heon +Matthieu Hauglustaine +Mauro Porras P +Max Shytikov +Maxime Petazzoni +Mei ChunTao +Micah Zoltu +Michael A. Smith +Michael Bridgen +Michael Crosby +Michael Friis +Michael Irwin +Michael Käufl +Michael Prokop +Michael Scharf +Michael Spetsiotis +Michael Steinert +Michael West +Michal Minář +MichaÅ‚ Czeraszkiewicz +Miguel Angel Alvarez Cabrerizo +Mihai Borobocea +Mihuleacc Sergiu +Mike Brown +Mike Casas +Mike Danese +Mike Dillon +Mike Goelzer +Mike MacCana +mikelinjie <294893458@qq.com> +Mikhail Vasin +Milind Chawre +Mindaugas Rukas +Misty Stanley-Jones +Mohammad Banikazemi +Mohammed Aaqib Ansari +Mohini Anne Dsouza +Moorthy RS +Morgan Bauer +Moysés Borges +Mrunal Patel +muicoder +Muthukumar R +Máximo Cuadros +MÃ¥rten Cassel +Nace Oroz +Nahum Shalman +Nalin Dahyabhai +Nao YONASHIRO +Nassim 'Nass' Eddequiouaq +Natalie Parker +Nate Brennand +Nathan Hsieh +Nathan LeClaire +Nathan McCauley +Neil Peterson +Nick Adcock +Nico Stapelbroek +Nicola Kabar +Nicolas Borboën +Nicolas De Loof +Nikhil Chawla +Nikolas Garofil +Nikolay Milovanov +Nir Soffer +Nishant Totla +NIWA Hideyuki +Noah Treuhaft +O.S. Tezer +ohmystack +Olle Jonsson +Olli Janatuinen +Otto Kekäläinen +Ovidio Mallo +Pascal Borreli +Patrick Böänziger +Patrick Hemmer +Patrick Lang +Paul +Paul Kehrer +Paul Lietar +Paul Weaver +Pavel Pospisil +PaweÅ‚ Szczekutowicz +Peeyush Gupta +Per Lundberg +Peter Edge +Peter Hsu +Peter Jaffe +Peter Kehl +Peter Nagy +Peter Salvatore +Peter Waller +Phil Estes +Philip Alexander Etling +Philipp Gillé +Philipp Schmied +pidster +pixelistik +Pratik Karki +Prayag Verma +Preston Cowley +Pure White +Qiang Huang +Qinglan Peng +qudongfang +Raghavendra K T +Ray Tsang +Reficul +Remy Suen +Renaud Gaubert +Ricardo N Feliciano +Rich Moyse +Richard Mathie +Richard Scothern +Rick Wieman +Ritesh H Shukla +Riyaz Faizullabhoy +Robert Wallis +Robin Naundorf +Robin Speekenbrink +Rodolfo Ortiz +Rogelio Canedo +Roland Kammerer +Roman Dudin +Rory Hunter +Ross Boucher +Rubens Figueiredo +Rui Cao +Ryan Belgrave +Ryan Detzel +Ryan Stelly +Ryan Wilson-Perkin +Ryan Zhang +Sainath Grandhi +Sakeven Jiang +Sally O'Malley +Sam Neirinck +Sambuddha Basu +Sami Tabet +Samuel Karp +Santhosh Manohar +Scott Brenner +Scott Collier +Sean Christopherson +Sean Rodman +Sebastiaan van Stijn +Sergey Tryuber +Serhat Gülçiçek +Sevki Hasirci +Shaun Kaasten +Sheng Yang +Shijiang Wei +Shishir Mahajan +Shoubhik Bose +Shukui Yang +Sian Lerk Lau +Sidhartha Mani +sidharthamani +Silvin Lubecki +Simei He +Simon Ferquel +Sindhu S +Slava Semushin +Solomon Hykes +Song Gao +Spencer Brown +squeegels <1674195+squeegels@users.noreply.github.com> +Srini Brahmaroutu +Stefan S. +Stefan Scherer +Stefan Weil +Stephane Jeandeaux +Stephen Day +Stephen Rust +Steve Durrheimer +Steve Richards +Steven Burgess +Subhajit Ghosh +Sun Jianbo +Sune Keller +Sungwon Han +Sunny Gogoi +Sven Dowideit +Sylvain Baubeau +Sébastien HOUZÉ +T K Sourabh +TAGOMORI Satoshi +taiji-tech +Taylor Jones +Tejaswini Duggaraju +Thatcher Peskens +Thomas Gazagnaire +Thomas Krzero +Thomas Leonard +Thomas Léveil +Thomas Riccardi +Thomas Swift +Tianon Gravi +Tianyi Wang +Tibor Vass +Tim Dettrick +Tim Hockin +Tim Smith +Tim Waugh +Tim Wraight +timfeirg +Timothy Hobbs +Tobias Bradtke +Tobias Gesellchen +Todd Whiteman +Tom Denham +Tom Fotherby +Tom Klingenberg +Tom Milligan +Tom X. Tobin +Tomas Tomecek +Tomasz Kopczynski +Tomáš HrÄka +Tony Abboud +Tõnis Tiigi +Trapier Marshall +Travis Cline +Tristan Carel +Tycho Andersen +Tycho Andersen +uhayate +Ulysses Souza +Umesh Yadav +Valentin Lorentz +Veres Lajos +Victor Vieux +Victoria Bialas +Viktor Stanchev +Vimal Raghubir +Vincent Batts +Vincent Bernat +Vincent Demeester +Vincent Woo +Vishnu Kannan +Vivek Goyal +Wang Jie +Wang Lei +Wang Long +Wang Ping +Wang Xing +Wang Yuexiao +Wataru Ishida +Wayne Song +Wen Cheng Ma +Wenzhi Liang +Wes Morgan +Wewang Xiaorenfine +William Henry +Xianglin Gao +Xiaodong Zhang +Xiaoxi He +Xinbo Weng +Xuecong Liao +Yan Feng +Yanqiang Miao +Yassine Tijani +Yi EungJun +Ying Li +Yong Tang +Yosef Fertel +Yu Peng +Yuan Sun +Yue Zhang +Yunxiang Huang +Zachary Romero +zebrilee +Zhang Kun +Zhang Wei +Zhang Wentao +ZhangHang +zhenghenghuo +Zhou Hao +Zhoulin Xie +Zhu Guihua +Ãlex González +Ãlvaro Lázaro +Ãtila Camurça Alves +å¾ä¿Šæ° diff --git a/vendor/github.com/docker/distribution/.gitignore b/vendor/github.com/docker/distribution/.gitignore new file mode 100644 index 000000000000..4cf7888e927e --- /dev/null +++ b/vendor/github.com/docker/distribution/.gitignore @@ -0,0 +1,38 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof + +# never checkin from the bin file (for now) +bin/* + +# Test key files +*.pem + +# Cover profiles +*.out + +# Editor/IDE specific files. +*.sublime-project +*.sublime-workspace +.idea/* diff --git a/vendor/github.com/docker/distribution/.gometalinter.json b/vendor/github.com/docker/distribution/.gometalinter.json new file mode 100644 index 000000000000..9df5b14bcb2e --- /dev/null +++ b/vendor/github.com/docker/distribution/.gometalinter.json @@ -0,0 +1,16 @@ +{ + "Vendor": true, + "Deadline": "2m", + "Sort": ["linter", "severity", "path", "line"], + "EnableGC": true, + "Enable": [ + "structcheck", + "staticcheck", + "unconvert", + + "gofmt", + "goimports", + "golint", + "vet" + ] +} diff --git a/vendor/github.com/docker/distribution/.mailmap b/vendor/github.com/docker/distribution/.mailmap new file mode 100644 index 000000000000..0f48321d4971 --- /dev/null +++ b/vendor/github.com/docker/distribution/.mailmap @@ -0,0 +1,32 @@ +Stephen J Day Stephen Day +Stephen J Day Stephen Day +Olivier Gambier Olivier Gambier +Brian Bland Brian Bland +Brian Bland Brian Bland +Josh Hawn Josh Hawn +Richard Scothern Richard +Richard Scothern Richard Scothern +Andrew Meredith Andrew Meredith +harche harche +Jessie Frazelle +Sharif Nassar Sharif Nassar +Sven Dowideit Sven Dowideit +Vincent Giersch Vincent Giersch +davidli davidli +Omer Cohen Omer Cohen +Eric Yang Eric Yang +Nikita Tarasov Nikita +Yu Wang yuwaMSFT2 +Yu Wang Yu Wang (UC) +Olivier Gambier dmp +Olivier Gambier Olivier +Olivier Gambier Olivier +Elsan Li æŽæ¥  elsanli(æŽæ¥ ) +Rui Cao ruicao +Gwendolynne Barr gbarr01 +Haibing Zhou 周海兵 zhouhaibing089 +Feng Honglin tifayuki +Helen Xie Helen-xie +Mike Brown Mike Brown +Manish Tomar Manish Tomar +Sakeven Jiang sakeven diff --git a/vendor/github.com/docker/distribution/.travis.yml b/vendor/github.com/docker/distribution/.travis.yml new file mode 100644 index 000000000000..44ced60451db --- /dev/null +++ b/vendor/github.com/docker/distribution/.travis.yml @@ -0,0 +1,51 @@ +dist: trusty +sudo: required +# setup travis so that we can run containers for integration tests +services: + - docker + +language: go + +go: + - "1.11.x" + +go_import_path: github.com/docker/distribution + +addons: + apt: + packages: + - python-minimal + + +env: + - TRAVIS_GOOS=linux DOCKER_BUILDTAGS="include_oss include_gcs" TRAVIS_CGO_ENABLED=1 + +before_install: + - uname -r + - sudo apt-get -q update + +install: + - go get -u github.com/vbatts/git-validation + # TODO: Add enforcement of license + # - go get -u github.com/kunalkushwaha/ltag + - cd $TRAVIS_BUILD_DIR + +script: + - export GOOS=$TRAVIS_GOOS + - export CGO_ENABLED=$TRAVIS_CGO_ENABLED + - DCO_VERBOSITY=-q script/validate/dco + - GOOS=linux script/setup/install-dev-tools + - script/validate/vendor + - go build -i . + - make check + - make build + - make binaries + # Currently takes too long + #- if [ "$GOOS" = "linux" ]; then make test-race ; fi + - if [ "$GOOS" = "linux" ]; then make coverage ; fi + +after_success: + - bash <(curl -s https://codecov.io/bash) -F linux + +before_deploy: + # Run tests with storage driver configurations diff --git a/vendor/github.com/docker/docker/AUTHORS b/vendor/github.com/docker/docker/AUTHORS new file mode 100644 index 000000000000..ad166ba8df6c --- /dev/null +++ b/vendor/github.com/docker/docker/AUTHORS @@ -0,0 +1,2135 @@ +# This file lists all individuals having contributed content to the repository. +# For how it is generated, see `hack/generate-authors.sh`. + +Aanand Prasad +Aaron Davidson +Aaron Feng +Aaron Hnatiw +Aaron Huslage +Aaron L. Xu +Aaron Lehmann +Aaron Welch +Aaron.L.Xu +Abel Muiño +Abhijeet Kasurde +Abhinandan Prativadi +Abhinav Ajgaonkar +Abhishek Chanda +Abhishek Sharma +Abin Shahab +Adam Avilla +Adam Dobrawy +Adam Eijdenberg +Adam Kunk +Adam Miller +Adam Mills +Adam Pointer +Adam Singer +Adam Walz +Addam Hardy +Aditi Rajagopal +Aditya +Adnan Khan +Adolfo Ochagavía +Adria Casas +Adrian Moisey +Adrian Mouat +Adrian Oprea +Adrien Folie +Adrien Gallouët +Ahmed Kamal +Ahmet Alp Balkan +Aidan Feldman +Aidan Hobson Sayers +AJ Bowen +Ajey Charantimath +ajneu +Akash Gupta +Akihiro Matsushima +Akihiro Suda +Akim Demaille +Akira Koyasu +Akshay Karle +Al Tobey +alambike +Alan Scherger +Alan Thompson +Albert Callarisa +Albert Zhang +Alejandro González Hevia +Aleksa Sarai +Aleksandrs Fadins +Alena Prokharchyk +Alessandro Boch +Alessio Biancalana +Alex Chan +Alex Chen +Alex Coventry +Alex Crawford +Alex Ellis +Alex Gaynor +Alex Goodman +Alex Olshansky +Alex Samorukov +Alex Warhawk +Alexander Artemenko +Alexander Boyd +Alexander Larsson +Alexander Midlash +Alexander Morozov +Alexander Shopov +Alexandre Beslic +Alexandre Garnier +Alexandre González +Alexandre Jomin +Alexandru Sfirlogea +Alexei Margasov +Alexey Guskov +Alexey Kotlyarov +Alexey Shamrin +Alexis THOMAS +Alfred Landrum +Ali Dehghani +Alicia Lauerman +Alihan Demir +Allen Madsen +Allen Sun +almoehi +Alvaro Saurin +Alvin Deng +Alvin Richards +amangoel +Amen Belayneh +Amir Goldstein +Amit Bakshi +Amit Krishnan +Amit Shukla +Amr Gawish +Amy Lindburg +Anand Patil +AnandkumarPatel +Anatoly Borodin +Anchal Agrawal +Anda Xu +Anders Janmyr +Andre Dublin <81dublin@gmail.com> +Andre Granovsky +Andrea Denisse Gómez +Andrea Luzzardi +Andrea Turli +Andreas Elvers +Andreas Köhler +Andreas Savvides +Andreas Tiefenthaler +Andrei Gherzan +Andrei Vagin +Andrew C. Bodine +Andrew Clay Shafer +Andrew Duckworth +Andrew France +Andrew Gerrand +Andrew Guenther +Andrew He +Andrew Hsu +Andrew Kuklewicz +Andrew Macgregor +Andrew Macpherson +Andrew Martin +Andrew McDonnell +Andrew Munsell +Andrew Pennebaker +Andrew Po +Andrew Weiss +Andrew Williams +Andrews Medina +Andrey Kolomentsev +Andrey Petrov +Andrey Stolbovsky +André Martins +andy +Andy Chambers +andy diller +Andy Goldstein +Andy Kipp +Andy Rothfusz +Andy Smith +Andy Wilson +Anes Hasicic +Anil Belur +Anil Madhavapeddy +Ankit Jain +Ankush Agarwal +Anonmily +Anran Qiao +Anshul Pundir +Anthon van der Neut +Anthony Baire +Anthony Bishopric +Anthony Dahanne +Anthony Sottile +Anton Löfgren +Anton Nikitin +Anton Polonskiy +Anton Tiurin +Antonio Murdaca +Antonis Kalipetis +Antony Messerli +Anuj Bahuguna +Anusha Ragunathan +apocas +Arash Deshmeh +ArikaChen +Arko Dasgupta +Arnaud Lefebvre +Arnaud Porterie +Arnaud Rebillout +Arthur Barr +Arthur Gautier +Artur Meyster +Arun Gupta +Asad Saeeduddin +Asbjørn Enge +averagehuman +Avi Das +Avi Kivity +Avi Miller +Avi Vaid +ayoshitake +Azat Khuyiyakhmetov +Bardia Keyoumarsi +Barnaby Gray +Barry Allard +BartÅ‚omiej Piotrowski +Bastiaan Bakker +bdevloed +Ben Bonnefoy +Ben Firshman +Ben Golub +Ben Gould +Ben Hall +Ben Sargent +Ben Severson +Ben Toews +Ben Wiklund +Benjamin Atkin +Benjamin Baker +Benjamin Boudreau +Benjamin Yolken +Benoit Chesneau +Bernerd Schaefer +Bernhard M. Wiedemann +Bert Goethals +Bevisy Zhang +Bharath Thiruveedula +Bhiraj Butala +Bhumika Bayani +Bilal Amarni +Bill Wang +Bily Zhang +Bin Liu +Bingshen Wang +Blake Geno +Boaz Shuster +bobby abbott +Boris Pruessmann +Boshi Lian +Bouke Haarsma +Boyd Hemphill +boynux +Bradley Cicenas +Bradley Wright +Brandon Liu +Brandon Philips +Brandon Rhodes +Brendan Dixon +Brent Salisbury +Brett Higgins +Brett Kochendorfer +Brett Randall +Brian (bex) Exelbierd +Brian Bland +Brian DeHamer +Brian Dorsey +Brian Flad +Brian Goff +Brian McCallister +Brian Olsen +Brian Schwind +Brian Shumate +Brian Torres-Gil +Brian Trump +Brice Jaglin +Briehan Lombaard +Brielle Broder +Bruno Bigras +Bruno Binet +Bruno Gazzera +Bruno Renié +Bruno Tavares +Bryan Bess +Bryan Boreham +Bryan Matsuo +Bryan Murphy +Burke Libbey +Byung Kang +Caleb Spare +Calen Pennington +Cameron Boehmer +Cameron Spear +Campbell Allen +Candid Dauth +Cao Weiwei +Carl Henrik Lunde +Carl Loa Odin +Carl X. Su +Carlo Mion +Carlos Alexandro Becker +Carlos de Paula +Carlos Sanchez +Carol Fager-Higgins +Cary +Casey Bisson +Catalin Pirvu +Ce Gao +Cedric Davies +Cezar Sa Espinola +Chad Swenson +Chance Zibolski +Chander Govindarajan +Chanhun Jeong +Chao Wang +Charles Chan +Charles Hooper +Charles Law +Charles Lindsay +Charles Merriam +Charles Sarrazin +Charles Smith +Charlie Drage +Charlie Lewis +Chase Bolt +ChaYoung You +Chen Chao +Chen Chuanliang +Chen Hanxiao +Chen Min +Chen Mingjie +Chen Qiu +Cheng-mean Liu +Chengfei Shang +Chengguang Xu +chenyuzhu +Chetan Birajdar +Chewey +Chia-liang Kao +chli +Cholerae Hu +Chris Alfonso +Chris Armstrong +Chris Dias +Chris Dituri +Chris Fordham +Chris Gavin +Chris Gibson +Chris Khoo +Chris McKinnel +Chris McKinnel +Chris Price +Chris Seto +Chris Snow +Chris St. Pierre +Chris Stivers +Chris Swan +Chris Telfer +Chris Wahl +Chris Weyl +Chris White +Christian Berendt +Christian Brauner +Christian Böhme +Christian Muehlhaeuser +Christian Persson +Christian Rotzoll +Christian Simon +Christian Stefanescu +Christophe Mehay +Christophe Troestler +Christophe Vidal +Christopher Biscardi +Christopher Crone +Christopher Currie +Christopher Jones +Christopher Latham +Christopher Rigor +Christy Perez +Chun Chen +Ciro S. Costa +Clayton Coleman +Clinton Kitson +Cody Roseborough +Coenraad Loubser +Colin Dunklau +Colin Hebert +Colin Panisset +Colin Rice +Colin Walters +Collin Guarino +Colm Hally +companycy +Corbin Coleman +Corey Farrell +Cory Forsyth +cressie176 +CrimsonGlory +Cristian Staretu +cristiano balducci +Cruceru Calin-Cristian +CUI Wei +Cyprian Gracz +Cyril F +Daan van Berkel +Daehyeok Mun +Dafydd Crosby +dalanlan +Damian Smyth +Damien Nadé +Damien Nozay +Damjan Georgievski +Dan Anolik +Dan Buch +Dan Cotora +Dan Feldman +Dan Griffin +Dan Hirsch +Dan Keder +Dan Levy +Dan McPherson +Dan Stine +Dan Williams +Dani Hodovic +Dani Louca +Daniel Antlinger +Daniel Dao +Daniel Exner +Daniel Farrell +Daniel Garcia +Daniel Gasienica +Daniel Grunwell +Daniel Hiltgen +Daniel J Walsh +Daniel Menet +Daniel Mizyrycki +Daniel Nephin +Daniel Norberg +Daniel Nordberg +Daniel Robinson +Daniel S +Daniel Sweet +Daniel Von Fange +Daniel Watkins +Daniel X Moore +Daniel YC Lin +Daniel Zhang +Danny Berger +Danny Milosavljevic +Danny Yates +Danyal Khaliq +Darren Coxall +Darren Shepherd +Darren Stahl +Dattatraya Kumbhar +Davanum Srinivas +Dave Barboza +Dave Goodchild +Dave Henderson +Dave MacDonald +Dave Tucker +David Anderson +David Calavera +David Chung +David Corking +David Cramer +David Currie +David Davis +David Dooling +David Gageot +David Gebler +David Glasser +David Lawrence +David Lechner +David M. Karr +David Mackey +David Mat +David Mcanulty +David McKay +David P Hilton +David Pelaez +David R. Jenni +David Röthlisberger +David Sheets +David Sissitka +David Trott +David Wang <00107082@163.com> +David Williamson +David Xia +David Young +Davide Ceretti +Dawn Chen +dbdd +dcylabs +Debayan De +Deborah Gertrude Digges +deed02392 +Deep Debroy +Deng Guangxing +Deni Bertovic +Denis Defreyne +Denis Gladkikh +Denis Ollier +Dennis Chen +Dennis Chen +Dennis Docter +Derek +Derek +Derek Ch +Derek McGowan +Deric Crago +Deshi Xiao +devmeyster +Devvyn Murphy +Dharmit Shah +Dhawal Yogesh Bhanushali +Diego Romero +Diego Siqueira +Dieter Reuter +Dillon Dixon +Dima Stopel +Dimitri John Ledkov +Dimitris Mandalidis +Dimitris Rozakis +Dimitry Andric +Dinesh Subhraveti +Ding Fei +Diogo Monica +DiuDiugirl +Djibril Koné +dkumor +Dmitri Logvinenko +Dmitri Shuralyov +Dmitry Demeshchuk +Dmitry Gusev +Dmitry Kononenko +Dmitry Sharshakov +Dmitry Shyshkin +Dmitry Smirnov +Dmitry V. Krivenok +Dmitry Vorobev +Dolph Mathews +Dominic Tubach +Dominic Yin +Dominik Dingel +Dominik Finkbeiner +Dominik Honnef +Don Kirkby +Don Kjer +Don Spaulding +Donald Huang +Dong Chen +Donghwa Kim +Donovan Jones +Doron Podoleanu +Doug Davis +Doug MacEachern +Doug Tangren +Douglas Curtis +Dr Nic Williams +dragon788 +Dražen LuÄanin +Drew Erny +Drew Hubl +Dustin Sallings +Ed Costello +Edmund Wagner +Eiichi Tsukata +Eike Herzbach +Eivin Giske Skaaren +Eivind Uggedal +Elan Ruusamäe +Elango Sivanandam +Elena Morozova +Eli Uriegas +Elias Faxö +Elias Probst +Elijah Zupancic +eluck +Elvir Kuric +Emil Davtyan +Emil Hernvall +Emily Maier +Emily Rose +Emir Ozer +Enguerran +Eohyung Lee +epeterso +Eric Barch +Eric Curtin +Eric G. Noriega +Eric Hanchrow +Eric Lee +Eric Myhre +Eric Paris +Eric Rafaloff +Eric Rosenberg +Eric Sage +Eric Soderstrom +Eric Yang +Eric-Olivier Lamey +Erica Windisch +Erik Bray +Erik Dubbelboer +Erik Hollensbe +Erik Inge Bolsø +Erik Kristensen +Erik St. Martin +Erik Weathers +Erno Hopearuoho +Erwin van der Koogh +Ethan Bell +Ethan Mosbaugh +Euan Kemp +Eugen Krizo +Eugene Yakubovich +Evan Allrich +Evan Carmi +Evan Hazlett +Evan Krall +Evan Phoenix +Evan Wies +Evelyn Xu +Everett Toews +Evgeny Shmarnev +Evgeny Vereshchagin +Ewa Czechowska +Eystein MÃ¥løy Stenberg +ezbercih +Ezra Silvera +Fabian Kramm +Fabian Lauer +Fabian Raetz +Fabiano Rosas +Fabio Falci +Fabio Kung +Fabio Rapposelli +Fabio Rehm +Fabrizio Regini +Fabrizio Soppelsa +Faiz Khan +falmp +Fangming Fang +Fangyuan Gao <21551127@zju.edu.cn> +fanjiyun +Fareed Dudhia +Fathi Boudra +Federico Gimenez +Felipe Oliveira +Felipe Ruhland +Felix Abecassis +Felix Geisendörfer +Felix Hupfeld +Felix Rabe +Felix Ruess +Felix Schindler +Feng Yan +Fengtu Wang +Ferenc Szabo +Fernando +Fero Volar +Ferran Rodenas +Filipe Brandenburger +Filipe Oliveira +Flavio Castelli +Flavio Crisciani +Florian +Florian Klein +Florian Maier +Florian Noeding +Florian Weingarten +Florin Asavoaie +Florin Patan +fonglh +Foysal Iqbal +Francesc Campoy +Francesco Mari +Francis Chuang +Francisco Carriedo +Francisco Souza +Frank Groeneveld +Frank Herrmann +Frank Macreery +Frank Rosquin +frankyang +Fred Lifton +Frederick F. Kautz IV +Frederik Loeffert +Frederik Nordahl Jul Sabroe +Freek Kalter +Frieder Bluemle +Fu JinLin +Félix Baylac-Jacqué +Félix Cantournet +Gabe Rosenhouse +Gabor Nagy +Gabriel Linder +Gabriel Monroy +Gabriel Nicolas Avellaneda +Gaetan de Villele +Galen Sampson +Gang Qiao +Gareth Rushgrove +Garrett Barboza +Gary Schaetz +Gaurav +gautam, prasanna +Gaël PORTAY +Genki Takiuchi +GennadySpb +Geoffrey Bachelet +Geon Kim +George Kontridze +George MacRorie +George Xie +Georgi Hristozov +Gereon Frey +German DZ +Gert van Valkenhoef +Gerwim Feiken +Ghislain Bourgeois +Giampaolo Mancini +Gianluca Borello +Gildas Cuisinier +Giovan Isa Musthofa +gissehel +Giuseppe Mazzotta +Gleb Fotengauer-Malinovskiy +Gleb M Borisov +Glyn Normington +GoBella +Goffert van Gool +Goldwyn Rodrigues +Gopikannan Venugopalsamy +Gosuke Miyashita +Gou Rao +Govinda Fichtner +Grant Millar +Grant Reaber +Graydon Hoare +Greg Fausak +Greg Pflaum +Greg Stephens +Greg Thornton +Grzegorz JaÅ›kiewicz +Guilhem Lettron +Guilherme Salgado +Guillaume Dufour +Guillaume J. Charmes +guoxiuyan +Guri +Gurjeet Singh +Guruprasad +Gustav Sinder +gwx296173 +Günter Zöchbauer +Haichao Yang +haikuoliu +Hakan Özler +Hamish Hutchings +Hans Kristian Flaatten +Hans Rødtang +Hao Shu Wei +Hao Zhang <21521210@zju.edu.cn> +Harald Albers +Harald Niesche +Harley Laue +Harold Cooper +Harrison Turton +Harry Zhang +Harshal Patil +Harshal Patil +He Simei +He Xiaoxi +He Xin +heartlock <21521209@zju.edu.cn> +Hector Castro +Helen Xie +Henning Sprang +Hiroshi Hatake +Hiroyuki Sasagawa +Hobofan +Hollie Teal +Hong Xu +Hongbin Lu +Hongxu Jia +hsinko <21551195@zju.edu.cn> +Hu Keping +Hu Tao +HuanHuan Ye +Huanzhong Zhang +Huayi Zhang +Hugo Duncan +Hugo Marisco <0x6875676f@gmail.com> +Hunter Blanks +huqun +Huu Nguyen +hyeongkyu.lee +Hyzhou Zhy +Iago López Galeiras +Ian Babrou +Ian Bishop +Ian Bull +Ian Calvert +Ian Campbell +Ian Chen +Ian Lee +Ian Main +Ian Philpot +Ian Truslove +Iavael +Icaro Seara +Ignacio Capurro +Igor Dolzhikov +Igor Karpovich +Iliana Weller +Ilkka Laukkanen +Ilya Dmitrichenko +Ilya Gusev +Ilya Khlopotov +imre Fitos +inglesp +Ingo Gottwald +Innovimax +Isaac Dupree +Isabel Jimenez +Isao Jonas +Iskander Sharipov +Ivan Babrou +Ivan Fraixedes +Ivan Grcic +Ivan Markin +J Bruni +J. Nunn +Jack Danger Canty +Jack Laxson +Jacob Atzen +Jacob Edelman +Jacob Tomlinson +Jacob Vallejo +Jacob Wen +Jaivish Kothari +Jake Champlin +Jake Moshenko +Jake Sanders +jakedt +James Allen +James Carey +James Carr +James DeFelice +James Harrison Fisher +James Kyburz +James Kyle +James Lal +James Mills +James Nesbitt +James Nugent +James Turnbull +James Watkins-Harvey +Jamie Hannaford +Jamshid Afshar +Jan Keromnes +Jan Koprowski +Jan Pazdziora +Jan Toebes +Jan-Gerd Tenberge +Jan-Jaap Driessen +Jana Radhakrishnan +Jannick Fahlbusch +Januar Wayong +Jared Biel +Jared Hocutt +Jaroslaw Zabiello +jaseg +Jasmine Hegman +Jason Divock +Jason Giedymin +Jason Green +Jason Hall +Jason Heiss +Jason Livesay +Jason McVetta +Jason Plum +Jason Shepherd +Jason Smith +Jason Sommer +Jason Stangroome +jaxgeller +Jay +Jay +Jay Kamat +Jean Rouge +Jean-Baptiste Barth +Jean-Baptiste Dalido +Jean-Christophe Berthon +Jean-Paul Calderone +Jean-Pierre Huynh +Jean-Tiare Le Bigot +Jeeva S. Chelladhurai +Jeff Anderson +Jeff Hajewski +Jeff Johnston +Jeff Lindsay +Jeff Mickey +Jeff Minard +Jeff Nickoloff +Jeff Silberman +Jeff Welch +Jeffrey Bolle +Jeffrey Morgan +Jeffrey van Gogh +Jenny Gebske +Jeremy Chambers +Jeremy Grosser +Jeremy Price +Jeremy Qian +Jeremy Unruh +Jeremy Yallop +Jeroen Franse +Jeroen Jacobs +Jesse Dearing +Jesse Dubay +Jessica Frazelle +Jezeniel Zapanta +Jhon Honce +Ji.Zhilong +Jian Liao +Jian Zhang +Jiang Jinyang +Jie Luo +Jihyun Hwang +Jilles Oldenbeuving +Jim Alateras +Jim Ehrismann +Jim Galasyn +Jim Minter +Jim Perrin +Jimmy Cuadra +Jimmy Puckett +Jimmy Song +Jinsoo Park +Jintao Zhang +Jiri Appl +Jiri Popelka +Jiuyue Ma +Jiří Župka +Joao Fernandes +Joao Trindade +Joe Beda +Joe Doliner +Joe Ferguson +Joe Gordon +Joe Shaw +Joe Van Dyk +Joel Friedly +Joel Handwell +Joel Hansson +Joel Wurtz +Joey Geiger +Joey Geiger +Joey Gibson +Joffrey F +Johan Euphrosine +Johan Rydberg +Johanan Lieberman +Johannes 'fish' Ziemke +John Costa +John Feminella +John Gardiner Myers +John Gossman +John Harris +John Howard +John Laswell +John Maguire +John Mulhausen +John OBrien III +John Starks +John Stephens +John Tims +John V. Martinez +John Warwick +John Willis +Jon Johnson +Jon Surrell +Jon Wedaman +Jonas Dohse +Jonas Pfenniger +Jonathan A. Schweder +Jonathan A. Sternberg +Jonathan Boulle +Jonathan Camp +Jonathan Choy +Jonathan Dowland +Jonathan Lebon +Jonathan Lomas +Jonathan McCrohan +Jonathan Mueller +Jonathan Pares +Jonathan Rudenberg +Jonathan Stoppani +Jonh Wendell +Joni Sar +Joost Cassee +Jordan Arentsen +Jordan Jennings +Jordan Sissel +Jorge Marin +Jorit Kleine-Möllhoff +Jose Diaz-Gonzalez +Joseph Anthony Pasquale Holsten +Joseph Hager +Joseph Kern +Joseph Rothrock +Josh +Josh Bodah +Josh Bonczkowski +Josh Chorlton +Josh Eveleth +Josh Hawn +Josh Horwitz +Josh Poimboeuf +Josh Soref +Josh Wilson +Josiah Kiehl +José Tomás Albornoz +Joyce Jang +JP +Julian Taylor +Julien Barbier +Julien Bisconti +Julien Bordellier +Julien Dubois +Julien Kassar +Julien Maitrehenry +Julien Pervillé +Julio Montes +Jun-Ru Chang +Jussi Nummelin +Justas Brazauskas +Justen Martin +Justin Cormack +Justin Force +Justin Menga +Justin Plock +Justin Simonelis +Justin Terry +Justyn Temme +Jyrki Puttonen +Jérémy Leherpeur +Jérôme Petazzoni +Jörg Thalheim +K. Heller +Kai Blin +Kai Qiang Wu (Kennan) +Kamil DomaÅ„ski +Kamjar Gerami +Kanstantsin Shautsou +Kara Alexandra +Karan Lyons +Kareem Khazem +kargakis +Karl Grzeszczak +Karol Duleba +Karthik Karanth +Karthik Nayak +Kasper Fabæch Brandt +Kate Heddleston +Katie McLaughlin +Kato Kazuyoshi +Katrina Owen +Kawsar Saiyeed +Kay Yan +kayrus +Kazuhiro Sera +Ke Li +Ke Xu +Kei Ohmura +Keith Hudgins +Keli Hu +Ken Cochrane +Ken Herner +Ken ICHIKAWA +Ken Reese +Kenfe-Mickaël Laventure +Kenjiro Nakayama +Kent Johnson +Kenta Tada +Kevin "qwazerty" Houdebert +Kevin Burke +Kevin Clark +Kevin Feyrer +Kevin J. Lynagh +Kevin Jing Qiu +Kevin Kern +Kevin Menard +Kevin Meredith +Kevin P. Kucharczyk +Kevin Parsons +Kevin Richardson +Kevin Shi +Kevin Wallace +Kevin Yap +Keyvan Fatehi +kies +Kim BKC Carlbacker +Kim Eik +Kimbro Staken +Kir Kolyshkin +Kiran Gangadharan +Kirill SIbirev +knappe +Kohei Tsuruta +Koichi Shiraishi +Konrad Kleine +Konstantin Gribov +Konstantin L +Konstantin Pelykh +Krasi Georgiev +Krasimir Georgiev +Kris-Mikael Krister +Kristian Haugene +Kristina Zabunova +Krystian Wojcicki +Kun Zhang +Kunal Kushwaha +Kunal Tyagi +Kyle Conroy +Kyle Linden +Kyle Wuolle +kyu +Lachlan Coote +Lai Jiangshan +Lajos Papp +Lakshan Perera +Lalatendu Mohanty +Lance Chen +Lance Kinley +Lars Butler +Lars Kellogg-Stedman +Lars R. Damerow +Lars-Magnus Skog +Laszlo Meszaros +Laura Frank +Laurent Erignoux +Laurie Voss +Leandro Siqueira +Lee Chao <932819864@qq.com> +Lee, Meng-Han +leeplay +Lei Gong +Lei Jitang +Len Weincier +Lennie +Leo Gallucci +Leszek Kowalski +Levi Blackstone +Levi Gross +Lewis Daly +Lewis Marshall +Lewis Peckover +Li Yi +Liam Macgillavry +Liana Lo +Liang Mingqiang +Liang-Chi Hsieh +Liao Qingwei +Lifubang +Lihua Tang +Lily Guo +limsy +Lin Lu +LingFaKe +Linus Heckemann +Liran Tal +Liron Levin +Liu Bo +Liu Hua +liwenqi +lixiaobing10051267 +Liz Zhang +LIZAO LI +Lizzie Dixon <_@lizzie.io> +Lloyd Dewolf +Lokesh Mandvekar +longliqiang88 <394564827@qq.com> +Lorenz Leutgeb +Lorenzo Fontana +Lotus Fenn +Louis Delossantos +Louis Opter +Luca Favatella +Luca Marturana +Luca Orlandi +Luca-Bogdan Grigorescu +Lucas Chan +Lucas Chi +Lucas Molas +Lucas Silvestre +Luciano Mores +Luis Martínez de Bartolomé Izquierdo +Luiz Svoboda +Lukas Heeren +Lukas Waslowski +lukaspustina +Lukasz Zajaczkowski +Luke Marsden +Lyn +Lynda O'Leary +lzhfromutsc +Lénaïc Huard +Ma Müller +Ma Shimiao +Mabin +Madhan Raj Mookkandy +Madhav Puri +Madhu Venugopal +Mageee +Mahesh Tiyyagura +malnick +Malte Janduda +Manfred Touron +Manfred Zabarauskas +Manjunath A Kumatagi +Mansi Nahar +Manuel Meurer +Manuel Rüger +Manuel Woelker +mapk0y +Marc Abramowitz +Marc Kuo +Marc Tamsky +Marcel Edmund Franke +Marcelo Horacio Fortino +Marcelo Salazar +Marco Hennings +Marcus Cobden +Marcus Farkas +Marcus Linke +Marcus Martins +Marcus Ramberg +Marek Goldmann +Marian Marinov +Marianna Tessel +Mario Loriedo +Marius Gundersen +Marius Sturm +Marius Voila +Mark Allen +Mark Jeromin +Mark McGranaghan +Mark McKinstry +Mark Milstein +Mark Oates +Mark Parker +Mark West +Markan Patel +Marko Mikulicic +Marko Tibold +Markus Fix +Markus Kortlang +Martijn Dwars +Martijn van Oosterhout +Martin Honermeyer +Martin Kelly +Martin Mosegaard Amdisen +Martin Muzatko +Martin Redmond +Mary Anthony +Masahito Zembutsu +Masato Ohba +Masayuki Morita +Mason Malone +Mateusz Sulima +Mathias Monnerville +Mathieu Champlon +Mathieu Le Marec - Pasquet +Mathieu Parent +Matt Apperson +Matt Bachmann +Matt Bentley +Matt Haggard +Matt Hoyle +Matt McCormick +Matt Moore +Matt Richardson +Matt Rickard +Matt Robenolt +Matt Schurenko +Matt Williams +Matthew Heon +Matthew Lapworth +Matthew Mayer +Matthew Mosesohn +Matthew Mueller +Matthew Riley +Matthias Klumpp +Matthias Kühnle +Matthias Rampke +Matthieu Hauglustaine +Mattias Jernberg +Mauricio Garavaglia +mauriyouth +Max Shytikov +Maxim Fedchyshyn +Maxim Ivanov +Maxim Kulkin +Maxim Treskin +Maxime Petazzoni +Maximiliano Maccanti +Maxwell +Meaglith Ma +meejah +Megan Kostick +Mehul Kar +Mei ChunTao +Mengdi Gao +Mert YazıcıoÄŸlu +mgniu +Micah Zoltu +Michael A. Smith +Michael Bridgen +Michael Brown +Michael Chiang +Michael Crosby +Michael Currie +Michael Friis +Michael Gorsuch +Michael Grauer +Michael Holzheu +Michael Hudson-Doyle +Michael Huettermann +Michael Irwin +Michael Käufl +Michael Neale +Michael Nussbaum +Michael Prokop +Michael Scharf +Michael Spetsiotis +Michael Stapelberg +Michael Steinert +Michael Thies +Michael West +Michael Zhao +Michal Fojtik +Michal Gebauer +Michal Jemala +Michal Minář +Michal Wieczorek +Michaël Pailloncy +MichaÅ‚ Czeraszkiewicz +MichaÅ‚ Gryko +Michiel de Jong +Mickaël Fortunato +Mickaël Remars +Miguel Angel Fernández +Miguel Morales +Mihai Borobocea +Mihuleacc Sergiu +Mike Brown +Mike Casas +Mike Chelen +Mike Danese +Mike Dillon +Mike Dougherty +Mike Estes +Mike Gaffney +Mike Goelzer +Mike Leone +Mike Lundy +Mike MacCana +Mike Naberezny +Mike Snitzer +mikelinjie <294893458@qq.com> +Mikhail Sobolev +Miklos Szegedi +Milind Chawre +Miloslav TrmaÄ +mingqing +Mingzhen Feng +Misty Stanley-Jones +Mitch Capper +Mizuki Urushida +mlarcher +Mohammad Banikazemi +Mohammad Nasirifar +Mohammed Aaqib Ansari +Mohit Soni +Moorthy RS +Morgan Bauer +Morgante Pell +Morgy93 +Morten Siebuhr +Morton Fox +Moysés Borges +mrfly +Mrunal Patel +Muayyad Alsadi +Mustafa Akın +Muthukumar R +Máximo Cuadros +Médi-Rémi Hashim +Nace Oroz +Nahum Shalman +Nakul Pathak +Nalin Dahyabhai +Nan Monnand Deng +Naoki Orii +Natalie Parker +Natanael Copa +Natasha Jarus +Nate Brennand +Nate Eagleson +Nate Jones +Nathan Hsieh +Nathan Kleyn +Nathan LeClaire +Nathan McCauley +Nathan Williams +Naveed Jamil +Neal McBurnett +Neil Horman +Neil Peterson +Nelson Chen +Neyazul Haque +Nghia Tran +Niall O'Higgins +Nicholas E. Rabenau +Nick Adcock +Nick DeCoursin +Nick Irvine +Nick Neisen +Nick Parker +Nick Payne +Nick Russo +Nick Stenning +Nick Stinemates +NickrenREN +Nicola Kabar +Nicolas Borboën +Nicolas De Loof +Nicolas Dudebout +Nicolas Goy +Nicolas Kaiser +Nicolas Sterchele +Nicolas V Castet +Nicolás Hock Isaza +Nigel Poulton +Nik Nyby +Nikhil Chawla +NikolaMandic +Nikolas Garofil +Nikolay Milovanov +Nirmal Mehta +Nishant Totla +NIWA Hideyuki +Noah Meyerhans +Noah Treuhaft +NobodyOnSE +noducks +Nolan Darilek +Noriki Nakamura +nponeccop +Nuutti Kotivuori +nzwsch +O.S. Tezer +objectified +Odin Ugedal +Oguz Bilgic +Oh Jinkyun +Ohad Schneider +ohmystack +Ole Reifschneider +Oliver Neal +Oliver Reason +Olivier Gambier +Olle Jonsson +Olli Janatuinen +Olly Pomeroy +Omri Shiv +Oriol Francès +Oskar Niburski +Otto Kekäläinen +Ouyang Liduo +Ovidio Mallo +Panagiotis Moustafellos +Paolo G. Giarrusso +Pascal +Pascal Bach +Pascal Borreli +Pascal Hartig +Patrick Böänziger +Patrick Devine +Patrick Hemmer +Patrick Stapleton +Patrik Cyvoct +pattichen +Paul +paul +Paul Annesley +Paul Bellamy +Paul Bowsher +Paul Furtado +Paul Hammond +Paul Jimenez +Paul Kehrer +Paul Lietar +Paul Liljenberg +Paul Morie +Paul Nasrat +Paul Weaver +Paulo Ribeiro +Pavel Lobashov +Pavel MatÄ›ja +Pavel Pletenev +Pavel Pospisil +Pavel Sutyrin +Pavel Tikhomirov +Pavlos Ratis +Pavol Vargovcik +Pawel Konczalski +Peeyush Gupta +Peggy Li +Pei Su +Peng Tao +Penghan Wang +Per Weijnitz +perhapszzy@sina.com +Peter Bourgon +Peter Braden +Peter Bücker +Peter Choi +Peter Dave Hello +Peter Edge +Peter Ericson +Peter Esbensen +Peter Jaffe +Peter Kang +Peter Malmgren +Peter Salvatore +Peter Volpe +Peter Waller +Petr Å vihlík +Phil +Phil Estes +Phil Spitler +Philip Alexander Etling +Philip Monroe +Philipp Gillé +Philipp Wahala +Philipp Weissensteiner +Phillip Alexander +phineas +pidster +Piergiuliano Bossi +Pierre +Pierre Carrier +Pierre Dal-Pra +Pierre Wacrenier +Pierre-Alain RIVIERE +Piotr Bogdan +pixelistik +Porjo +Poul Kjeldager Sørensen +Pradeep Chhetri +Pradip Dhara +Prasanna Gautam +Pratik Karki +Prayag Verma +Priya Wadhwa +Projjol Banerji +Przemek Hejman +Pure White +pysqz +Qiang Huang +Qinglan Peng +qudongfang +Quentin Brossard +Quentin Perez +Quentin Tayssier +r0n22 +Radostin Stoyanov +Rafal Jeczalik +Rafe Colton +Raghavendra K T +Raghuram Devarakonda +Raja Sami +Rajat Pandit +Rajdeep Dua +Ralf Sippl +Ralle +Ralph Bean +Ramkumar Ramachandra +Ramon Brooker +Ramon van Alteren +RaviTeja Pothana +Ray Tsang +ReadmeCritic +Recursive Madman +Reficul +Regan McCooey +Remi Rampin +Remy Suen +Renato Riccieri Santos Zannon +Renaud Gaubert +Rhys Hiltner +Ri Xu +Ricardo N Feliciano +Rich Moyse +Rich Seymour +Richard +Richard Burnison +Richard Harvey +Richard Mathie +Richard Metzler +Richard Scothern +Richo Healey +Rick Bradley +Rick van de Loo +Rick Wieman +Rik Nijessen +Riku Voipio +Riley Guerin +Ritesh H Shukla +Riyaz Faizullabhoy +Rob Gulewich +Rob Vesse +Robert Bachmann +Robert Bittle +Robert Obryk +Robert Schneider +Robert Stern +Robert Terhaar +Robert Wallis +Robert Wang +Roberto G. Hashioka +Roberto Muñoz Fernández +Robin Naundorf +Robin Schneider +Robin Speekenbrink +Robin Thoni +robpc +Rodolfo Carvalho +Rodrigo Vaz +Roel Van Nyen +Roger Peppe +Rohit Jnagal +Rohit Kadam +Rohit Kapur +Rojin George +Roland Huß +Roland Kammerer +Roland Moriz +Roma Sokolov +Roman Dudin +Roman Strashkin +Ron Smits +Ron Williams +Rong Gao +Rong Zhang +Rongxiang Song +root +root +root +root +Rory Hunter +Rory McCune +Ross Boucher +Rovanion Luckey +Royce Remer +Rozhnov Alexandr +Rudolph Gottesheim +Rui Cao +Rui Lopes +Ruilin Li +Runshen Zhu +Russ Magee +Ryan Abrams +Ryan Anderson +Ryan Aslett +Ryan Belgrave +Ryan Detzel +Ryan Fowler +Ryan Liu +Ryan McLaughlin +Ryan O'Donnell +Ryan Seto +Ryan Simmen +Ryan Stelly +Ryan Thomas +Ryan Trauntvein +Ryan Wallner +Ryan Zhang +ryancooper7 +RyanDeng +Ryo Nakao +Rémy Greinhofer +s. rannou +s00318865 +Sabin Basyal +Sachin Joshi +Sagar Hani +Sainath Grandhi +Sakeven Jiang +Salahuddin Khan +Sally O'Malley +Sam Abed +Sam Alba +Sam Bailey +Sam J Sharpe +Sam Neirinck +Sam Reis +Sam Rijs +Sam Whited +Sambuddha Basu +Sami Wagiaalla +Samuel Andaya +Samuel Dion-Girardeau +Samuel Karp +Samuel PHAN +Sandeep Bansal +Sankar சஙà¯à®•à®°à¯ +Sanket Saurav +Santhosh Manohar +sapphiredev +Sargun Dhillon +Sascha Andres +Sascha Grunert +SataQiu +Satnam Singh +Satoshi Amemiya +Satoshi Tagomori +Scott Bessler +Scott Collier +Scott Johnston +Scott Stamp +Scott Walls +sdreyesg +Sean Christopherson +Sean Cronin +Sean Lee +Sean McIntyre +Sean OMeara +Sean P. Kane +Sean Rodman +Sebastiaan van Steenis +Sebastiaan van Stijn +Senthil Kumar Selvaraj +Senthil Kumaran +SeongJae Park +Seongyeol Lim +Serge Hallyn +Sergey Alekseev +Sergey Evstifeev +Sergii Kabashniuk +Sergio Lopez +Serhat Gülçiçek +SeungUkLee +Sevki Hasirci +Shane Canon +Shane da Silva +Shaun Kaasten +shaunol +Shawn Landden +Shawn Siefkas +shawnhe +Shayne Wang +Shekhar Gulati +Sheng Yang +Shengbo Song +Shev Yan +Shih-Yuan Lee +Shijiang Wei +Shijun Qin +Shishir Mahajan +Shoubhik Bose +Shourya Sarcar +Shu-Wai Chow +shuai-z +Shukui Yang +Shuwei Hao +Sian Lerk Lau +Sidhartha Mani +sidharthamani +Silas Sewell +Silvan Jegen +Simão Reis +Simei He +Simon Barendse +Simon Eskildsen +Simon Ferquel +Simon Leinen +Simon Menke +Simon Taranto +Simon Vikstrom +Sindhu S +Sjoerd Langkemper +skanehira +Solganik Alexander +Solomon Hykes +Song Gao +Soshi Katsuta +Soulou +Spencer Brown +Spencer Smith +Sridatta Thatipamala +Sridhar Ratnakumar +Srini Brahmaroutu +Srinivasan Srivatsan +Staf Wagemakers +Stanislav Bondarenko +Steeve Morin +Stefan Berger +Stefan J. Wernli +Stefan Praszalowicz +Stefan S. +Stefan Scherer +Stefan Staudenmeyer +Stefan Weil +Stephan Spindler +Stephen Benjamin +Stephen Crosby +Stephen Day +Stephen Drake +Stephen Rust +Steve Desmond +Steve Dougherty +Steve Durrheimer +Steve Francia +Steve Koch +Steven Burgess +Steven Erenst +Steven Hartland +Steven Iveson +Steven Merrill +Steven Richards +Steven Taylor +Stig Larsson +Subhajit Ghosh +Sujith Haridasan +Sun Gengze <690388648@qq.com> +Sun Jianbo +Sune Keller +Sunny Gogoi +Suryakumar Sudar +Sven Dowideit +Swapnil Daingade +Sylvain Baubeau +Sylvain Bellemare +Sébastien +Sébastien HOUZÉ +Sébastien Luttringer +Sébastien Stormacq +Tabakhase +Tadej Janež +TAGOMORI Satoshi +tang0th +Tangi Colin +Tatsuki Sugiura +Tatsushi Inagaki +Taylan Isikdemir +Taylor Jones +Ted M. Young +Tehmasp Chaudhri +Tejaswini Duggaraju +Tejesh Mehta +terryding77 <550147740@qq.com> +tgic +Thatcher Peskens +theadactyl +Thell 'Bo' Fowler +Thermionix +Thijs Terlouw +Thomas Bikeev +Thomas Frössman +Thomas Gazagnaire +Thomas Grainger +Thomas Hansen +Thomas Leonard +Thomas Léveil +Thomas Orozco +Thomas Riccardi +Thomas Schroeter +Thomas Sjögren +Thomas Swift +Thomas Tanaka +Thomas Texier +Ti Zhou +Tianon Gravi +Tianyi Wang +Tibor Vass +Tiffany Jernigan +Tiffany Low +Tim +Tim Bart +Tim Bosse +Tim Dettrick +Tim Düsterhus +Tim Hockin +Tim Potter +Tim Ruffles +Tim Smith +Tim Terhorst +Tim Wang +Tim Waugh +Tim Wraight +Tim Zju <21651152@zju.edu.cn> +timfeirg +Timothy Hobbs +tjwebb123 +tobe +Tobias Bieniek +Tobias Bradtke +Tobias Gesellchen +Tobias Klauser +Tobias Munk +Tobias Schmidt +Tobias Schwab +Todd Crane +Todd Lunter +Todd Whiteman +Toli Kuznets +Tom Barlow +Tom Booth +Tom Denham +Tom Fotherby +Tom Howe +Tom Hulihan +Tom Maaswinkel +Tom Sweeney +Tom Wilkie +Tom X. Tobin +Tomas Tomecek +Tomasz Kopczynski +Tomasz Lipinski +Tomasz Nurkiewicz +Tommaso Visconti +Tomáš HrÄka +Tonny Xu +Tony Abboud +Tony Daws +Tony Miller +toogley +Torstein Husebø +Tõnis Tiigi +tpng +tracylihui <793912329@qq.com> +Trapier Marshall +Travis Cline +Travis Thieman +Trent Ogren +Trevor +Trevor Pounds +Trevor Sullivan +Trishna Guha +Tristan Carel +Troy Denton +Tycho Andersen +Tyler Brock +Tyler Brown +Tzu-Jung Lee +uhayate +Ulysse Carion +Umesh Yadav +Utz Bacher +vagrant +Vaidas Jablonskis +vanderliang +Veres Lajos +Victor Algaze +Victor Coisne +Victor Costan +Victor I. Wood +Victor Lyuboslavsky +Victor Marmol +Victor Palma +Victor Vieux +Victoria Bialas +Vijaya Kumar K +Vikram bir Singh +Viktor Stanchev +Viktor Vojnovski +VinayRaghavanKS +Vincent Batts +Vincent Bernat +Vincent Demeester +Vincent Giersch +Vincent Mayers +Vincent Woo +Vinod Kulkarni +Vishal Doshi +Vishnu Kannan +Vitaly Ostrosablin +Vitor Monteiro +Vivek Agarwal +Vivek Dasgupta +Vivek Goyal +Vladimir Bulyga +Vladimir Kirillov +Vladimir Pouzanov +Vladimir Rutsky +Vladimir Varankin +VladimirAus +Vlastimil Zeman +Vojtech Vitek (V-Teq) +waitingkuo +Walter Leibbrandt +Walter Stanish +Wang Chao +Wang Guoliang +Wang Jie +Wang Long +Wang Ping +Wang Xing +Wang Yuexiao +Ward Vandewege +WarheadsSE +Wassim Dhif +Wayne Chang +Wayne Song +Weerasak Chongnguluam +Wei Fu +Wei Wu +Wei-Ting Kuo +weipeng +weiyan +Weiyang Zhu +Wen Cheng Ma +Wendel Fleming +Wenjun Tang +Wenkai Yin +Wentao Zhang +Wenxuan Zhao +Wenyu You <21551128@zju.edu.cn> +Wenzhi Liang +Wes Morgan +Wewang Xiaorenfine +Wiktor Kwapisiewicz +Will Dietz +Will Rouesnel +Will Weaver +willhf +William Delanoue +William Henry +William Hubbs +William Martin +William Riancho +William Thurston +WiseTrem +Wolfgang Powisch +Wonjun Kim +xamyzhao +Xian Chaobo +Xianglin Gao +Xianlu Bird +Xiao YongBiao +XiaoBing Jiang +Xiaodong Zhang +Xiaoxi He +Xiaoxu Chen +Xiaoyu Zhang +xichengliudui <1693291525@qq.com> +xiekeyang +Ximo Guanter Gonzálbez +Xinbo Weng +Xinfeng Liu +Xinzi Zhou +Xiuming Chen +Xuecong Liao +xuzhaokui +Yadnyawalkya Tale +Yahya +YAMADA Tsuyoshi +Yamasaki Masahide +Yan Feng +Yang Bai +Yang Pengfei +yangchenliang +Yanqiang Miao +Yao Zaiyong +Yash Murty +Yassine Tijani +Yasunori Mahata +Yazhong Liu +Yestin Sun +Yi EungJun +Yibai Zhang +Yihang Ho +Ying Li +Yohei Ueda +Yong Tang +Yongxin Li +Yongzhi Pan +Yosef Fertel +You-Sheng Yang (楊有å‹) +youcai +Youcef YEKHLEF +Yu Changchun +Yu Chengxia +Yu Peng +Yu-Ju Hong +Yuan Sun +Yuanhong Peng +Yue Zhang +Yuhao Fang +Yuichiro Kaneko +Yunxiang Huang +Yurii Rashkovskii +Yusuf Tarık Günaydın +Yves Junqueira +Zac Dover +Zach Borboa +Zachary Jaffee +Zain Memon +Zaiste! +Zane DeGraffenried +Zefan Li +Zen Lin(Zhinan Lin) +Zhang Kun +Zhang Wei +Zhang Wentao +ZhangHang +zhangxianwei +Zhenan Ye <21551168@zju.edu.cn> +zhenghenghuo +Zhenhai Gao +Zhenkun Bi +Zhou Hao +Zhoulin Xie +Zhu Guihua +Zhu Kunjia +Zhuoyun Wei +Ziheng Liu +Zilin Du +zimbatm +Ziming Dong +ZJUshuaizhou <21551191@zju.edu.cn> +zmarouf +Zoltan Tombol +Zou Yu +zqh +Zuhayr Elahi +Zunayed Ali +Ãlex González +Ãlvaro Lázaro +Ãtila Camurça Alves +å°¹å‰å³° +å¾ä¿Šæ° +慕陶 +æ通 +黄艳红00139573 diff --git a/vendor/github.com/docker/docker/api/types/client.go b/vendor/github.com/docker/docker/api/types/client.go index fe90617eec35..9c464b73e25d 100644 --- a/vendor/github.com/docker/docker/api/types/client.go +++ b/vendor/github.com/docker/docker/api/types/client.go @@ -205,7 +205,7 @@ const ( // BuilderV1 is the first generation builder in docker daemon BuilderV1 BuilderVersion = "1" // BuilderBuildKit is builder based on moby/buildkit project - BuilderBuildKit = "2" + BuilderBuildKit BuilderVersion = "2" ) // ImageBuildResponse holds information @@ -265,7 +265,7 @@ type ImagePullOptions struct { // if the privilege request fails. type RequestPrivilegeFunc func() (string, error) -//ImagePushOptions holds information to push images. +// ImagePushOptions holds information to push images. type ImagePushOptions ImagePullOptions // ImageRemoveOptions holds parameters to remove images. @@ -363,6 +363,10 @@ type ServiceUpdateOptions struct { // ServiceListOptions holds parameters to list services with. type ServiceListOptions struct { Filters filters.Args + + // Status indicates whether the server should include the service task + // count of running and desired tasks. + Status bool } // ServiceInspectOptions holds parameters related to the "service inspect" diff --git a/vendor/github.com/docker/docker/api/types/container/container_changes.go b/vendor/github.com/docker/docker/api/types/container/container_changes.go index 222d141007ec..16dd5019eef8 100644 --- a/vendor/github.com/docker/docker/api/types/container/container_changes.go +++ b/vendor/github.com/docker/docker/api/types/container/container_changes.go @@ -1,8 +1,7 @@ package container // import "github.com/docker/docker/api/types/container" // ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` +// Code generated by `swagger generate operation`. DO NOT EDIT. // // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- diff --git a/vendor/github.com/docker/docker/api/types/container/container_create.go b/vendor/github.com/docker/docker/api/types/container/container_create.go index 1ec9c3728ba8..d0c852f84d5c 100644 --- a/vendor/github.com/docker/docker/api/types/container/container_create.go +++ b/vendor/github.com/docker/docker/api/types/container/container_create.go @@ -1,8 +1,7 @@ package container // import "github.com/docker/docker/api/types/container" // ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` +// Code generated by `swagger generate operation`. DO NOT EDIT. // // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- diff --git a/vendor/github.com/docker/docker/api/types/container/container_top.go b/vendor/github.com/docker/docker/api/types/container/container_top.go index f8a606687cb2..f0ee9dde707d 100644 --- a/vendor/github.com/docker/docker/api/types/container/container_top.go +++ b/vendor/github.com/docker/docker/api/types/container/container_top.go @@ -1,8 +1,7 @@ package container // import "github.com/docker/docker/api/types/container" // ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` +// Code generated by `swagger generate operation`. DO NOT EDIT. // // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- diff --git a/vendor/github.com/docker/docker/api/types/container/container_update.go b/vendor/github.com/docker/docker/api/types/container/container_update.go index 33addedf7791..c10f175ea82f 100644 --- a/vendor/github.com/docker/docker/api/types/container/container_update.go +++ b/vendor/github.com/docker/docker/api/types/container/container_update.go @@ -1,8 +1,7 @@ package container // import "github.com/docker/docker/api/types/container" // ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` +// Code generated by `swagger generate operation`. DO NOT EDIT. // // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- diff --git a/vendor/github.com/docker/docker/api/types/container/container_wait.go b/vendor/github.com/docker/docker/api/types/container/container_wait.go index 94b6a20e159b..49e05ae66944 100644 --- a/vendor/github.com/docker/docker/api/types/container/container_wait.go +++ b/vendor/github.com/docker/docker/api/types/container/container_wait.go @@ -1,8 +1,7 @@ package container // import "github.com/docker/docker/api/types/container" // ---------------------------------------------------------------------------- -// DO NOT EDIT THIS FILE -// This file was generated by `swagger generate operation` +// Code generated by `swagger generate operation`. DO NOT EDIT. // // See hack/generate-swagger-api.sh // ---------------------------------------------------------------------------- diff --git a/vendor/github.com/docker/docker/api/types/container/host_config.go b/vendor/github.com/docker/docker/api/types/container/host_config.go index c3de3d976a57..b8a4b3aa62bc 100644 --- a/vendor/github.com/docker/docker/api/types/container/host_config.go +++ b/vendor/github.com/docker/docker/api/types/container/host_config.go @@ -7,9 +7,32 @@ import ( "github.com/docker/docker/api/types/mount" "github.com/docker/docker/api/types/strslice" "github.com/docker/go-connections/nat" - "github.com/docker/go-units" + units "github.com/docker/go-units" ) +// CgroupnsMode represents the cgroup namespace mode of the container +type CgroupnsMode string + +// IsPrivate indicates whether the container uses its own private cgroup namespace +func (c CgroupnsMode) IsPrivate() bool { + return c == "private" +} + +// IsHost indicates whether the container shares the host's cgroup namespace +func (c CgroupnsMode) IsHost() bool { + return c == "host" +} + +// IsEmpty indicates whether the container cgroup namespace mode is unset +func (c CgroupnsMode) IsEmpty() bool { + return c == "" +} + +// Valid indicates whether the cgroup namespace mode is valid +func (c CgroupnsMode) Valid() bool { + return c.IsEmpty() || c.IsPrivate() || c.IsHost() +} + // Isolation represents the isolation technology of a container. The supported // values are platform specific type Isolation string @@ -122,7 +145,7 @@ func (n NetworkMode) ConnectedContainer() string { return "" } -//UserDefined indicates user-created network +// UserDefined indicates user-created network func (n NetworkMode) UserDefined() string { if n.IsUserDefined() { return string(n) @@ -381,9 +404,10 @@ type HostConfig struct { CapAdd strslice.StrSlice // List of kernel capabilities to add to the container CapDrop strslice.StrSlice // List of kernel capabilities to remove from the container Capabilities []string `json:"Capabilities"` // List of kernel capabilities to be available for container (this overrides the default set) - DNS []string `json:"Dns"` // List of DNS server to lookup - DNSOptions []string `json:"DnsOptions"` // List of DNSOption to look for - DNSSearch []string `json:"DnsSearch"` // List of DNSSearch to look for + CgroupnsMode CgroupnsMode // Cgroup namespace mode to use for the container + DNS []string `json:"Dns"` // List of DNS server to lookup + DNSOptions []string `json:"DnsOptions"` // List of DNSOption to look for + DNSSearch []string `json:"DnsSearch"` // List of DNSSearch to look for ExtraHosts []string // List of extra hosts GroupAdd []string // List of additional groups that the container process will run as IpcMode IpcMode // IPC namespace to use for the container diff --git a/vendor/github.com/docker/docker/api/types/error_response_ext.go b/vendor/github.com/docker/docker/api/types/error_response_ext.go new file mode 100644 index 000000000000..f84f034cd545 --- /dev/null +++ b/vendor/github.com/docker/docker/api/types/error_response_ext.go @@ -0,0 +1,6 @@ +package types + +// Error returns the error message +func (e ErrorResponse) Error() string { + return e.Message +} diff --git a/vendor/github.com/docker/docker/api/types/filters/parse.go b/vendor/github.com/docker/docker/api/types/filters/parse.go index 0bd2e1e1853b..4bc91cffd6e5 100644 --- a/vendor/github.com/docker/docker/api/types/filters/parse.go +++ b/vendor/github.com/docker/docker/api/types/filters/parse.go @@ -66,7 +66,7 @@ func ToJSON(a Args) (string, error) { // then the encoded format will use an older legacy format where the values are a // list of strings, instead of a set. // -// Deprecated: Use ToJSON +// Deprecated: do not use in any new code; use ToJSON instead func ToParamWithVersion(version string, a Args) (string, error) { if a.Len() == 0 { return "", nil @@ -154,7 +154,7 @@ func (args Args) Len() int { func (args Args) MatchKVList(key string, sources map[string]string) bool { fieldValues := args.fields[key] - //do not filter if there is no filter set or cannot determine filter + // do not filter if there is no filter set or cannot determine filter if len(fieldValues) == 0 { return true } @@ -200,7 +200,7 @@ func (args Args) Match(field, source string) bool { // ExactMatch returns true if the source matches exactly one of the values. func (args Args) ExactMatch(key, source string) bool { fieldValues, ok := args.fields[key] - //do not filter if there is no filter set or cannot determine filter + // do not filter if there is no filter set or cannot determine filter if !ok || len(fieldValues) == 0 { return true } @@ -213,7 +213,7 @@ func (args Args) ExactMatch(key, source string) bool { // matches exactly the value. func (args Args) UniqueExactMatch(key, source string) bool { fieldValues := args.fields[key] - //do not filter if there is no filter set or cannot determine filter + // do not filter if there is no filter set or cannot determine filter if len(fieldValues) == 0 { return true } diff --git a/vendor/github.com/docker/docker/api/types/network/network.go b/vendor/github.com/docker/docker/api/types/network/network.go index 71e97338fdc8..7927dbfffbc1 100644 --- a/vendor/github.com/docker/docker/api/types/network/network.go +++ b/vendor/github.com/docker/docker/api/types/network/network.go @@ -13,7 +13,7 @@ type Address struct { // IPAM represents IP Address Management type IPAM struct { Driver string - Options map[string]string //Per network IPAM driver options + Options map[string]string // Per network IPAM driver options Config []IPAMConfig } diff --git a/vendor/github.com/docker/docker/api/types/registry/registry.go b/vendor/github.com/docker/docker/api/types/registry/registry.go index 8789ad3b3210..53e47084c8d5 100644 --- a/vendor/github.com/docker/docker/api/types/registry/registry.go +++ b/vendor/github.com/docker/docker/api/types/registry/registry.go @@ -4,7 +4,7 @@ import ( "encoding/json" "net" - "github.com/opencontainers/image-spec/specs-go/v1" + v1 "github.com/opencontainers/image-spec/specs-go/v1" ) // ServiceConfig stores daemon registry services configuration. diff --git a/vendor/github.com/docker/docker/api/types/swarm/container.go b/vendor/github.com/docker/docker/api/types/swarm/container.go index 48190c1762f1..5bbedfcf682a 100644 --- a/vendor/github.com/docker/docker/api/types/swarm/container.go +++ b/vendor/github.com/docker/docker/api/types/swarm/container.go @@ -67,10 +67,11 @@ type ContainerSpec struct { // The format of extra hosts on swarmkit is specified in: // http://man7.org/linux/man-pages/man5/hosts.5.html // IP_address canonical_hostname [aliases...] - Hosts []string `json:",omitempty"` - DNSConfig *DNSConfig `json:",omitempty"` - Secrets []*SecretReference `json:",omitempty"` - Configs []*ConfigReference `json:",omitempty"` - Isolation container.Isolation `json:",omitempty"` - Sysctls map[string]string `json:",omitempty"` + Hosts []string `json:",omitempty"` + DNSConfig *DNSConfig `json:",omitempty"` + Secrets []*SecretReference `json:",omitempty"` + Configs []*ConfigReference `json:",omitempty"` + Isolation container.Isolation `json:",omitempty"` + Sysctls map[string]string `json:",omitempty"` + Capabilities []string `json:",omitempty"` } diff --git a/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.pb.go b/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.pb.go index 1fdc9b043613..e45045866a6e 100644 --- a/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.pb.go +++ b/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.pb.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-gogo. +// Code generated by protoc-gen-gogo. DO NOT EDIT. // source: plugin.proto -// DO NOT EDIT! /* Package runtime is a generated protocol buffer package. @@ -38,6 +37,7 @@ type PluginSpec struct { Remote string `protobuf:"bytes,2,opt,name=remote,proto3" json:"remote,omitempty"` Privileges []*PluginPrivilege `protobuf:"bytes,3,rep,name=privileges" json:"privileges,omitempty"` Disabled bool `protobuf:"varint,4,opt,name=disabled,proto3" json:"disabled,omitempty"` + Env []string `protobuf:"bytes,5,rep,name=env" json:"env,omitempty"` } func (m *PluginSpec) Reset() { *m = PluginSpec{} } @@ -73,6 +73,13 @@ func (m *PluginSpec) GetDisabled() bool { return false } +func (m *PluginSpec) GetEnv() []string { + if m != nil { + return m.Env + } + return nil +} + // PluginPrivilege describes a permission the user has to accept // upon installing a plugin. type PluginPrivilege struct { @@ -160,6 +167,21 @@ func (m *PluginSpec) MarshalTo(dAtA []byte) (int, error) { } i++ } + if len(m.Env) > 0 { + for _, s := range m.Env { + dAtA[i] = 0x2a + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } + } return i, nil } @@ -208,24 +230,6 @@ func (m *PluginPrivilege) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func encodeFixed64Plugin(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Plugin(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} func encodeVarintPlugin(dAtA []byte, offset int, v uint64) int { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -255,6 +259,12 @@ func (m *PluginSpec) Size() (n int) { if m.Disabled { n += 2 } + if len(m.Env) > 0 { + for _, s := range m.Env { + l = len(s) + n += 1 + l + sovPlugin(uint64(l)) + } + } return n } @@ -429,6 +439,35 @@ func (m *PluginSpec) Unmarshal(dAtA []byte) error { } } m.Disabled = bool(v != 0) + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Env", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPlugin + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPlugin + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Env = append(m.Env, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPlugin(dAtA[iNdEx:]) @@ -695,18 +734,21 @@ var ( func init() { proto.RegisterFile("plugin.proto", fileDescriptorPlugin) } var fileDescriptorPlugin = []byte{ - // 196 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0xc8, 0x29, 0x4d, - 0xcf, 0xcc, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x57, 0x6a, 0x63, 0xe4, 0xe2, 0x0a, 0x00, 0x0b, - 0x04, 0x17, 0xa4, 0x26, 0x0b, 0x09, 0x71, 0xb1, 0xe4, 0x25, 0xe6, 0xa6, 0x4a, 0x30, 0x2a, 0x30, - 0x6a, 0x70, 0x06, 0x81, 0xd9, 0x42, 0x62, 0x5c, 0x6c, 0x45, 0xa9, 0xb9, 0xf9, 0x25, 0xa9, 0x12, - 0x4c, 0x60, 0x51, 0x28, 0x4f, 0xc8, 0x80, 0x8b, 0xab, 0xa0, 0x28, 0xb3, 0x2c, 0x33, 0x27, 0x35, - 0x3d, 0xb5, 0x58, 0x82, 0x59, 0x81, 0x59, 0x83, 0xdb, 0x48, 0x40, 0x0f, 0x62, 0x58, 0x00, 0x4c, - 0x22, 0x08, 0x49, 0x8d, 0x90, 0x14, 0x17, 0x47, 0x4a, 0x66, 0x71, 0x62, 0x52, 0x4e, 0x6a, 0x8a, - 0x04, 0x8b, 0x02, 0xa3, 0x06, 0x47, 0x10, 0x9c, 0xaf, 0x14, 0xcb, 0xc5, 0x8f, 0xa6, 0x15, 0xab, - 0x63, 0x14, 0xb8, 0xb8, 0x53, 0x52, 0x8b, 0x93, 0x8b, 0x32, 0x0b, 0x4a, 0x32, 0xf3, 0xf3, 0xa0, - 0x2e, 0x42, 0x16, 0x12, 0x12, 0xe1, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x05, 0xbb, 0x88, 0x33, - 0x08, 0xc2, 0x71, 0xe2, 0x39, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, - 0x18, 0x93, 0xd8, 0xc0, 0x9e, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xb8, 0x84, 0xad, 0x79, - 0x0c, 0x01, 0x00, 0x00, + // 256 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x4d, 0x4b, 0xc3, 0x30, + 0x18, 0xc7, 0x89, 0xdd, 0xc6, 0xfa, 0x4c, 0x70, 0x04, 0x91, 0xe2, 0xa1, 0x94, 0x9d, 0x7a, 0x6a, + 0x45, 0x2f, 0x82, 0x37, 0x0f, 0x9e, 0x47, 0xbc, 0x09, 0x1e, 0xd2, 0xf6, 0xa1, 0x06, 0x9b, 0x17, + 0x92, 0xb4, 0xe2, 0x37, 0xf1, 0x23, 0x79, 0xf4, 0x23, 0x48, 0x3f, 0x89, 0x98, 0x75, 0x32, 0x64, + 0xa7, 0xff, 0x4b, 0xc2, 0x9f, 0x1f, 0x0f, 0x9c, 0x9a, 0xae, 0x6f, 0x85, 0x2a, 0x8c, 0xd5, 0x5e, + 0x6f, 0x3e, 0x08, 0xc0, 0x36, 0x14, 0x8f, 0x06, 0x6b, 0x4a, 0x61, 0xa6, 0xb8, 0xc4, 0x84, 0x64, + 0x24, 0x8f, 0x59, 0xf0, 0xf4, 0x02, 0x16, 0x16, 0xa5, 0xf6, 0x98, 0x9c, 0x84, 0x76, 0x4a, 0xf4, + 0x0a, 0xc0, 0x58, 0x31, 0x88, 0x0e, 0x5b, 0x74, 0x49, 0x94, 0x45, 0xf9, 0xea, 0x7a, 0x5d, 0xec, + 0xc6, 0xb6, 0xfb, 0x07, 0x76, 0xf0, 0x87, 0x5e, 0xc2, 0xb2, 0x11, 0x8e, 0x57, 0x1d, 0x36, 0xc9, + 0x2c, 0x23, 0xf9, 0x92, 0xfd, 0x65, 0xba, 0x86, 0x08, 0xd5, 0x90, 0xcc, 0xb3, 0x28, 0x8f, 0xd9, + 0xaf, 0xdd, 0x3c, 0xc3, 0xd9, 0xbf, 0xb1, 0xa3, 0x78, 0x19, 0xac, 0x1a, 0x74, 0xb5, 0x15, 0xc6, + 0x0b, 0xad, 0x26, 0xc6, 0xc3, 0x8a, 0x9e, 0xc3, 0x7c, 0xe0, 0x5d, 0x8f, 0x81, 0x31, 0x66, 0xbb, + 0x70, 0xff, 0xf0, 0x39, 0xa6, 0xe4, 0x6b, 0x4c, 0xc9, 0xf7, 0x98, 0x92, 0xa7, 0xdb, 0x56, 0xf8, + 0x97, 0xbe, 0x2a, 0x6a, 0x2d, 0xcb, 0x46, 0xd7, 0xaf, 0x68, 0xf7, 0xc2, 0x8d, 0x28, 0xfd, 0xbb, + 0x41, 0x57, 0xba, 0x37, 0x6e, 0x65, 0x69, 0x7b, 0xe5, 0x85, 0xc4, 0xbb, 0x49, 0xab, 0x45, 0x38, + 0xe4, 0xcd, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x99, 0xa8, 0xd9, 0x9b, 0x58, 0x01, 0x00, 0x00, } diff --git a/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.proto b/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.proto index 6d63b7783fd9..9ef169046b4f 100644 --- a/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.proto +++ b/vendor/github.com/docker/docker/api/types/swarm/runtime/plugin.proto @@ -9,6 +9,7 @@ message PluginSpec { string remote = 2; repeated PluginPrivilege privileges = 3; bool disabled = 4; + repeated string env = 5; } // PluginPrivilege describes a permission the user has to accept diff --git a/vendor/github.com/docker/docker/api/types/swarm/service.go b/vendor/github.com/docker/docker/api/types/swarm/service.go index abf192e75941..6eb452d24d12 100644 --- a/vendor/github.com/docker/docker/api/types/swarm/service.go +++ b/vendor/github.com/docker/docker/api/types/swarm/service.go @@ -10,6 +10,17 @@ type Service struct { PreviousSpec *ServiceSpec `json:",omitempty"` Endpoint Endpoint `json:",omitempty"` UpdateStatus *UpdateStatus `json:",omitempty"` + + // ServiceStatus is an optional, extra field indicating the number of + // desired and running tasks. It is provided primarily as a shortcut to + // calculating these values client-side, which otherwise would require + // listing all tasks for a service, an operation that could be + // computation and network expensive. + ServiceStatus *ServiceStatus `json:",omitempty"` + + // JobStatus is the status of a Service which is in one of ReplicatedJob or + // GlobalJob modes. It is absent on Replicated and Global services. + JobStatus *JobStatus `json:",omitempty"` } // ServiceSpec represents the spec of a service. @@ -32,8 +43,10 @@ type ServiceSpec struct { // ServiceMode represents the mode of a service. type ServiceMode struct { - Replicated *ReplicatedService `json:",omitempty"` - Global *GlobalService `json:",omitempty"` + Replicated *ReplicatedService `json:",omitempty"` + Global *GlobalService `json:",omitempty"` + ReplicatedJob *ReplicatedJob `json:",omitempty"` + GlobalJob *GlobalJob `json:",omitempty"` } // UpdateState is the state of a service update. @@ -70,6 +83,32 @@ type ReplicatedService struct { // GlobalService is a kind of ServiceMode. type GlobalService struct{} +// ReplicatedJob is the a type of Service which executes a defined Tasks +// in parallel until the specified number of Tasks have succeeded. +type ReplicatedJob struct { + // MaxConcurrent indicates the maximum number of Tasks that should be + // executing simultaneously for this job at any given time. There may be + // fewer Tasks that MaxConcurrent executing simultaneously; for example, if + // there are fewer than MaxConcurrent tasks needed to reach + // TotalCompletions. + // + // If this field is empty, it will default to a max concurrency of 1. + MaxConcurrent *uint64 `json:",omitempty"` + + // TotalCompletions is the total number of Tasks desired to run to + // completion. + // + // If this field is empty, the value of MaxConcurrent will be used. + TotalCompletions *uint64 `json:",omitempty"` +} + +// GlobalJob is the type of a Service which executes a Task on every Node +// matching the Service's placement constraints. These tasks run to completion +// and then exit. +// +// This type is deliberately empty. +type GlobalJob struct{} + const ( // UpdateFailureActionPause PAUSE UpdateFailureActionPause = "pause" @@ -122,3 +161,42 @@ type UpdateConfig struct { // started, or the new task is started before the old task is shut down. Order string } + +// ServiceStatus represents the number of running tasks in a service and the +// number of tasks desired to be running. +type ServiceStatus struct { + // RunningTasks is the number of tasks for the service actually in the + // Running state + RunningTasks uint64 + + // DesiredTasks is the number of tasks desired to be running by the + // service. For replicated services, this is the replica count. For global + // services, this is computed by taking the number of tasks with desired + // state of not-Shutdown. + DesiredTasks uint64 + + // CompletedTasks is the number of tasks in the state Completed, if this + // service is in ReplicatedJob or GlobalJob mode. This field must be + // cross-referenced with the service type, because the default value of 0 + // may mean that a service is not in a job mode, or it may mean that the + // job has yet to complete any tasks. + CompletedTasks uint64 +} + +// JobStatus is the status of a job-type service. +type JobStatus struct { + // JobIteration is a value increased each time a Job is executed, + // successfully or otherwise. "Executed", in this case, means the job as a + // whole has been started, not that an individual Task has been launched. A + // job is "Executed" when its ServiceSpec is updated. JobIteration can be + // used to disambiguate Tasks belonging to different executions of a job. + // + // Though JobIteration will increase with each subsequent execution, it may + // not necessarily increase by 1, and so JobIteration should not be used to + // keep track of the number of times a job has been executed. + JobIteration Version + + // LastExecution is the time that the job was last executed, as observed by + // Swarm manager. + LastExecution time.Time `json:",omitempty"` +} diff --git a/vendor/github.com/docker/docker/api/types/swarm/task.go b/vendor/github.com/docker/docker/api/types/swarm/task.go index d5a57df5db5a..9f193df37cb6 100644 --- a/vendor/github.com/docker/docker/api/types/swarm/task.go +++ b/vendor/github.com/docker/docker/api/types/swarm/task.go @@ -56,6 +56,12 @@ type Task struct { DesiredState TaskState `json:",omitempty"` NetworksAttachments []NetworkAttachment `json:",omitempty"` GenericResources []GenericResource `json:",omitempty"` + + // JobIteration is the JobIteration of the Service that this Task was + // spawned from, if the Service is a ReplicatedJob or GlobalJob. This is + // used to determine which Tasks belong to which run of the job. This field + // is absent if the Service mode is Replicated or Global. + JobIteration *Version `json:",omitempty"` } // TaskSpec represents the spec of a task. diff --git a/vendor/github.com/docker/docker/api/types/types.go b/vendor/github.com/docker/docker/api/types/types.go index a39ffcb7be2d..79e6dd8436b2 100644 --- a/vendor/github.com/docker/docker/api/types/types.go +++ b/vendor/github.com/docker/docker/api/types/types.go @@ -39,6 +39,7 @@ type ImageInspect struct { Author string Config *container.Config Architecture string + Variant string `json:",omitempty"` Os string OsVersion string `json:",omitempty"` Size int64 @@ -153,7 +154,7 @@ type Info struct { Images int Driver string DriverStatus [][2]string - SystemStatus [][2]string + SystemStatus [][2]string `json:",omitempty"` // SystemStatus is only propagated by the Swarm standalone API Plugins PluginsInfo MemoryLimit bool SwapLimit bool @@ -177,6 +178,7 @@ type Info struct { NEventsListener int KernelVersion string OperatingSystem string + OSVersion string OSType string Architecture string IndexServerAddress string @@ -192,8 +194,8 @@ type Info struct { Labels []string ExperimentalBuild bool ServerVersion string - ClusterStore string - ClusterAdvertise string + ClusterStore string `json:",omitempty"` // Deprecated: host-discovery and overlay networks with external k/v stores are deprecated + ClusterAdvertise string `json:",omitempty"` // Deprecated: host-discovery and overlay networks with external k/v stores are deprecated Runtimes map[string]Runtime DefaultRuntime string Swarm swarm.Info @@ -316,7 +318,7 @@ type ContainerState struct { } // ContainerNode stores information about the node that a container -// is running on. It's only available in Docker Swarm +// is running on. It's only used by the Docker Swarm standalone API type ContainerNode struct { ID string IPAddress string `json:"IP"` @@ -340,7 +342,7 @@ type ContainerJSONBase struct { HostnamePath string HostsPath string LogPath string - Node *ContainerNode `json:",omitempty"` + Node *ContainerNode `json:",omitempty"` // Node is only propagated by Docker Swarm standalone API Name string RestartCount int Driver string diff --git a/vendor/github.com/docker/docker/oci/caps/defaults.go b/vendor/github.com/docker/docker/oci/caps/defaults.go new file mode 100644 index 000000000000..242ee5811d2a --- /dev/null +++ b/vendor/github.com/docker/docker/oci/caps/defaults.go @@ -0,0 +1,21 @@ +package caps // import "github.com/docker/docker/oci/caps" + +// DefaultCapabilities returns a Linux kernel default capabilities +func DefaultCapabilities() []string { + return []string{ + "CAP_CHOWN", + "CAP_DAC_OVERRIDE", + "CAP_FSETID", + "CAP_FOWNER", + "CAP_MKNOD", + "CAP_NET_RAW", + "CAP_SETGID", + "CAP_SETUID", + "CAP_SETFCAP", + "CAP_SETPCAP", + "CAP_NET_BIND_SERVICE", + "CAP_SYS_CHROOT", + "CAP_KILL", + "CAP_AUDIT_WRITE", + } +} diff --git a/vendor/github.com/docker/docker/opts/address_pools.go b/vendor/github.com/docker/docker/opts/address_pools.go deleted file mode 100644 index 9b27a62853c6..000000000000 --- a/vendor/github.com/docker/docker/opts/address_pools.go +++ /dev/null @@ -1,84 +0,0 @@ -package opts - -import ( - "encoding/csv" - "encoding/json" - "fmt" - "strconv" - "strings" - - types "github.com/docker/libnetwork/ipamutils" -) - -// PoolsOpt is a Value type for parsing the default address pools definitions -type PoolsOpt struct { - values []*types.NetworkToSplit -} - -// UnmarshalJSON fills values structure info from JSON input -func (p *PoolsOpt) UnmarshalJSON(raw []byte) error { - return json.Unmarshal(raw, &(p.values)) -} - -// Set predefined pools -func (p *PoolsOpt) Set(value string) error { - csvReader := csv.NewReader(strings.NewReader(value)) - fields, err := csvReader.Read() - if err != nil { - return err - } - - poolsDef := types.NetworkToSplit{} - - for _, field := range fields { - parts := strings.SplitN(field, "=", 2) - if len(parts) != 2 { - return fmt.Errorf("invalid field '%s' must be a key=value pair", field) - } - - key := strings.ToLower(parts[0]) - value := strings.ToLower(parts[1]) - - switch key { - case "base": - poolsDef.Base = value - case "size": - size, err := strconv.Atoi(value) - if err != nil { - return fmt.Errorf("invalid size value: %q (must be integer): %v", value, err) - } - poolsDef.Size = size - default: - return fmt.Errorf("unexpected key '%s' in '%s'", key, field) - } - } - - p.values = append(p.values, &poolsDef) - - return nil -} - -// Type returns the type of this option -func (p *PoolsOpt) Type() string { - return "pool-options" -} - -// String returns a string repr of this option -func (p *PoolsOpt) String() string { - var pools []string - for _, pool := range p.values { - repr := fmt.Sprintf("%s %d", pool.Base, pool.Size) - pools = append(pools, repr) - } - return strings.Join(pools, ", ") -} - -// Value returns the mounts -func (p *PoolsOpt) Value() []*types.NetworkToSplit { - return p.values -} - -// Name returns the flag name of this option -func (p *PoolsOpt) Name() string { - return "default-address-pools" -} diff --git a/vendor/github.com/docker/docker/opts/env.go b/vendor/github.com/docker/docker/opts/env.go deleted file mode 100644 index f6e5e9074d67..000000000000 --- a/vendor/github.com/docker/docker/opts/env.go +++ /dev/null @@ -1,48 +0,0 @@ -package opts // import "github.com/docker/docker/opts" - -import ( - "fmt" - "os" - "runtime" - "strings" - - "github.com/pkg/errors" -) - -// ValidateEnv validates an environment variable and returns it. -// If no value is specified, it returns the current value using os.Getenv. -// -// As on ParseEnvFile and related to #16585, environment variable names -// are not validate what so ever, it's up to application inside docker -// to validate them or not. -// -// The only validation here is to check if name is empty, per #25099 -func ValidateEnv(val string) (string, error) { - arr := strings.Split(val, "=") - if arr[0] == "" { - return "", errors.Errorf("invalid environment variable: %s", val) - } - if len(arr) > 1 { - return val, nil - } - if !doesEnvExist(val) { - return val, nil - } - return fmt.Sprintf("%s=%s", val, os.Getenv(val)), nil -} - -func doesEnvExist(name string) bool { - for _, entry := range os.Environ() { - parts := strings.SplitN(entry, "=", 2) - if runtime.GOOS == "windows" { - // Environment variable are case-insensitive on Windows. PaTh, path and PATH are equivalent. - if strings.EqualFold(parts[0], name) { - return true - } - } - if parts[0] == name { - return true - } - } - return false -} diff --git a/vendor/github.com/docker/docker/opts/hosts.go b/vendor/github.com/docker/docker/opts/hosts.go deleted file mode 100644 index a6f2662df088..000000000000 --- a/vendor/github.com/docker/docker/opts/hosts.go +++ /dev/null @@ -1,176 +0,0 @@ -package opts // import "github.com/docker/docker/opts" - -import ( - "fmt" - "net" - "net/url" - "path/filepath" - "strconv" - "strings" - - "github.com/docker/docker/pkg/homedir" -) - -var ( - // DefaultHTTPPort Default HTTP Port used if only the protocol is provided to -H flag e.g. dockerd -H tcp:// - // These are the IANA registered port numbers for use with Docker - // see http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=docker - DefaultHTTPPort = 2375 // Default HTTP Port - // DefaultTLSHTTPPort Default HTTP Port used when TLS enabled - DefaultTLSHTTPPort = 2376 // Default TLS encrypted HTTP Port - // DefaultUnixSocket Path for the unix socket. - // Docker daemon by default always listens on the default unix socket - DefaultUnixSocket = "/var/run/docker.sock" - // DefaultTCPHost constant defines the default host string used by docker on Windows - DefaultTCPHost = fmt.Sprintf("tcp://%s:%d", DefaultHTTPHost, DefaultHTTPPort) - // DefaultTLSHost constant defines the default host string used by docker for TLS sockets - DefaultTLSHost = fmt.Sprintf("tcp://%s:%d", DefaultHTTPHost, DefaultTLSHTTPPort) - // DefaultNamedPipe defines the default named pipe used by docker on Windows - DefaultNamedPipe = `//./pipe/docker_engine` -) - -// ValidateHost validates that the specified string is a valid host and returns it. -func ValidateHost(val string) (string, error) { - host := strings.TrimSpace(val) - // The empty string means default and is not handled by parseDaemonHost - if host != "" { - _, err := parseDaemonHost(host) - if err != nil { - return val, err - } - } - // Note: unlike most flag validators, we don't return the mutated value here - // we need to know what the user entered later (using ParseHost) to adjust for TLS - return val, nil -} - -// ParseHost and set defaults for a Daemon host string. -// defaultToTLS is preferred over defaultToUnixXDG. -func ParseHost(defaultToTLS, defaultToUnixXDG bool, val string) (string, error) { - host := strings.TrimSpace(val) - if host == "" { - if defaultToTLS { - host = DefaultTLSHost - } else if defaultToUnixXDG { - runtimeDir, err := homedir.GetRuntimeDir() - if err != nil { - return "", err - } - socket := filepath.Join(runtimeDir, "docker.sock") - host = "unix://" + socket - } else { - host = DefaultHost - } - } else { - var err error - host, err = parseDaemonHost(host) - if err != nil { - return val, err - } - } - return host, nil -} - -// parseDaemonHost parses the specified address and returns an address that will be used as the host. -// Depending of the address specified, this may return one of the global Default* strings defined in hosts.go. -func parseDaemonHost(addr string) (string, error) { - addrParts := strings.SplitN(addr, "://", 2) - if len(addrParts) == 1 && addrParts[0] != "" { - addrParts = []string{"tcp", addrParts[0]} - } - - switch addrParts[0] { - case "tcp": - return ParseTCPAddr(addrParts[1], DefaultTCPHost) - case "unix": - return parseSimpleProtoAddr("unix", addrParts[1], DefaultUnixSocket) - case "npipe": - return parseSimpleProtoAddr("npipe", addrParts[1], DefaultNamedPipe) - case "fd": - return addr, nil - default: - return "", fmt.Errorf("Invalid bind address format: %s", addr) - } -} - -// parseSimpleProtoAddr parses and validates that the specified address is a valid -// socket address for simple protocols like unix and npipe. It returns a formatted -// socket address, either using the address parsed from addr, or the contents of -// defaultAddr if addr is a blank string. -func parseSimpleProtoAddr(proto, addr, defaultAddr string) (string, error) { - addr = strings.TrimPrefix(addr, proto+"://") - if strings.Contains(addr, "://") { - return "", fmt.Errorf("Invalid proto, expected %s: %s", proto, addr) - } - if addr == "" { - addr = defaultAddr - } - return fmt.Sprintf("%s://%s", proto, addr), nil -} - -// ParseTCPAddr parses and validates that the specified address is a valid TCP -// address. It returns a formatted TCP address, either using the address parsed -// from tryAddr, or the contents of defaultAddr if tryAddr is a blank string. -// tryAddr is expected to have already been Trim()'d -// defaultAddr must be in the full `tcp://host:port` form -func ParseTCPAddr(tryAddr string, defaultAddr string) (string, error) { - if tryAddr == "" || tryAddr == "tcp://" { - return defaultAddr, nil - } - addr := strings.TrimPrefix(tryAddr, "tcp://") - if strings.Contains(addr, "://") || addr == "" { - return "", fmt.Errorf("Invalid proto, expected tcp: %s", tryAddr) - } - - defaultAddr = strings.TrimPrefix(defaultAddr, "tcp://") - defaultHost, defaultPort, err := net.SplitHostPort(defaultAddr) - if err != nil { - return "", err - } - // url.Parse fails for trailing colon on IPv6 brackets on Go 1.5, but - // not 1.4. See https://github.com/golang/go/issues/12200 and - // https://github.com/golang/go/issues/6530. - if strings.HasSuffix(addr, "]:") { - addr += defaultPort - } - - u, err := url.Parse("tcp://" + addr) - if err != nil { - return "", err - } - host, port, err := net.SplitHostPort(u.Host) - if err != nil { - // try port addition once - host, port, err = net.SplitHostPort(net.JoinHostPort(u.Host, defaultPort)) - } - if err != nil { - return "", fmt.Errorf("Invalid bind address format: %s", tryAddr) - } - - if host == "" { - host = defaultHost - } - if port == "" { - port = defaultPort - } - p, err := strconv.Atoi(port) - if err != nil && p == 0 { - return "", fmt.Errorf("Invalid bind address format: %s", tryAddr) - } - - return fmt.Sprintf("tcp://%s%s", net.JoinHostPort(host, port), u.Path), nil -} - -// ValidateExtraHost validates that the specified string is a valid extrahost and returns it. -// ExtraHost is in the form of name:ip where the ip has to be a valid ip (IPv4 or IPv6). -func ValidateExtraHost(val string) (string, error) { - // allow for IPv6 addresses in extra hosts by only splitting on first ":" - arr := strings.SplitN(val, ":", 2) - if len(arr) != 2 || len(arr[0]) == 0 { - return "", fmt.Errorf("bad format for add-host: %q", val) - } - if _, err := ValidateIPAddress(arr[1]); err != nil { - return "", fmt.Errorf("invalid IP address in add-host: %q", arr[1]) - } - return val, nil -} diff --git a/vendor/github.com/docker/docker/opts/hosts_unix.go b/vendor/github.com/docker/docker/opts/hosts_unix.go deleted file mode 100644 index 9d5bb64565e5..000000000000 --- a/vendor/github.com/docker/docker/opts/hosts_unix.go +++ /dev/null @@ -1,8 +0,0 @@ -// +build !windows - -package opts // import "github.com/docker/docker/opts" - -import "fmt" - -// DefaultHost constant defines the default host string used by docker on other hosts than Windows -var DefaultHost = fmt.Sprintf("unix://%s", DefaultUnixSocket) diff --git a/vendor/github.com/docker/docker/opts/hosts_windows.go b/vendor/github.com/docker/docker/opts/hosts_windows.go deleted file mode 100644 index 906eba53ee2a..000000000000 --- a/vendor/github.com/docker/docker/opts/hosts_windows.go +++ /dev/null @@ -1,4 +0,0 @@ -package opts // import "github.com/docker/docker/opts" - -// DefaultHost constant defines the default host string used by docker on Windows -var DefaultHost = "npipe://" + DefaultNamedPipe diff --git a/vendor/github.com/docker/docker/opts/ip.go b/vendor/github.com/docker/docker/opts/ip.go deleted file mode 100644 index cfbff3a9fd61..000000000000 --- a/vendor/github.com/docker/docker/opts/ip.go +++ /dev/null @@ -1,47 +0,0 @@ -package opts // import "github.com/docker/docker/opts" - -import ( - "fmt" - "net" -) - -// IPOpt holds an IP. It is used to store values from CLI flags. -type IPOpt struct { - *net.IP -} - -// NewIPOpt creates a new IPOpt from a reference net.IP and a -// string representation of an IP. If the string is not a valid -// IP it will fallback to the specified reference. -func NewIPOpt(ref *net.IP, defaultVal string) *IPOpt { - o := &IPOpt{ - IP: ref, - } - o.Set(defaultVal) - return o -} - -// Set sets an IPv4 or IPv6 address from a given string. If the given -// string is not parsable as an IP address it returns an error. -func (o *IPOpt) Set(val string) error { - ip := net.ParseIP(val) - if ip == nil { - return fmt.Errorf("%s is not an ip address", val) - } - *o.IP = ip - return nil -} - -// String returns the IP address stored in the IPOpt. If stored IP is a -// nil pointer, it returns an empty string. -func (o *IPOpt) String() string { - if *o.IP == nil { - return "" - } - return o.IP.String() -} - -// Type returns the type of the option -func (o *IPOpt) Type() string { - return "ip" -} diff --git a/vendor/github.com/docker/docker/opts/opts.go b/vendor/github.com/docker/docker/opts/opts.go deleted file mode 100644 index de8aacb806d7..000000000000 --- a/vendor/github.com/docker/docker/opts/opts.go +++ /dev/null @@ -1,337 +0,0 @@ -package opts // import "github.com/docker/docker/opts" - -import ( - "fmt" - "net" - "path" - "regexp" - "strings" - - "github.com/docker/go-units" -) - -var ( - alphaRegexp = regexp.MustCompile(`[a-zA-Z]`) - domainRegexp = regexp.MustCompile(`^(:?(:?[a-zA-Z0-9]|(:?[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]))(:?\.(:?[a-zA-Z0-9]|(:?[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])))*)\.?\s*$`) -) - -// ListOpts holds a list of values and a validation function. -type ListOpts struct { - values *[]string - validator ValidatorFctType -} - -// NewListOpts creates a new ListOpts with the specified validator. -func NewListOpts(validator ValidatorFctType) ListOpts { - var values []string - return *NewListOptsRef(&values, validator) -} - -// NewListOptsRef creates a new ListOpts with the specified values and validator. -func NewListOptsRef(values *[]string, validator ValidatorFctType) *ListOpts { - return &ListOpts{ - values: values, - validator: validator, - } -} - -func (opts *ListOpts) String() string { - if len(*opts.values) == 0 { - return "" - } - return fmt.Sprintf("%v", *opts.values) -} - -// Set validates if needed the input value and adds it to the -// internal slice. -func (opts *ListOpts) Set(value string) error { - if opts.validator != nil { - v, err := opts.validator(value) - if err != nil { - return err - } - value = v - } - *opts.values = append(*opts.values, value) - return nil -} - -// Delete removes the specified element from the slice. -func (opts *ListOpts) Delete(key string) { - for i, k := range *opts.values { - if k == key { - *opts.values = append((*opts.values)[:i], (*opts.values)[i+1:]...) - return - } - } -} - -// GetMap returns the content of values in a map in order to avoid -// duplicates. -func (opts *ListOpts) GetMap() map[string]struct{} { - ret := make(map[string]struct{}) - for _, k := range *opts.values { - ret[k] = struct{}{} - } - return ret -} - -// GetAll returns the values of slice. -func (opts *ListOpts) GetAll() []string { - return *opts.values -} - -// GetAllOrEmpty returns the values of the slice -// or an empty slice when there are no values. -func (opts *ListOpts) GetAllOrEmpty() []string { - v := *opts.values - if v == nil { - return make([]string, 0) - } - return v -} - -// Get checks the existence of the specified key. -func (opts *ListOpts) Get(key string) bool { - for _, k := range *opts.values { - if k == key { - return true - } - } - return false -} - -// Len returns the amount of element in the slice. -func (opts *ListOpts) Len() int { - return len(*opts.values) -} - -// Type returns a string name for this Option type -func (opts *ListOpts) Type() string { - return "list" -} - -// WithValidator returns the ListOpts with validator set. -func (opts *ListOpts) WithValidator(validator ValidatorFctType) *ListOpts { - opts.validator = validator - return opts -} - -// NamedOption is an interface that list and map options -// with names implement. -type NamedOption interface { - Name() string -} - -// NamedListOpts is a ListOpts with a configuration name. -// This struct is useful to keep reference to the assigned -// field name in the internal configuration struct. -type NamedListOpts struct { - name string - ListOpts -} - -var _ NamedOption = &NamedListOpts{} - -// NewNamedListOptsRef creates a reference to a new NamedListOpts struct. -func NewNamedListOptsRef(name string, values *[]string, validator ValidatorFctType) *NamedListOpts { - return &NamedListOpts{ - name: name, - ListOpts: *NewListOptsRef(values, validator), - } -} - -// Name returns the name of the NamedListOpts in the configuration. -func (o *NamedListOpts) Name() string { - return o.name -} - -// MapOpts holds a map of values and a validation function. -type MapOpts struct { - values map[string]string - validator ValidatorFctType -} - -// Set validates if needed the input value and add it to the -// internal map, by splitting on '='. -func (opts *MapOpts) Set(value string) error { - if opts.validator != nil { - v, err := opts.validator(value) - if err != nil { - return err - } - value = v - } - vals := strings.SplitN(value, "=", 2) - if len(vals) == 1 { - (opts.values)[vals[0]] = "" - } else { - (opts.values)[vals[0]] = vals[1] - } - return nil -} - -// GetAll returns the values of MapOpts as a map. -func (opts *MapOpts) GetAll() map[string]string { - return opts.values -} - -func (opts *MapOpts) String() string { - return fmt.Sprintf("%v", opts.values) -} - -// Type returns a string name for this Option type -func (opts *MapOpts) Type() string { - return "map" -} - -// NewMapOpts creates a new MapOpts with the specified map of values and a validator. -func NewMapOpts(values map[string]string, validator ValidatorFctType) *MapOpts { - if values == nil { - values = make(map[string]string) - } - return &MapOpts{ - values: values, - validator: validator, - } -} - -// NamedMapOpts is a MapOpts struct with a configuration name. -// This struct is useful to keep reference to the assigned -// field name in the internal configuration struct. -type NamedMapOpts struct { - name string - MapOpts -} - -var _ NamedOption = &NamedMapOpts{} - -// NewNamedMapOpts creates a reference to a new NamedMapOpts struct. -func NewNamedMapOpts(name string, values map[string]string, validator ValidatorFctType) *NamedMapOpts { - return &NamedMapOpts{ - name: name, - MapOpts: *NewMapOpts(values, validator), - } -} - -// Name returns the name of the NamedMapOpts in the configuration. -func (o *NamedMapOpts) Name() string { - return o.name -} - -// ValidatorFctType defines a validator function that returns a validated string and/or an error. -type ValidatorFctType func(val string) (string, error) - -// ValidatorFctListType defines a validator function that returns a validated list of string and/or an error -type ValidatorFctListType func(val string) ([]string, error) - -// ValidateIPAddress validates an Ip address. -func ValidateIPAddress(val string) (string, error) { - var ip = net.ParseIP(strings.TrimSpace(val)) - if ip != nil { - return ip.String(), nil - } - return "", fmt.Errorf("%s is not an ip address", val) -} - -// ValidateDNSSearch validates domain for resolvconf search configuration. -// A zero length domain is represented by a dot (.). -func ValidateDNSSearch(val string) (string, error) { - if val = strings.Trim(val, " "); val == "." { - return val, nil - } - return validateDomain(val) -} - -func validateDomain(val string) (string, error) { - if alphaRegexp.FindString(val) == "" { - return "", fmt.Errorf("%s is not a valid domain", val) - } - ns := domainRegexp.FindSubmatch([]byte(val)) - if len(ns) > 0 && len(ns[1]) < 255 { - return string(ns[1]), nil - } - return "", fmt.Errorf("%s is not a valid domain", val) -} - -// ValidateLabel validates that the specified string is a valid label, and returns it. -// Labels are in the form on key=value. -func ValidateLabel(val string) (string, error) { - if strings.Count(val, "=") < 1 { - return "", fmt.Errorf("bad attribute format: %s", val) - } - return val, nil -} - -// ValidateSingleGenericResource validates that a single entry in the -// generic resource list is valid. -// i.e 'GPU=UID1' is valid however 'GPU:UID1' or 'UID1' isn't -func ValidateSingleGenericResource(val string) (string, error) { - if strings.Count(val, "=") < 1 { - return "", fmt.Errorf("invalid node-generic-resource format `%s` expected `name=value`", val) - } - return val, nil -} - -// ParseLink parses and validates the specified string as a link format (name:alias) -func ParseLink(val string) (string, string, error) { - if val == "" { - return "", "", fmt.Errorf("empty string specified for links") - } - arr := strings.Split(val, ":") - if len(arr) > 2 { - return "", "", fmt.Errorf("bad format for links: %s", val) - } - if len(arr) == 1 { - return val, val, nil - } - // This is kept because we can actually get a HostConfig with links - // from an already created container and the format is not `foo:bar` - // but `/foo:/c1/bar` - if strings.HasPrefix(arr[0], "/") { - _, alias := path.Split(arr[1]) - return arr[0][1:], alias, nil - } - return arr[0], arr[1], nil -} - -// MemBytes is a type for human readable memory bytes (like 128M, 2g, etc) -type MemBytes int64 - -// String returns the string format of the human readable memory bytes -func (m *MemBytes) String() string { - // NOTE: In spf13/pflag/flag.go, "0" is considered as "zero value" while "0 B" is not. - // We return "0" in case value is 0 here so that the default value is hidden. - // (Sometimes "default 0 B" is actually misleading) - if m.Value() != 0 { - return units.BytesSize(float64(m.Value())) - } - return "0" -} - -// Set sets the value of the MemBytes by passing a string -func (m *MemBytes) Set(value string) error { - val, err := units.RAMInBytes(value) - *m = MemBytes(val) - return err -} - -// Type returns the type -func (m *MemBytes) Type() string { - return "bytes" -} - -// Value returns the value in int64 -func (m *MemBytes) Value() int64 { - return int64(*m) -} - -// UnmarshalJSON is the customized unmarshaler for MemBytes -func (m *MemBytes) UnmarshalJSON(s []byte) error { - if len(s) <= 2 || s[0] != '"' || s[len(s)-1] != '"' { - return fmt.Errorf("invalid size: %q", s) - } - val, err := units.RAMInBytes(string(s[1 : len(s)-1])) - *m = MemBytes(val) - return err -} diff --git a/vendor/github.com/docker/docker/opts/opts_unix.go b/vendor/github.com/docker/docker/opts/opts_unix.go deleted file mode 100644 index 0c32367cb22d..000000000000 --- a/vendor/github.com/docker/docker/opts/opts_unix.go +++ /dev/null @@ -1,6 +0,0 @@ -// +build !windows - -package opts // import "github.com/docker/docker/opts" - -// DefaultHTTPHost Default HTTP Host used if only port is provided to -H flag e.g. dockerd -H tcp://:8080 -const DefaultHTTPHost = "localhost" diff --git a/vendor/github.com/docker/docker/opts/opts_windows.go b/vendor/github.com/docker/docker/opts/opts_windows.go deleted file mode 100644 index 0e1b6c6d18e8..000000000000 --- a/vendor/github.com/docker/docker/opts/opts_windows.go +++ /dev/null @@ -1,56 +0,0 @@ -package opts // import "github.com/docker/docker/opts" - -// TODO Windows. Identify bug in GOLang 1.5.1+ and/or Windows Server 2016 TP5. -// @jhowardmsft, @swernli. -// -// On Windows, this mitigates a problem with the default options of running -// a docker client against a local docker daemon on TP5. -// -// What was found that if the default host is "localhost", even if the client -// (and daemon as this is local) is not physically on a network, and the DNS -// cache is flushed (ipconfig /flushdns), then the client will pause for -// exactly one second when connecting to the daemon for calls. For example -// using docker run windowsservercore cmd, the CLI will send a create followed -// by an attach. You see the delay between the attach finishing and the attach -// being seen by the daemon. -// -// Here's some daemon debug logs with additional debug spew put in. The -// AfterWriteJSON log is the very last thing the daemon does as part of the -// create call. The POST /attach is the second CLI call. Notice the second -// time gap. -// -// time="2015-11-06T13:38:37.259627400-08:00" level=debug msg="After createRootfs" -// time="2015-11-06T13:38:37.263626300-08:00" level=debug msg="After setHostConfig" -// time="2015-11-06T13:38:37.267631200-08:00" level=debug msg="before createContainerPl...." -// time="2015-11-06T13:38:37.271629500-08:00" level=debug msg=ToDiskLocking.... -// time="2015-11-06T13:38:37.275643200-08:00" level=debug msg="loggin event...." -// time="2015-11-06T13:38:37.277627600-08:00" level=debug msg="logged event...." -// time="2015-11-06T13:38:37.279631800-08:00" level=debug msg="In defer func" -// time="2015-11-06T13:38:37.282628100-08:00" level=debug msg="After daemon.create" -// time="2015-11-06T13:38:37.286651700-08:00" level=debug msg="return 2" -// time="2015-11-06T13:38:37.289629500-08:00" level=debug msg="Returned from daemon.ContainerCreate" -// time="2015-11-06T13:38:37.311629100-08:00" level=debug msg="After WriteJSON" -// ... 1 second gap here.... -// time="2015-11-06T13:38:38.317866200-08:00" level=debug msg="Calling POST /v1.22/containers/984758282b842f779e805664b2c95d563adc9a979c8a3973e68c807843ee4757/attach" -// time="2015-11-06T13:38:38.326882500-08:00" level=info msg="POST /v1.22/containers/984758282b842f779e805664b2c95d563adc9a979c8a3973e68c807843ee4757/attach?stderr=1&stdin=1&stdout=1&stream=1" -// -// We suspect this is either a bug introduced in GOLang 1.5.1, or that a change -// in GOLang 1.5.1 (from 1.4.3) is exposing a bug in Windows. In theory, -// the Windows networking stack is supposed to resolve "localhost" internally, -// without hitting DNS, or even reading the hosts file (which is why localhost -// is commented out in the hosts file on Windows). -// -// We have validated that working around this using the actual IPv4 localhost -// address does not cause the delay. -// -// This does not occur with the docker client built with 1.4.3 on the same -// Windows build, regardless of whether the daemon is built using 1.5.1 -// or 1.4.3. It does not occur on Linux. We also verified we see the same thing -// on a cross-compiled Windows binary (from Linux). -// -// Final note: This is a mitigation, not a 'real' fix. It is still susceptible -// to the delay if a user were to do 'docker run -H=tcp://localhost:2375...' -// explicitly. - -// DefaultHTTPHost Default HTTP Host used if only port is provided to -H flag e.g. dockerd -H tcp://:8080 -const DefaultHTTPHost = "127.0.0.1" diff --git a/vendor/github.com/docker/docker/opts/quotedstring.go b/vendor/github.com/docker/docker/opts/quotedstring.go deleted file mode 100644 index 6c889070e825..000000000000 --- a/vendor/github.com/docker/docker/opts/quotedstring.go +++ /dev/null @@ -1,37 +0,0 @@ -package opts // import "github.com/docker/docker/opts" - -// QuotedString is a string that may have extra quotes around the value. The -// quotes are stripped from the value. -type QuotedString struct { - value *string -} - -// Set sets a new value -func (s *QuotedString) Set(val string) error { - *s.value = trimQuotes(val) - return nil -} - -// Type returns the type of the value -func (s *QuotedString) Type() string { - return "string" -} - -func (s *QuotedString) String() string { - return *s.value -} - -func trimQuotes(value string) string { - lastIndex := len(value) - 1 - for _, char := range []byte{'\'', '"'} { - if value[0] == char && value[lastIndex] == char { - return value[1:lastIndex] - } - } - return value -} - -// NewQuotedString returns a new quoted string option -func NewQuotedString(value *string) *QuotedString { - return &QuotedString{value: value} -} diff --git a/vendor/github.com/docker/docker/opts/runtime.go b/vendor/github.com/docker/docker/opts/runtime.go deleted file mode 100644 index 4b9babf0a5c7..000000000000 --- a/vendor/github.com/docker/docker/opts/runtime.go +++ /dev/null @@ -1,79 +0,0 @@ -package opts // import "github.com/docker/docker/opts" - -import ( - "fmt" - "strings" - - "github.com/docker/docker/api/types" -) - -// RuntimeOpt defines a map of Runtimes -type RuntimeOpt struct { - name string - stockRuntimeName string - values *map[string]types.Runtime -} - -// NewNamedRuntimeOpt creates a new RuntimeOpt -func NewNamedRuntimeOpt(name string, ref *map[string]types.Runtime, stockRuntime string) *RuntimeOpt { - if ref == nil { - ref = &map[string]types.Runtime{} - } - return &RuntimeOpt{name: name, values: ref, stockRuntimeName: stockRuntime} -} - -// Name returns the name of the NamedListOpts in the configuration. -func (o *RuntimeOpt) Name() string { - return o.name -} - -// Set validates and updates the list of Runtimes -func (o *RuntimeOpt) Set(val string) error { - parts := strings.SplitN(val, "=", 2) - if len(parts) != 2 { - return fmt.Errorf("invalid runtime argument: %s", val) - } - - parts[0] = strings.TrimSpace(parts[0]) - parts[1] = strings.TrimSpace(parts[1]) - if parts[0] == "" || parts[1] == "" { - return fmt.Errorf("invalid runtime argument: %s", val) - } - - parts[0] = strings.ToLower(parts[0]) - if parts[0] == o.stockRuntimeName { - return fmt.Errorf("runtime name '%s' is reserved", o.stockRuntimeName) - } - - if _, ok := (*o.values)[parts[0]]; ok { - return fmt.Errorf("runtime '%s' was already defined", parts[0]) - } - - (*o.values)[parts[0]] = types.Runtime{Path: parts[1]} - - return nil -} - -// String returns Runtime values as a string. -func (o *RuntimeOpt) String() string { - var out []string - for k := range *o.values { - out = append(out, k) - } - - return fmt.Sprintf("%v", out) -} - -// GetMap returns a map of Runtimes (name: path) -func (o *RuntimeOpt) GetMap() map[string]types.Runtime { - if o.values != nil { - return *o.values - } - - return map[string]types.Runtime{} -} - -// Type returns the type of the option -func (o *RuntimeOpt) Type() string { - return "runtime" -} diff --git a/vendor/github.com/docker/docker/opts/ulimit.go b/vendor/github.com/docker/docker/opts/ulimit.go deleted file mode 100644 index 0e2a36236c1b..000000000000 --- a/vendor/github.com/docker/docker/opts/ulimit.go +++ /dev/null @@ -1,81 +0,0 @@ -package opts // import "github.com/docker/docker/opts" - -import ( - "fmt" - - "github.com/docker/go-units" -) - -// UlimitOpt defines a map of Ulimits -type UlimitOpt struct { - values *map[string]*units.Ulimit -} - -// NewUlimitOpt creates a new UlimitOpt -func NewUlimitOpt(ref *map[string]*units.Ulimit) *UlimitOpt { - if ref == nil { - ref = &map[string]*units.Ulimit{} - } - return &UlimitOpt{ref} -} - -// Set validates a Ulimit and sets its name as a key in UlimitOpt -func (o *UlimitOpt) Set(val string) error { - l, err := units.ParseUlimit(val) - if err != nil { - return err - } - - (*o.values)[l.Name] = l - - return nil -} - -// String returns Ulimit values as a string. -func (o *UlimitOpt) String() string { - var out []string - for _, v := range *o.values { - out = append(out, v.String()) - } - - return fmt.Sprintf("%v", out) -} - -// GetList returns a slice of pointers to Ulimits. -func (o *UlimitOpt) GetList() []*units.Ulimit { - var ulimits []*units.Ulimit - for _, v := range *o.values { - ulimits = append(ulimits, v) - } - - return ulimits -} - -// Type returns the option type -func (o *UlimitOpt) Type() string { - return "ulimit" -} - -// NamedUlimitOpt defines a named map of Ulimits -type NamedUlimitOpt struct { - name string - UlimitOpt -} - -var _ NamedOption = &NamedUlimitOpt{} - -// NewNamedUlimitOpt creates a new NamedUlimitOpt -func NewNamedUlimitOpt(name string, ref *map[string]*units.Ulimit) *NamedUlimitOpt { - if ref == nil { - ref = &map[string]*units.Ulimit{} - } - return &NamedUlimitOpt{ - name: name, - UlimitOpt: *NewUlimitOpt(ref), - } -} - -// Name returns the option name -func (o *NamedUlimitOpt) Name() string { - return o.name -} diff --git a/vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go b/vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go index 47ecd0c092b2..5e6310fdcd6b 100644 --- a/vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go +++ b/vendor/github.com/docker/docker/pkg/homedir/homedir_linux.go @@ -5,24 +5,8 @@ import ( "os" "path/filepath" "strings" - - "github.com/docker/docker/pkg/idtools" ) -// GetStatic returns the home directory for the current user without calling -// os/user.Current(). This is useful for static-linked binary on glibc-based -// system, because a call to os/user.Current() in a static binary leads to -// segfault due to a glibc issue that won't be fixed in a short term. -// (#29344, golang/go#13470, https://sourceware.org/bugzilla/show_bug.cgi?id=19341) -func GetStatic() (string, error) { - uid := os.Getuid() - usr, err := idtools.LookupUID(uid) - if err != nil { - return "", err - } - return usr.Home, nil -} - // GetRuntimeDir returns XDG_RUNTIME_DIR. // XDG_RUNTIME_DIR is typically configured via pam_systemd. // GetRuntimeDir returns non-nil error if XDG_RUNTIME_DIR is not set. diff --git a/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go b/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go index f0a363dedf34..67ab9e9b31e0 100644 --- a/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go +++ b/vendor/github.com/docker/docker/pkg/homedir/homedir_others.go @@ -6,12 +6,6 @@ import ( "errors" ) -// GetStatic is not needed for non-linux systems. -// (Precisely, it is needed only for glibc-based linux systems.) -func GetStatic() (string, error) { - return "", errors.New("homedir.GetStatic() is not supported on this system") -} - // GetRuntimeDir is unsupported on non-linux system. func GetRuntimeDir() (string, error) { return "", errors.New("homedir.GetRuntimeDir() is not supported on this system") diff --git a/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go b/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go index d85e12448840..441bd727b602 100644 --- a/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go +++ b/vendor/github.com/docker/docker/pkg/homedir/homedir_unix.go @@ -4,8 +4,7 @@ package homedir // import "github.com/docker/docker/pkg/homedir" import ( "os" - - "github.com/opencontainers/runc/libcontainer/user" + "os/user" ) // Key returns the env var name for the user's home dir based on @@ -17,11 +16,16 @@ func Key() string { // Get returns the home directory of the current user with the help of // environment variables depending on the target operating system. // Returned path should be used with "path/filepath" to form new paths. +// +// If linking statically with cgo enabled against glibc, ensure the +// osusergo build tag is used. +// +// If needing to do nss lookups, do not disable cgo or set osusergo. func Get() string { home := os.Getenv(Key()) if home == "" { - if u, err := user.CurrentUser(); err == nil { - return u.Home + if u, err := user.Current(); err == nil { + return u.HomeDir } } return home diff --git a/vendor/github.com/docker/docker/pkg/ioutils/bytespipe.go b/vendor/github.com/docker/docker/pkg/ioutils/bytespipe.go index d4bbf3c9dcaf..87514b643d74 100644 --- a/vendor/github.com/docker/docker/pkg/ioutils/bytespipe.go +++ b/vendor/github.com/docker/docker/pkg/ioutils/bytespipe.go @@ -128,8 +128,9 @@ func (bp *BytesPipe) Read(p []byte) (n int, err error) { bp.mu.Lock() if bp.bufLen == 0 { if bp.closeErr != nil { + err := bp.closeErr bp.mu.Unlock() - return 0, bp.closeErr + return 0, err } bp.wait.Wait() if bp.bufLen == 0 && bp.closeErr != nil { diff --git a/vendor/github.com/docker/docker/pkg/jsonmessage/jsonmessage.go b/vendor/github.com/docker/docker/pkg/jsonmessage/jsonmessage.go index a68b566cea2c..aa372c20cae2 100644 --- a/vendor/github.com/docker/docker/pkg/jsonmessage/jsonmessage.go +++ b/vendor/github.com/docker/docker/pkg/jsonmessage/jsonmessage.go @@ -8,7 +8,7 @@ import ( "time" "github.com/docker/docker/pkg/term" - "github.com/docker/go-units" + units "github.com/docker/go-units" "github.com/morikuni/aec" ) @@ -139,13 +139,13 @@ type JSONMessage struct { Stream string `json:"stream,omitempty"` Status string `json:"status,omitempty"` Progress *JSONProgress `json:"progressDetail,omitempty"` - ProgressMessage string `json:"progress,omitempty"` //deprecated + ProgressMessage string `json:"progress,omitempty"` // deprecated ID string `json:"id,omitempty"` From string `json:"from,omitempty"` Time int64 `json:"time,omitempty"` TimeNano int64 `json:"timeNano,omitempty"` Error *JSONError `json:"errorDetail,omitempty"` - ErrorMessage string `json:"error,omitempty"` //deprecated + ErrorMessage string `json:"error,omitempty"` // deprecated // Aux contains out-of-band data, such as digests for push signing and image id after building. Aux *json.RawMessage `json:"aux,omitempty"` } @@ -177,8 +177,8 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error { if isTerminal && jm.Stream == "" && jm.Progress != nil { clearLine(out) endl = "\r" - fmt.Fprintf(out, endl) - } else if jm.Progress != nil && jm.Progress.String() != "" { //disable progressbar in non-terminal + fmt.Fprint(out, endl) + } else if jm.Progress != nil && jm.Progress.String() != "" { // disable progressbar in non-terminal return nil } if jm.TimeNano != 0 { @@ -194,7 +194,7 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error { } if jm.Progress != nil && isTerminal { fmt.Fprintf(out, "%s %s%s", jm.Status, jm.Progress.String(), endl) - } else if jm.ProgressMessage != "" { //deprecated + } else if jm.ProgressMessage != "" { // deprecated fmt.Fprintf(out, "%s %s%s", jm.Status, jm.ProgressMessage, endl) } else if jm.Stream != "" { fmt.Fprintf(out, "%s%s", jm.Stream, endl) diff --git a/vendor/github.com/docker/docker/pkg/mount/mount.go b/vendor/github.com/docker/docker/pkg/mount/mount.go index be0631c630ca..e07cd431bcad 100644 --- a/vendor/github.com/docker/docker/pkg/mount/mount.go +++ b/vendor/github.com/docker/docker/pkg/mount/mount.go @@ -97,24 +97,19 @@ func Mounted(mountpoint string) (bool, error) { return len(entries) > 0, nil } -// Mount will mount filesystem according to the specified configuration, on the -// condition that the target path is *not* already mounted. Options must be -// specified like the mount or fstab unix commands: "opt1=val1,opt2=val2". See -// flags.go for supported option flags. +// Mount will mount filesystem according to the specified configuration. +// Options must be specified like the mount or fstab unix commands: +// "opt1=val1,opt2=val2". See flags.go for supported option flags. func Mount(device, target, mType, options string) error { flag, data := parseOptions(options) - if flag&REMOUNT != REMOUNT { - if mounted, err := Mounted(target); err != nil || mounted { - return err - } - } return mount(device, target, mType, uintptr(flag), data) } -// ForceMount will mount a filesystem according to the specified configuration, -// *regardless* if the target path is not already mounted. Options must be -// specified like the mount or fstab unix commands: "opt1=val1,opt2=val2". See -// flags.go for supported option flags. +// ForceMount will mount filesystem according to the specified configuration. +// Options must be specified like the mount or fstab unix commands: +// "opt1=val1,opt2=val2". See flags.go for supported option flags. +// +// Deprecated: use Mount instead. func ForceMount(device, target, mType, options string) error { flag, data := parseOptions(options) return mount(device, target, mType, uintptr(flag), data) @@ -144,13 +139,10 @@ func RecursiveUnmount(target string) error { err = unmount(m.Mountpoint, mntDetach) if err != nil { if i == len(mounts)-1 { // last mount - if mounted, e := Mounted(m.Mountpoint); e != nil || mounted { - return err - } - } else { - // This is some submount, we can ignore this error for now, the final unmount will fail if this is a real problem - logrus.WithError(err).Warnf("Failed to unmount submount %s", m.Mountpoint) + return err } + // This is some submount, we can ignore this error for now, the final unmount will fail if this is a real problem + logrus.WithError(err).Warnf("Failed to unmount submount %s", m.Mountpoint) } logrus.Debugf("Unmounted %s", m.Mountpoint) diff --git a/vendor/github.com/docker/docker/pkg/mount/mountinfo_freebsd.go b/vendor/github.com/docker/docker/pkg/mount/mountinfo_freebsd.go index 36c89dc1a240..0af3959dcfc9 100644 --- a/vendor/github.com/docker/docker/pkg/mount/mountinfo_freebsd.go +++ b/vendor/github.com/docker/docker/pkg/mount/mountinfo_freebsd.go @@ -13,8 +13,7 @@ import ( "unsafe" ) -// Parse /proc/self/mountinfo because comparing Dev and ino does not work from -// bind mounts. +// parseMountTable returns information about mounted filesystems func parseMountTable(filter FilterFunc) ([]*Info, error) { var rawEntries *C.struct_statfs @@ -37,7 +36,7 @@ func parseMountTable(filter FilterFunc) ([]*Info, error) { if filter != nil { // filter out entries we're not interested in - skip, stop = filter(p) + skip, stop = filter(&mountinfo) if skip { continue } diff --git a/vendor/github.com/docker/docker/pkg/mount/mountinfo_linux.go b/vendor/github.com/docker/docker/pkg/mount/mountinfo_linux.go index fe6e3ddba132..58ca61f3f7c4 100644 --- a/vendor/github.com/docker/docker/pkg/mount/mountinfo_linux.go +++ b/vendor/github.com/docker/docker/pkg/mount/mountinfo_linux.go @@ -90,7 +90,6 @@ func parseInfoFile(r io.Reader, filter FilterFunc) ([]*Info, error) { mount propagation flags in fields[6]. The correct behavior is to ignore any unknown optional fields. */ - break } } if i == numFields { diff --git a/vendor/github.com/docker/docker/pkg/pools/pools.go b/vendor/github.com/docker/docker/pkg/pools/pools.go index 46339c282f11..3792c67a9e45 100644 --- a/vendor/github.com/docker/docker/pkg/pools/pools.go +++ b/vendor/github.com/docker/docker/pkg/pools/pools.go @@ -62,23 +62,23 @@ type bufferPool struct { func newBufferPoolWithSize(size int) *bufferPool { return &bufferPool{ pool: sync.Pool{ - New: func() interface{} { return make([]byte, size) }, + New: func() interface{} { s := make([]byte, size); return &s }, }, } } -func (bp *bufferPool) Get() []byte { - return bp.pool.Get().([]byte) +func (bp *bufferPool) Get() *[]byte { + return bp.pool.Get().(*[]byte) } -func (bp *bufferPool) Put(b []byte) { +func (bp *bufferPool) Put(b *[]byte) { bp.pool.Put(b) } // Copy is a convenience wrapper which uses a buffer to avoid allocation in io.Copy. func Copy(dst io.Writer, src io.Reader) (written int64, err error) { buf := buffer32KPool.Get() - written, err = io.CopyBuffer(dst, src, buf) + written, err = io.CopyBuffer(dst, src, *buf) buffer32KPool.Put(buf) return } diff --git a/vendor/github.com/docker/docker/pkg/term/term_windows.go b/vendor/github.com/docker/docker/pkg/term/term_windows.go index a3c3db131574..6e83b59e9013 100644 --- a/vendor/github.com/docker/docker/pkg/term/term_windows.go +++ b/vendor/github.com/docker/docker/pkg/term/term_windows.go @@ -7,7 +7,7 @@ import ( "syscall" // used for STD_INPUT_HANDLE, STD_OUTPUT_HANDLE and STD_ERROR_HANDLE "github.com/Azure/go-ansiterm/winterm" - "github.com/docker/docker/pkg/term/windows" + windowsconsole "github.com/docker/docker/pkg/term/windows" ) // State holds the console mode for the terminal. diff --git a/vendor/github.com/docker/docker/pkg/term/windows/windows.go b/vendor/github.com/docker/docker/pkg/term/windows/windows.go index 3e5593ca6a68..7e8f265d47e9 100644 --- a/vendor/github.com/docker/docker/pkg/term/windows/windows.go +++ b/vendor/github.com/docker/docker/pkg/term/windows/windows.go @@ -1,3 +1,4 @@ +// +build windows // These files implement ANSI-aware input and output streams for use by the Docker Windows client. // When asked for the set of standard streams (e.g., stdin, stdout, stderr), the code will create // and return pseudo-streams that convert ANSI sequences to / from Windows Console API calls. @@ -9,7 +10,7 @@ import ( "os" "sync" - "github.com/Azure/go-ansiterm" + ansiterm "github.com/Azure/go-ansiterm" "github.com/sirupsen/logrus" ) diff --git a/vendor/github.com/docker/docker/registry/auth.go b/vendor/github.com/docker/docker/registry/auth.go index 3f58fc6cffe9..bae093ec973c 100644 --- a/vendor/github.com/docker/docker/registry/auth.go +++ b/vendor/github.com/docker/docker/registry/auth.go @@ -33,7 +33,7 @@ func loginV1(authConfig *types.AuthConfig, apiEndpoint APIEndpoint, userAgent st return "", "", errdefs.System(errors.New("server Error: Server Address not set")) } - req, err := http.NewRequest("GET", serverAddress+"users/", nil) + req, err := http.NewRequest(http.MethodGet, serverAddress+"users/", nil) if err != nil { return "", "", err } @@ -140,7 +140,7 @@ func loginV2(authConfig *types.AuthConfig, endpoint APIEndpoint, userAgent strin } endpointStr := strings.TrimRight(endpoint.URL.String(), "/") + "/v2/" - req, err := http.NewRequest("GET", endpointStr, nil) + req, err := http.NewRequest(http.MethodGet, endpointStr, nil) if err != nil { if !foundV2 { err = fallbackError{err: err} @@ -262,7 +262,7 @@ func PingV2Registry(endpoint *url.URL, transport http.RoundTripper) (challenge.M Timeout: 15 * time.Second, } endpointStr := strings.TrimRight(endpoint.String(), "/") + "/v2/" - req, err := http.NewRequest("GET", endpointStr, nil) + req, err := http.NewRequest(http.MethodGet, endpointStr, nil) if err != nil { return nil, false, err } diff --git a/vendor/github.com/docker/docker/registry/endpoint_v1.go b/vendor/github.com/docker/docker/registry/endpoint_v1.go index 832fdb95a482..db342d1412bf 100644 --- a/vendor/github.com/docker/docker/registry/endpoint_v1.go +++ b/vendor/github.com/docker/docker/registry/endpoint_v1.go @@ -124,9 +124,6 @@ func newV1EndpointFromStr(address string, tlsConfig *tls.Config, userAgent strin } endpoint := newV1Endpoint(*uri, tlsConfig, userAgent, metaHeaders) - if err != nil { - return nil, err - } return endpoint, nil } @@ -152,7 +149,7 @@ func (e *V1Endpoint) Ping() (PingResult, error) { return PingResult{Standalone: false}, nil } - req, err := http.NewRequest("GET", e.Path("_ping"), nil) + req, err := http.NewRequest(http.MethodGet, e.Path("_ping"), nil) if err != nil { return PingResult{Standalone: false}, err } diff --git a/vendor/github.com/docker/docker/registry/registry.go b/vendor/github.com/docker/docker/registry/registry.go index 3d1e1aa58ad9..4c82a61cb37e 100644 --- a/vendor/github.com/docker/docker/registry/registry.go +++ b/vendor/github.com/docker/docker/registry/registry.go @@ -14,12 +14,10 @@ import ( "time" "github.com/docker/distribution/registry/client/transport" - "github.com/docker/go-connections/sockets" - "github.com/docker/go-connections/tlsconfig" - "github.com/sirupsen/logrus" - "github.com/docker/docker/pkg/homedir" "github.com/docker/docker/rootless" + "github.com/docker/go-connections/tlsconfig" + "github.com/sirupsen/logrus" ) var ( @@ -191,16 +189,12 @@ func NewTransport(tlsConfig *tls.Config) *http.Transport { base := &http.Transport{ Proxy: http.ProxyFromEnvironment, - Dial: direct.Dial, + DialContext: direct.DialContext, TLSHandshakeTimeout: 10 * time.Second, TLSClientConfig: tlsConfig, // TODO(dmcgowan): Call close idle connections when complete and use keep alive DisableKeepAlives: true, } - proxyDialer, err := sockets.DialerFromEnvironment(direct) - if err == nil { - base.Dial = proxyDialer.Dial - } return base } diff --git a/vendor/github.com/docker/docker/registry/resumable/resumablerequestreader.go b/vendor/github.com/docker/docker/registry/resumable/resumablerequestreader.go index 8e97a1a4d149..3649f36edecc 100644 --- a/vendor/github.com/docker/docker/registry/resumable/resumablerequestreader.go +++ b/vendor/github.com/docker/docker/registry/resumable/resumablerequestreader.go @@ -56,10 +56,10 @@ func (r *requestReader) Read(p []byte) (n int, err error) { r.cleanUpResponse() return 0, err } - if r.currentResponse.StatusCode == 416 && r.lastRange == r.totalSize && r.currentResponse.ContentLength == 0 { + if r.currentResponse.StatusCode == http.StatusRequestedRangeNotSatisfiable && r.lastRange == r.totalSize && r.currentResponse.ContentLength == 0 { r.cleanUpResponse() return 0, io.EOF - } else if r.currentResponse.StatusCode != 206 && r.lastRange != 0 && isFreshRequest { + } else if r.currentResponse.StatusCode != http.StatusPartialContent && r.lastRange != 0 && isFreshRequest { r.cleanUpResponse() return 0, fmt.Errorf("the server doesn't support byte ranges") } diff --git a/vendor/github.com/docker/docker/registry/session.go b/vendor/github.com/docker/docker/registry/session.go index ef142995942f..14825c5f9a69 100644 --- a/vendor/github.com/docker/docker/registry/session.go +++ b/vendor/github.com/docker/docker/registry/session.go @@ -3,6 +3,7 @@ package registry // import "github.com/docker/docker/registry" import ( "bytes" "crypto/sha256" + // this is required for some certificates _ "crypto/sha512" "encoding/hex" @@ -132,7 +133,9 @@ func (tr *authTransport) RoundTrip(orig *http.Request) (*http.Response, error) { } resp, err := tr.RoundTripper.RoundTrip(req) if err != nil { + tr.mu.Lock() delete(tr.modReq, orig) + tr.mu.Unlock() return nil, err } if len(resp.Header["X-Docker-Token"]) > 0 { @@ -224,8 +227,8 @@ func (r *Session) GetRemoteHistory(imgID, registry string) ([]string, error) { return nil, err } defer res.Body.Close() - if res.StatusCode != 200 { - if res.StatusCode == 401 { + if res.StatusCode != http.StatusOK { + if res.StatusCode == http.StatusUnauthorized { return nil, errcode.ErrorCodeUnauthorized.WithArgs() } return nil, newJSONError(fmt.Sprintf("Server error: %d trying to fetch remote history for %s", res.StatusCode, imgID), res) @@ -247,7 +250,7 @@ func (r *Session) LookupRemoteImage(imgID, registry string) error { return err } res.Body.Close() - if res.StatusCode != 200 { + if res.StatusCode != http.StatusOK { return newJSONError(fmt.Sprintf("HTTP code %d", res.StatusCode), res) } return nil @@ -260,7 +263,7 @@ func (r *Session) GetRemoteImageJSON(imgID, registry string) ([]byte, int64, err return nil, -1, fmt.Errorf("Failed to download json: %s", err) } defer res.Body.Close() - if res.StatusCode != 200 { + if res.StatusCode != http.StatusOK { return nil, -1, newJSONError(fmt.Sprintf("HTTP code %d", res.StatusCode), res) } // if the size header is not present, then set it to '-1' @@ -288,7 +291,7 @@ func (r *Session) GetRemoteImageLayer(imgID, registry string, imgSize int64) (io imageURL = fmt.Sprintf("%simages/%s/layer", registry, imgID) ) - req, err := http.NewRequest("GET", imageURL, nil) + req, err := http.NewRequest(http.MethodGet, imageURL, nil) if err != nil { return nil, fmt.Errorf("Error while getting from the server: %v", err) } @@ -307,7 +310,7 @@ func (r *Session) GetRemoteImageLayer(imgID, registry string, imgSize int64) (io statusCode, imgID) } - if res.StatusCode != 200 { + if res.StatusCode != http.StatusOK { res.Body.Close() return nil, fmt.Errorf("Server error: Status %d while fetching image layer (%s)", res.StatusCode, imgID) @@ -346,7 +349,7 @@ func (r *Session) GetRemoteTag(registries []string, repositoryRef reference.Name if res.StatusCode == 404 { return "", ErrRepoNotFound } - if res.StatusCode != 200 { + if res.StatusCode != http.StatusOK { continue } @@ -384,7 +387,7 @@ func (r *Session) GetRemoteTags(registries []string, repositoryRef reference.Nam if res.StatusCode == 404 { return nil, ErrRepoNotFound } - if res.StatusCode != 200 { + if res.StatusCode != http.StatusOK { continue } @@ -422,7 +425,7 @@ func (r *Session) GetRepositoryData(name reference.Named) (*RepositoryData, erro logrus.Debugf("[registry] Calling GET %s", repositoryTarget) - req, err := http.NewRequest("GET", repositoryTarget, nil) + req, err := http.NewRequest(http.MethodGet, repositoryTarget, nil) if err != nil { return nil, err } @@ -440,14 +443,14 @@ func (r *Session) GetRepositoryData(name reference.Named) (*RepositoryData, erro return nil, fmt.Errorf("Error while pulling image: %v", err) } defer res.Body.Close() - if res.StatusCode == 401 { + if res.StatusCode == http.StatusUnauthorized { return nil, errcode.ErrorCodeUnauthorized.WithArgs() } // TODO: Right now we're ignoring checksums in the response body. // In the future, we need to use them to check image validity. if res.StatusCode == 404 { return nil, newJSONError(fmt.Sprintf("HTTP code: %d", res.StatusCode), res) - } else if res.StatusCode != 200 { + } else if res.StatusCode != http.StatusOK { errBody, err := ioutil.ReadAll(res.Body) if err != nil { logrus.Debugf("Error reading response body: %s", err) @@ -489,7 +492,7 @@ func (r *Session) PushImageChecksumRegistry(imgData *ImgData, registry string) e logrus.Debugf("[registry] Calling PUT %s", u) - req, err := http.NewRequest("PUT", u, nil) + req, err := http.NewRequest(http.MethodPut, u, nil) if err != nil { return err } @@ -504,7 +507,7 @@ func (r *Session) PushImageChecksumRegistry(imgData *ImgData, registry string) e if len(res.Cookies()) > 0 { r.client.Jar.SetCookies(req.URL, res.Cookies()) } - if res.StatusCode != 200 { + if res.StatusCode != http.StatusOK { errBody, err := ioutil.ReadAll(res.Body) if err != nil { return fmt.Errorf("HTTP code %d while uploading metadata and error when trying to parse response body: %s", res.StatusCode, err) @@ -527,7 +530,7 @@ func (r *Session) PushImageJSONRegistry(imgData *ImgData, jsonRaw []byte, regist logrus.Debugf("[registry] Calling PUT %s", u) - req, err := http.NewRequest("PUT", u, bytes.NewReader(jsonRaw)) + req, err := http.NewRequest(http.MethodPut, u, bytes.NewReader(jsonRaw)) if err != nil { return err } @@ -538,10 +541,10 @@ func (r *Session) PushImageJSONRegistry(imgData *ImgData, jsonRaw []byte, regist return fmt.Errorf("Failed to upload metadata: %s", err) } defer res.Body.Close() - if res.StatusCode == 401 && strings.HasPrefix(registry, "http://") { + if res.StatusCode == http.StatusUnauthorized && strings.HasPrefix(registry, "http://") { return newJSONError("HTTP code 401, Docker will not send auth headers over HTTP.", res) } - if res.StatusCode != 200 { + if res.StatusCode != http.StatusOK { errBody, err := ioutil.ReadAll(res.Body) if err != nil { return newJSONError(fmt.Sprintf("HTTP code %d while uploading metadata and error when trying to parse response body: %s", res.StatusCode, err), res) @@ -572,7 +575,7 @@ func (r *Session) PushImageLayerRegistry(imgID string, layer io.Reader, registry h.Write([]byte{'\n'}) checksumLayer := io.TeeReader(tarsumLayer, h) - req, err := http.NewRequest("PUT", u, checksumLayer) + req, err := http.NewRequest(http.MethodPut, u, checksumLayer) if err != nil { return "", "", err } @@ -590,7 +593,7 @@ func (r *Session) PushImageLayerRegistry(imgID string, layer io.Reader, registry } defer res.Body.Close() - if res.StatusCode != 200 { + if res.StatusCode != http.StatusOK { errBody, err := ioutil.ReadAll(res.Body) if err != nil { return "", "", newJSONError(fmt.Sprintf("HTTP code %d while uploading metadata and error when trying to parse response body: %s", res.StatusCode, err), res) @@ -609,7 +612,7 @@ func (r *Session) PushRegistryTag(remote reference.Named, revision, tag, registr revision = "\"" + revision + "\"" path := fmt.Sprintf("repositories/%s/tags/%s", reference.Path(remote), tag) - req, err := http.NewRequest("PUT", registry+path, strings.NewReader(revision)) + req, err := http.NewRequest(http.MethodPut, registry+path, strings.NewReader(revision)) if err != nil { return err } @@ -620,7 +623,7 @@ func (r *Session) PushRegistryTag(remote reference.Named, revision, tag, registr return err } res.Body.Close() - if res.StatusCode != 200 && res.StatusCode != 201 { + if res.StatusCode != http.StatusOK && res.StatusCode != http.StatusCreated { return newJSONError(fmt.Sprintf("Internal server error: %d trying to push tag %s on %s", res.StatusCode, tag, reference.Path(remote)), res) } return nil @@ -674,13 +677,13 @@ func (r *Session) PushImageJSONIndex(remote reference.Named, imgList []*ImgData, } defer res.Body.Close() - if res.StatusCode == 401 { + if res.StatusCode == http.StatusUnauthorized { return nil, errcode.ErrorCodeUnauthorized.WithArgs() } var tokens, endpoints []string if !validate { - if res.StatusCode != 200 && res.StatusCode != 201 { + if res.StatusCode != http.StatusOK && res.StatusCode != http.StatusCreated { errBody, err := ioutil.ReadAll(res.Body) if err != nil { logrus.Debugf("Error reading response body: %s", err) @@ -698,7 +701,7 @@ func (r *Session) PushImageJSONIndex(remote reference.Named, imgList []*ImgData, return nil, err } } else { - if res.StatusCode != 204 { + if res.StatusCode != http.StatusNoContent { errBody, err := ioutil.ReadAll(res.Body) if err != nil { logrus.Debugf("Error reading response body: %s", err) @@ -713,7 +716,7 @@ func (r *Session) PushImageJSONIndex(remote reference.Named, imgList []*ImgData, } func (r *Session) putImageRequest(u string, headers map[string][]string, body []byte) (*http.Response, error) { - req, err := http.NewRequest("PUT", u, bytes.NewReader(body)) + req, err := http.NewRequest(http.MethodPut, u, bytes.NewReader(body)) if err != nil { return nil, err } @@ -740,7 +743,7 @@ func (r *Session) SearchRepositories(term string, limit int) (*registrytypes.Sea logrus.Debugf("Index server: %s", r.indexEndpoint) u := r.indexEndpoint.String() + "search?q=" + url.QueryEscape(term) + "&n=" + url.QueryEscape(fmt.Sprintf("%d", limit)) - req, err := http.NewRequest("GET", u, nil) + req, err := http.NewRequest(http.MethodGet, u, nil) if err != nil { return nil, errors.Wrap(errdefs.InvalidParameter(err), "Error building request") } @@ -751,7 +754,7 @@ func (r *Session) SearchRepositories(term string, limit int) (*registrytypes.Sea return nil, errdefs.System(err) } defer res.Body.Close() - if res.StatusCode != 200 { + if res.StatusCode != http.StatusOK { return nil, newJSONError(fmt.Sprintf("Unexpected status code %d", res.StatusCode), res) } result := new(registrytypes.SearchResults) diff --git a/vendor/github.com/docker/docker/volume/mounts/lcow_parser.go b/vendor/github.com/docker/docker/volume/mounts/lcow_parser.go deleted file mode 100644 index bafb7b07f84c..000000000000 --- a/vendor/github.com/docker/docker/volume/mounts/lcow_parser.go +++ /dev/null @@ -1,34 +0,0 @@ -package mounts // import "github.com/docker/docker/volume/mounts" - -import ( - "errors" - "path" - - "github.com/docker/docker/api/types/mount" -) - -var lcowSpecificValidators mountValidator = func(m *mount.Mount) error { - if path.Clean(m.Target) == "/" { - return ErrVolumeTargetIsRoot - } - if m.Type == mount.TypeNamedPipe { - return errors.New("Linux containers on Windows do not support named pipe mounts") - } - return nil -} - -type lcowParser struct { - windowsParser -} - -func (p *lcowParser) ValidateMountConfig(mnt *mount.Mount) error { - return p.validateMountConfigReg(mnt, rxLCOWDestination, lcowSpecificValidators) -} - -func (p *lcowParser) ParseMountRaw(raw, volumeDriver string) (*MountPoint, error) { - return p.parseMountRaw(raw, volumeDriver, rxLCOWDestination, false, lcowSpecificValidators) -} - -func (p *lcowParser) ParseMountSpec(cfg mount.Mount) (*MountPoint, error) { - return p.parseMountSpec(cfg, rxLCOWDestination, false, lcowSpecificValidators) -} diff --git a/vendor/github.com/docker/docker/volume/mounts/linux_parser.go b/vendor/github.com/docker/docker/volume/mounts/linux_parser.go deleted file mode 100644 index b5ed4af6a36b..000000000000 --- a/vendor/github.com/docker/docker/volume/mounts/linux_parser.go +++ /dev/null @@ -1,423 +0,0 @@ -package mounts // import "github.com/docker/docker/volume/mounts" - -import ( - "errors" - "fmt" - "path" - "path/filepath" - "strings" - - "github.com/docker/docker/api/types/mount" - "github.com/docker/docker/pkg/stringid" - "github.com/docker/docker/volume" -) - -type linuxParser struct { -} - -func linuxSplitRawSpec(raw string) ([]string, error) { - if strings.Count(raw, ":") > 2 { - return nil, errInvalidSpec(raw) - } - - arr := strings.SplitN(raw, ":", 3) - if arr[0] == "" { - return nil, errInvalidSpec(raw) - } - return arr, nil -} - -func linuxValidateNotRoot(p string) error { - p = path.Clean(strings.Replace(p, `\`, `/`, -1)) - if p == "/" { - return ErrVolumeTargetIsRoot - } - return nil -} -func linuxValidateAbsolute(p string) error { - p = strings.Replace(p, `\`, `/`, -1) - if path.IsAbs(p) { - return nil - } - return fmt.Errorf("invalid mount path: '%s' mount path must be absolute", p) -} -func (p *linuxParser) ValidateMountConfig(mnt *mount.Mount) error { - // there was something looking like a bug in existing codebase: - // - validateMountConfig on linux was called with options skipping bind source existence when calling ParseMountRaw - // - but not when calling ParseMountSpec directly... nor when the unit test called it directly - return p.validateMountConfigImpl(mnt, true) -} -func (p *linuxParser) validateMountConfigImpl(mnt *mount.Mount, validateBindSourceExists bool) error { - if len(mnt.Target) == 0 { - return &errMountConfig{mnt, errMissingField("Target")} - } - - if err := linuxValidateNotRoot(mnt.Target); err != nil { - return &errMountConfig{mnt, err} - } - - if err := linuxValidateAbsolute(mnt.Target); err != nil { - return &errMountConfig{mnt, err} - } - - switch mnt.Type { - case mount.TypeBind: - if len(mnt.Source) == 0 { - return &errMountConfig{mnt, errMissingField("Source")} - } - // Don't error out just because the propagation mode is not supported on the platform - if opts := mnt.BindOptions; opts != nil { - if len(opts.Propagation) > 0 && len(linuxPropagationModes) > 0 { - if _, ok := linuxPropagationModes[opts.Propagation]; !ok { - return &errMountConfig{mnt, fmt.Errorf("invalid propagation mode: %s", opts.Propagation)} - } - } - } - if mnt.VolumeOptions != nil { - return &errMountConfig{mnt, errExtraField("VolumeOptions")} - } - - if err := linuxValidateAbsolute(mnt.Source); err != nil { - return &errMountConfig{mnt, err} - } - - if validateBindSourceExists { - exists, _, err := currentFileInfoProvider.fileInfo(mnt.Source) - if err != nil { - return &errMountConfig{mnt, err} - } - if !exists { - return &errMountConfig{mnt, errBindSourceDoesNotExist(mnt.Source)} - } - } - - case mount.TypeVolume: - if mnt.BindOptions != nil { - return &errMountConfig{mnt, errExtraField("BindOptions")} - } - - if len(mnt.Source) == 0 && mnt.ReadOnly { - return &errMountConfig{mnt, fmt.Errorf("must not set ReadOnly mode when using anonymous volumes")} - } - case mount.TypeTmpfs: - if mnt.BindOptions != nil { - return &errMountConfig{mnt, errExtraField("BindOptions")} - } - if len(mnt.Source) != 0 { - return &errMountConfig{mnt, errExtraField("Source")} - } - if _, err := p.ConvertTmpfsOptions(mnt.TmpfsOptions, mnt.ReadOnly); err != nil { - return &errMountConfig{mnt, err} - } - default: - return &errMountConfig{mnt, errors.New("mount type unknown")} - } - return nil -} - -// read-write modes -var rwModes = map[string]bool{ - "rw": true, - "ro": true, -} - -// label modes -var linuxLabelModes = map[string]bool{ - "Z": true, - "z": true, -} - -// consistency modes -var linuxConsistencyModes = map[mount.Consistency]bool{ - mount.ConsistencyFull: true, - mount.ConsistencyCached: true, - mount.ConsistencyDelegated: true, -} -var linuxPropagationModes = map[mount.Propagation]bool{ - mount.PropagationPrivate: true, - mount.PropagationRPrivate: true, - mount.PropagationSlave: true, - mount.PropagationRSlave: true, - mount.PropagationShared: true, - mount.PropagationRShared: true, -} - -const linuxDefaultPropagationMode = mount.PropagationRPrivate - -func linuxGetPropagation(mode string) mount.Propagation { - for _, o := range strings.Split(mode, ",") { - prop := mount.Propagation(o) - if linuxPropagationModes[prop] { - return prop - } - } - return linuxDefaultPropagationMode -} - -func linuxHasPropagation(mode string) bool { - for _, o := range strings.Split(mode, ",") { - if linuxPropagationModes[mount.Propagation(o)] { - return true - } - } - return false -} - -func linuxValidMountMode(mode string) bool { - if mode == "" { - return true - } - - rwModeCount := 0 - labelModeCount := 0 - propagationModeCount := 0 - copyModeCount := 0 - consistencyModeCount := 0 - - for _, o := range strings.Split(mode, ",") { - switch { - case rwModes[o]: - rwModeCount++ - case linuxLabelModes[o]: - labelModeCount++ - case linuxPropagationModes[mount.Propagation(o)]: - propagationModeCount++ - case copyModeExists(o): - copyModeCount++ - case linuxConsistencyModes[mount.Consistency(o)]: - consistencyModeCount++ - default: - return false - } - } - - // Only one string for each mode is allowed. - if rwModeCount > 1 || labelModeCount > 1 || propagationModeCount > 1 || copyModeCount > 1 || consistencyModeCount > 1 { - return false - } - return true -} - -func (p *linuxParser) ReadWrite(mode string) bool { - if !linuxValidMountMode(mode) { - return false - } - - for _, o := range strings.Split(mode, ",") { - if o == "ro" { - return false - } - } - return true -} - -func (p *linuxParser) ParseMountRaw(raw, volumeDriver string) (*MountPoint, error) { - arr, err := linuxSplitRawSpec(raw) - if err != nil { - return nil, err - } - - var spec mount.Mount - var mode string - switch len(arr) { - case 1: - // Just a destination path in the container - spec.Target = arr[0] - case 2: - if linuxValidMountMode(arr[1]) { - // Destination + Mode is not a valid volume - volumes - // cannot include a mode. e.g. /foo:rw - return nil, errInvalidSpec(raw) - } - // Host Source Path or Name + Destination - spec.Source = arr[0] - spec.Target = arr[1] - case 3: - // HostSourcePath+DestinationPath+Mode - spec.Source = arr[0] - spec.Target = arr[1] - mode = arr[2] - default: - return nil, errInvalidSpec(raw) - } - - if !linuxValidMountMode(mode) { - return nil, errInvalidMode(mode) - } - - if path.IsAbs(spec.Source) { - spec.Type = mount.TypeBind - } else { - spec.Type = mount.TypeVolume - } - - spec.ReadOnly = !p.ReadWrite(mode) - - // cannot assume that if a volume driver is passed in that we should set it - if volumeDriver != "" && spec.Type == mount.TypeVolume { - spec.VolumeOptions = &mount.VolumeOptions{ - DriverConfig: &mount.Driver{Name: volumeDriver}, - } - } - - if copyData, isSet := getCopyMode(mode, p.DefaultCopyMode()); isSet { - if spec.VolumeOptions == nil { - spec.VolumeOptions = &mount.VolumeOptions{} - } - spec.VolumeOptions.NoCopy = !copyData - } - if linuxHasPropagation(mode) { - spec.BindOptions = &mount.BindOptions{ - Propagation: linuxGetPropagation(mode), - } - } - - mp, err := p.parseMountSpec(spec, false) - if mp != nil { - mp.Mode = mode - } - if err != nil { - err = fmt.Errorf("%v: %v", errInvalidSpec(raw), err) - } - return mp, err -} -func (p *linuxParser) ParseMountSpec(cfg mount.Mount) (*MountPoint, error) { - return p.parseMountSpec(cfg, true) -} -func (p *linuxParser) parseMountSpec(cfg mount.Mount, validateBindSourceExists bool) (*MountPoint, error) { - if err := p.validateMountConfigImpl(&cfg, validateBindSourceExists); err != nil { - return nil, err - } - mp := &MountPoint{ - RW: !cfg.ReadOnly, - Destination: path.Clean(filepath.ToSlash(cfg.Target)), - Type: cfg.Type, - Spec: cfg, - } - - switch cfg.Type { - case mount.TypeVolume: - if cfg.Source == "" { - mp.Name = stringid.GenerateRandomID() - } else { - mp.Name = cfg.Source - } - mp.CopyData = p.DefaultCopyMode() - - if cfg.VolumeOptions != nil { - if cfg.VolumeOptions.DriverConfig != nil { - mp.Driver = cfg.VolumeOptions.DriverConfig.Name - } - if cfg.VolumeOptions.NoCopy { - mp.CopyData = false - } - } - case mount.TypeBind: - mp.Source = path.Clean(filepath.ToSlash(cfg.Source)) - if cfg.BindOptions != nil && len(cfg.BindOptions.Propagation) > 0 { - mp.Propagation = cfg.BindOptions.Propagation - } else { - // If user did not specify a propagation mode, get - // default propagation mode. - mp.Propagation = linuxDefaultPropagationMode - } - case mount.TypeTmpfs: - // NOP - } - return mp, nil -} - -func (p *linuxParser) ParseVolumesFrom(spec string) (string, string, error) { - if len(spec) == 0 { - return "", "", fmt.Errorf("volumes-from specification cannot be an empty string") - } - - specParts := strings.SplitN(spec, ":", 2) - id := specParts[0] - mode := "rw" - - if len(specParts) == 2 { - mode = specParts[1] - if !linuxValidMountMode(mode) { - return "", "", errInvalidMode(mode) - } - // For now don't allow propagation properties while importing - // volumes from data container. These volumes will inherit - // the same propagation property as of the original volume - // in data container. This probably can be relaxed in future. - if linuxHasPropagation(mode) { - return "", "", errInvalidMode(mode) - } - // Do not allow copy modes on volumes-from - if _, isSet := getCopyMode(mode, p.DefaultCopyMode()); isSet { - return "", "", errInvalidMode(mode) - } - } - return id, mode, nil -} - -func (p *linuxParser) DefaultPropagationMode() mount.Propagation { - return linuxDefaultPropagationMode -} - -func (p *linuxParser) ConvertTmpfsOptions(opt *mount.TmpfsOptions, readOnly bool) (string, error) { - var rawOpts []string - if readOnly { - rawOpts = append(rawOpts, "ro") - } - - if opt != nil && opt.Mode != 0 { - rawOpts = append(rawOpts, fmt.Sprintf("mode=%o", opt.Mode)) - } - - if opt != nil && opt.SizeBytes != 0 { - // calculate suffix here, making this linux specific, but that is - // okay, since API is that way anyways. - - // we do this by finding the suffix that divides evenly into the - // value, returning the value itself, with no suffix, if it fails. - // - // For the most part, we don't enforce any semantic to this values. - // The operating system will usually align this and enforce minimum - // and maximums. - var ( - size = opt.SizeBytes - suffix string - ) - for _, r := range []struct { - suffix string - divisor int64 - }{ - {"g", 1 << 30}, - {"m", 1 << 20}, - {"k", 1 << 10}, - } { - if size%r.divisor == 0 { - size = size / r.divisor - suffix = r.suffix - break - } - } - - rawOpts = append(rawOpts, fmt.Sprintf("size=%d%s", size, suffix)) - } - return strings.Join(rawOpts, ","), nil -} - -func (p *linuxParser) DefaultCopyMode() bool { - return true -} -func (p *linuxParser) ValidateVolumeName(name string) error { - return nil -} - -func (p *linuxParser) IsBackwardCompatible(m *MountPoint) bool { - return len(m.Source) > 0 || m.Driver == volume.DefaultDriverName -} - -func (p *linuxParser) ValidateTmpfsMountDestination(dest string) error { - if err := linuxValidateNotRoot(dest); err != nil { - return err - } - return linuxValidateAbsolute(dest) -} diff --git a/vendor/github.com/docker/docker/volume/mounts/mounts.go b/vendor/github.com/docker/docker/volume/mounts/mounts.go deleted file mode 100644 index c441e51ed901..000000000000 --- a/vendor/github.com/docker/docker/volume/mounts/mounts.go +++ /dev/null @@ -1,181 +0,0 @@ -package mounts // import "github.com/docker/docker/volume/mounts" - -import ( - "fmt" - "os" - "path/filepath" - "syscall" - - mounttypes "github.com/docker/docker/api/types/mount" - "github.com/docker/docker/pkg/idtools" - "github.com/docker/docker/pkg/stringid" - "github.com/docker/docker/volume" - "github.com/opencontainers/selinux/go-selinux/label" - "github.com/pkg/errors" -) - -// MountPoint is the intersection point between a volume and a container. It -// specifies which volume is to be used and where inside a container it should -// be mounted. -// -// Note that this type is embedded in `container.Container` object and persisted to disk. -// Changes to this struct need to by synced with on disk state. -type MountPoint struct { - // Source is the source path of the mount. - // E.g. `mount --bind /foo /bar`, `/foo` is the `Source`. - Source string - // Destination is the path relative to the container root (`/`) to the mount point - // It is where the `Source` is mounted to - Destination string - // RW is set to true when the mountpoint should be mounted as read-write - RW bool - // Name is the name reference to the underlying data defined by `Source` - // e.g., the volume name - Name string - // Driver is the volume driver used to create the volume (if it is a volume) - Driver string - // Type of mount to use, see `Type` definitions in github.com/docker/docker/api/types/mount - Type mounttypes.Type `json:",omitempty"` - // Volume is the volume providing data to this mountpoint. - // This is nil unless `Type` is set to `TypeVolume` - Volume volume.Volume `json:"-"` - - // Mode is the comma separated list of options supplied by the user when creating - // the bind/volume mount. - // Note Mode is not used on Windows - Mode string `json:"Relabel,omitempty"` // Originally field was `Relabel`" - - // Propagation describes how the mounts are propagated from the host into the - // mount point, and vice-versa. - // See https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt - // Note Propagation is not used on Windows - Propagation mounttypes.Propagation `json:",omitempty"` // Mount propagation string - - // Specifies if data should be copied from the container before the first mount - // Use a pointer here so we can tell if the user set this value explicitly - // This allows us to error out when the user explicitly enabled copy but we can't copy due to the volume being populated - CopyData bool `json:"-"` - // ID is the opaque ID used to pass to the volume driver. - // This should be set by calls to `Mount` and unset by calls to `Unmount` - ID string `json:",omitempty"` - - // Sepc is a copy of the API request that created this mount. - Spec mounttypes.Mount - - // Some bind mounts should not be automatically created. - // (Some are auto-created for backwards-compatibility) - // This is checked on the API but setting this here prevents race conditions. - // where a bind dir existed during validation was removed before reaching the setup code. - SkipMountpointCreation bool - - // Track usage of this mountpoint - // Specifically needed for containers which are running and calls to `docker cp` - // because both these actions require mounting the volumes. - active int -} - -// Cleanup frees resources used by the mountpoint -func (m *MountPoint) Cleanup() error { - if m.Volume == nil || m.ID == "" { - return nil - } - - if err := m.Volume.Unmount(m.ID); err != nil { - return errors.Wrapf(err, "error unmounting volume %s", m.Volume.Name()) - } - - m.active-- - if m.active == 0 { - m.ID = "" - } - return nil -} - -// Setup sets up a mount point by either mounting the volume if it is -// configured, or creating the source directory if supplied. -// The, optional, checkFun parameter allows doing additional checking -// before creating the source directory on the host. -func (m *MountPoint) Setup(mountLabel string, rootIDs idtools.Identity, checkFun func(m *MountPoint) error) (path string, err error) { - if m.SkipMountpointCreation { - return m.Source, nil - } - - defer func() { - if err != nil || !label.RelabelNeeded(m.Mode) { - return - } - - var sourcePath string - sourcePath, err = filepath.EvalSymlinks(m.Source) - if err != nil { - path = "" - err = errors.Wrapf(err, "error evaluating symlinks from mount source %q", m.Source) - return - } - err = label.Relabel(sourcePath, mountLabel, label.IsShared(m.Mode)) - if errors.Is(err, syscall.ENOTSUP) { - err = nil - } - if err != nil { - path = "" - err = errors.Wrapf(err, "error setting label on mount source '%s'", sourcePath) - } - }() - - if m.Volume != nil { - id := m.ID - if id == "" { - id = stringid.GenerateRandomID() - } - path, err := m.Volume.Mount(id) - if err != nil { - return "", errors.Wrapf(err, "error while mounting volume '%s'", m.Source) - } - - m.ID = id - m.active++ - return path, nil - } - - if len(m.Source) == 0 { - return "", fmt.Errorf("Unable to setup mount point, neither source nor volume defined") - } - - if m.Type == mounttypes.TypeBind { - // Before creating the source directory on the host, invoke checkFun if it's not nil. One of - // the use case is to forbid creating the daemon socket as a directory if the daemon is in - // the process of shutting down. - if checkFun != nil { - if err := checkFun(m); err != nil { - return "", err - } - } - - // idtools.MkdirAllNewAs() produces an error if m.Source exists and is a file (not a directory) - // also, makes sure that if the directory is created, the correct remapped rootUID/rootGID will own it - if err := idtools.MkdirAllAndChownNew(m.Source, 0755, rootIDs); err != nil { - if perr, ok := err.(*os.PathError); ok { - if perr.Err != syscall.ENOTDIR { - return "", errors.Wrapf(err, "error while creating mount source path '%s'", m.Source) - } - } - } - } - return m.Source, nil -} - -// Path returns the path of a volume in a mount point. -func (m *MountPoint) Path() string { - if m.Volume != nil { - return m.Volume.Path() - } - return m.Source -} - -func errInvalidMode(mode string) error { - return errors.Errorf("invalid mode: %v", mode) -} - -func errInvalidSpec(spec string) error { - return errors.Errorf("invalid volume specification: '%s'", spec) -} diff --git a/vendor/github.com/docker/docker/volume/mounts/parser.go b/vendor/github.com/docker/docker/volume/mounts/parser.go deleted file mode 100644 index 73681750ea75..000000000000 --- a/vendor/github.com/docker/docker/volume/mounts/parser.go +++ /dev/null @@ -1,47 +0,0 @@ -package mounts // import "github.com/docker/docker/volume/mounts" - -import ( - "errors" - "runtime" - - "github.com/docker/docker/api/types/mount" -) - -const ( - // OSLinux is the same as runtime.GOOS on linux - OSLinux = "linux" - // OSWindows is the same as runtime.GOOS on windows - OSWindows = "windows" -) - -// ErrVolumeTargetIsRoot is returned when the target destination is root. -// It's used by both LCOW and Linux parsers. -var ErrVolumeTargetIsRoot = errors.New("invalid specification: destination can't be '/'") - -// Parser represents a platform specific parser for mount expressions -type Parser interface { - ParseMountRaw(raw, volumeDriver string) (*MountPoint, error) - ParseMountSpec(cfg mount.Mount) (*MountPoint, error) - ParseVolumesFrom(spec string) (string, string, error) - DefaultPropagationMode() mount.Propagation - ConvertTmpfsOptions(opt *mount.TmpfsOptions, readOnly bool) (string, error) - DefaultCopyMode() bool - ValidateVolumeName(name string) error - ReadWrite(mode string) bool - IsBackwardCompatible(m *MountPoint) bool - HasResource(m *MountPoint, absPath string) bool - ValidateTmpfsMountDestination(dest string) error - ValidateMountConfig(mt *mount.Mount) error -} - -// NewParser creates a parser for a given container OS, depending on the current host OS (linux on a windows host will resolve to an lcowParser) -func NewParser(containerOS string) Parser { - switch containerOS { - case OSWindows: - return &windowsParser{} - } - if runtime.GOOS == OSWindows { - return &lcowParser{} - } - return &linuxParser{} -} diff --git a/vendor/github.com/docker/docker/volume/mounts/validate.go b/vendor/github.com/docker/docker/volume/mounts/validate.go deleted file mode 100644 index 9fc91090219d..000000000000 --- a/vendor/github.com/docker/docker/volume/mounts/validate.go +++ /dev/null @@ -1,28 +0,0 @@ -package mounts // import "github.com/docker/docker/volume/mounts" - -import ( - "fmt" - - "github.com/docker/docker/api/types/mount" - "github.com/pkg/errors" -) - -type errMountConfig struct { - mount *mount.Mount - err error -} - -func (e *errMountConfig) Error() string { - return fmt.Sprintf("invalid mount config for type %q: %v", e.mount.Type, e.err.Error()) -} - -func errBindSourceDoesNotExist(path string) error { - return errors.Errorf("bind source path does not exist: %s", path) -} - -func errExtraField(name string) error { - return errors.Errorf("field %s must not be specified", name) -} -func errMissingField(name string) error { - return errors.Errorf("field %s must not be empty", name) -} diff --git a/vendor/github.com/docker/docker/volume/mounts/volume_copy.go b/vendor/github.com/docker/docker/volume/mounts/volume_copy.go deleted file mode 100644 index 04056fa50a6a..000000000000 --- a/vendor/github.com/docker/docker/volume/mounts/volume_copy.go +++ /dev/null @@ -1,23 +0,0 @@ -package mounts // import "github.com/docker/docker/volume/mounts" - -import "strings" - -// {=isEnabled} -var copyModes = map[string]bool{ - "nocopy": false, -} - -func copyModeExists(mode string) bool { - _, exists := copyModes[mode] - return exists -} - -// GetCopyMode gets the copy mode from the mode string for mounts -func getCopyMode(mode string, def bool) (bool, bool) { - for _, o := range strings.Split(mode, ",") { - if isEnabled, exists := copyModes[o]; exists { - return isEnabled, true - } - } - return def, false -} diff --git a/vendor/github.com/docker/docker/volume/mounts/volume_unix.go b/vendor/github.com/docker/docker/volume/mounts/volume_unix.go deleted file mode 100644 index c6d51e07101d..000000000000 --- a/vendor/github.com/docker/docker/volume/mounts/volume_unix.go +++ /dev/null @@ -1,18 +0,0 @@ -// +build linux freebsd darwin - -package mounts // import "github.com/docker/docker/volume/mounts" - -import ( - "fmt" - "path/filepath" - "strings" -) - -func (p *linuxParser) HasResource(m *MountPoint, absolutePath string) bool { - relPath, err := filepath.Rel(m.Destination, absolutePath) - return err == nil && relPath != ".." && !strings.HasPrefix(relPath, fmt.Sprintf("..%c", filepath.Separator)) -} - -func (p *windowsParser) HasResource(m *MountPoint, absolutePath string) bool { - return false -} diff --git a/vendor/github.com/docker/docker/volume/mounts/volume_windows.go b/vendor/github.com/docker/docker/volume/mounts/volume_windows.go deleted file mode 100644 index 773e7db88ae2..000000000000 --- a/vendor/github.com/docker/docker/volume/mounts/volume_windows.go +++ /dev/null @@ -1,8 +0,0 @@ -package mounts // import "github.com/docker/docker/volume/mounts" - -func (p *windowsParser) HasResource(m *MountPoint, absolutePath string) bool { - return false -} -func (p *linuxParser) HasResource(m *MountPoint, absolutePath string) bool { - return false -} diff --git a/vendor/github.com/docker/docker/volume/mounts/windows_parser.go b/vendor/github.com/docker/docker/volume/mounts/windows_parser.go deleted file mode 100644 index 8f427d8c5008..000000000000 --- a/vendor/github.com/docker/docker/volume/mounts/windows_parser.go +++ /dev/null @@ -1,456 +0,0 @@ -package mounts // import "github.com/docker/docker/volume/mounts" - -import ( - "errors" - "fmt" - "os" - "regexp" - "runtime" - "strings" - - "github.com/docker/docker/api/types/mount" - "github.com/docker/docker/pkg/stringid" -) - -type windowsParser struct { -} - -const ( - // Spec should be in the format [source:]destination[:mode] - // - // Examples: c:\foo bar:d:rw - // c:\foo:d:\bar - // myname:d: - // d:\ - // - // Explanation of this regex! Thanks @thaJeztah on IRC and gist for help. See - // https://gist.github.com/thaJeztah/6185659e4978789fb2b2. A good place to - // test is https://regex-golang.appspot.com/assets/html/index.html - // - // Useful link for referencing named capturing groups: - // http://stackoverflow.com/questions/20750843/using-named-matches-from-go-regex - // - // There are three match groups: source, destination and mode. - // - - // rxHostDir is the first option of a source - rxHostDir = `(?:\\\\\?\\)?[a-z]:[\\/](?:[^\\/:*?"<>|\r\n]+[\\/]?)*` - // rxName is the second option of a source - rxName = `[^\\/:*?"<>|\r\n]+` - - // RXReservedNames are reserved names not possible on Windows - rxReservedNames = `(con)|(prn)|(nul)|(aux)|(com[1-9])|(lpt[1-9])` - - // rxPipe is a named path pipe (starts with `\\.\pipe\`, possibly with / instead of \) - rxPipe = `[/\\]{2}.[/\\]pipe[/\\][^:*?"<>|\r\n]+` - // rxSource is the combined possibilities for a source - rxSource = `((?P((` + rxHostDir + `)|(` + rxName + `)|(` + rxPipe + `))):)?` - - // Source. Can be either a host directory, a name, or omitted: - // HostDir: - // - Essentially using the folder solution from - // https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9781449327453/ch08s18.html - // but adding case insensitivity. - // - Must be an absolute path such as c:\path - // - Can include spaces such as `c:\program files` - // - And then followed by a colon which is not in the capture group - // - And can be optional - // Name: - // - Must not contain invalid NTFS filename characters (https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx) - // - And then followed by a colon which is not in the capture group - // - And can be optional - - // rxDestination is the regex expression for the mount destination - rxDestination = `(?P((?:\\\\\?\\)?([a-z]):((?:[\\/][^\\/:*?"<>\r\n]+)*[\\/]?))|(` + rxPipe + `))` - - rxLCOWDestination = `(?P/(?:[^\\/:*?"<>\r\n]+[/]?)*)` - // Destination (aka container path): - // - Variation on hostdir but can be a drive followed by colon as well - // - If a path, must be absolute. Can include spaces - // - Drive cannot be c: (explicitly checked in code, not RegEx) - - // rxMode is the regex expression for the mode of the mount - // Mode (optional): - // - Hopefully self explanatory in comparison to above regex's. - // - Colon is not in the capture group - rxMode = `(:(?P(?i)ro|rw))?` -) - -type mountValidator func(mnt *mount.Mount) error - -func windowsSplitRawSpec(raw, destRegex string) ([]string, error) { - specExp := regexp.MustCompile(`^` + rxSource + destRegex + rxMode + `$`) - match := specExp.FindStringSubmatch(strings.ToLower(raw)) - - // Must have something back - if len(match) == 0 { - return nil, errInvalidSpec(raw) - } - - var split []string - matchgroups := make(map[string]string) - // Pull out the sub expressions from the named capture groups - for i, name := range specExp.SubexpNames() { - matchgroups[name] = strings.ToLower(match[i]) - } - if source, exists := matchgroups["source"]; exists { - if source != "" { - split = append(split, source) - } - } - if destination, exists := matchgroups["destination"]; exists { - if destination != "" { - split = append(split, destination) - } - } - if mode, exists := matchgroups["mode"]; exists { - if mode != "" { - split = append(split, mode) - } - } - // Fix #26329. If the destination appears to be a file, and the source is null, - // it may be because we've fallen through the possible naming regex and hit a - // situation where the user intention was to map a file into a container through - // a local volume, but this is not supported by the platform. - if matchgroups["source"] == "" && matchgroups["destination"] != "" { - volExp := regexp.MustCompile(`^` + rxName + `$`) - reservedNameExp := regexp.MustCompile(`^` + rxReservedNames + `$`) - - if volExp.MatchString(matchgroups["destination"]) { - if reservedNameExp.MatchString(matchgroups["destination"]) { - return nil, fmt.Errorf("volume name %q cannot be a reserved word for Windows filenames", matchgroups["destination"]) - } - } else { - - exists, isDir, _ := currentFileInfoProvider.fileInfo(matchgroups["destination"]) - if exists && !isDir { - return nil, fmt.Errorf("file '%s' cannot be mapped. Only directories can be mapped on this platform", matchgroups["destination"]) - - } - } - } - return split, nil -} - -func windowsValidMountMode(mode string) bool { - if mode == "" { - return true - } - return rwModes[strings.ToLower(mode)] -} -func windowsValidateNotRoot(p string) error { - p = strings.ToLower(strings.Replace(p, `/`, `\`, -1)) - if p == "c:" || p == `c:\` { - return fmt.Errorf("destination path cannot be `c:` or `c:\\`: %v", p) - } - return nil -} - -var windowsSpecificValidators mountValidator = func(mnt *mount.Mount) error { - return windowsValidateNotRoot(mnt.Target) -} - -func windowsValidateRegex(p, r string) error { - if regexp.MustCompile(`^` + r + `$`).MatchString(strings.ToLower(p)) { - return nil - } - return fmt.Errorf("invalid mount path: '%s'", p) -} -func windowsValidateAbsolute(p string) error { - if err := windowsValidateRegex(p, rxDestination); err != nil { - return fmt.Errorf("invalid mount path: '%s' mount path must be absolute", p) - } - return nil -} - -func windowsDetectMountType(p string) mount.Type { - if strings.HasPrefix(p, `\\.\pipe\`) { - return mount.TypeNamedPipe - } else if regexp.MustCompile(`^` + rxHostDir + `$`).MatchString(p) { - return mount.TypeBind - } else { - return mount.TypeVolume - } -} - -func (p *windowsParser) ReadWrite(mode string) bool { - return strings.ToLower(mode) != "ro" -} - -// IsVolumeNameValid checks a volume name in a platform specific manner. -func (p *windowsParser) ValidateVolumeName(name string) error { - nameExp := regexp.MustCompile(`^` + rxName + `$`) - if !nameExp.MatchString(name) { - return errors.New("invalid volume name") - } - nameExp = regexp.MustCompile(`^` + rxReservedNames + `$`) - if nameExp.MatchString(name) { - return fmt.Errorf("volume name %q cannot be a reserved word for Windows filenames", name) - } - return nil -} -func (p *windowsParser) ValidateMountConfig(mnt *mount.Mount) error { - return p.validateMountConfigReg(mnt, rxDestination, windowsSpecificValidators) -} - -type fileInfoProvider interface { - fileInfo(path string) (exist, isDir bool, err error) -} - -type defaultFileInfoProvider struct { -} - -func (defaultFileInfoProvider) fileInfo(path string) (exist, isDir bool, err error) { - fi, err := os.Stat(path) - if err != nil { - if !os.IsNotExist(err) { - return false, false, err - } - return false, false, nil - } - return true, fi.IsDir(), nil -} - -var currentFileInfoProvider fileInfoProvider = defaultFileInfoProvider{} - -func (p *windowsParser) validateMountConfigReg(mnt *mount.Mount, destRegex string, additionalValidators ...mountValidator) error { - - for _, v := range additionalValidators { - if err := v(mnt); err != nil { - return &errMountConfig{mnt, err} - } - } - if len(mnt.Target) == 0 { - return &errMountConfig{mnt, errMissingField("Target")} - } - - if err := windowsValidateRegex(mnt.Target, destRegex); err != nil { - return &errMountConfig{mnt, err} - } - - switch mnt.Type { - case mount.TypeBind: - if len(mnt.Source) == 0 { - return &errMountConfig{mnt, errMissingField("Source")} - } - // Don't error out just because the propagation mode is not supported on the platform - if opts := mnt.BindOptions; opts != nil { - if len(opts.Propagation) > 0 { - return &errMountConfig{mnt, fmt.Errorf("invalid propagation mode: %s", opts.Propagation)} - } - } - if mnt.VolumeOptions != nil { - return &errMountConfig{mnt, errExtraField("VolumeOptions")} - } - - if err := windowsValidateAbsolute(mnt.Source); err != nil { - return &errMountConfig{mnt, err} - } - - exists, isdir, err := currentFileInfoProvider.fileInfo(mnt.Source) - if err != nil { - return &errMountConfig{mnt, err} - } - if !exists { - return &errMountConfig{mnt, errBindSourceDoesNotExist(mnt.Source)} - } - if !isdir { - return &errMountConfig{mnt, fmt.Errorf("source path must be a directory")} - } - - case mount.TypeVolume: - if mnt.BindOptions != nil { - return &errMountConfig{mnt, errExtraField("BindOptions")} - } - - if len(mnt.Source) == 0 && mnt.ReadOnly { - return &errMountConfig{mnt, fmt.Errorf("must not set ReadOnly mode when using anonymous volumes")} - } - - if len(mnt.Source) != 0 { - if err := p.ValidateVolumeName(mnt.Source); err != nil { - return &errMountConfig{mnt, err} - } - } - case mount.TypeNamedPipe: - if len(mnt.Source) == 0 { - return &errMountConfig{mnt, errMissingField("Source")} - } - - if mnt.BindOptions != nil { - return &errMountConfig{mnt, errExtraField("BindOptions")} - } - - if mnt.ReadOnly { - return &errMountConfig{mnt, errExtraField("ReadOnly")} - } - - if windowsDetectMountType(mnt.Source) != mount.TypeNamedPipe { - return &errMountConfig{mnt, fmt.Errorf("'%s' is not a valid pipe path", mnt.Source)} - } - - if windowsDetectMountType(mnt.Target) != mount.TypeNamedPipe { - return &errMountConfig{mnt, fmt.Errorf("'%s' is not a valid pipe path", mnt.Target)} - } - default: - return &errMountConfig{mnt, errors.New("mount type unknown")} - } - return nil -} -func (p *windowsParser) ParseMountRaw(raw, volumeDriver string) (*MountPoint, error) { - return p.parseMountRaw(raw, volumeDriver, rxDestination, true, windowsSpecificValidators) -} - -func (p *windowsParser) parseMountRaw(raw, volumeDriver, destRegex string, convertTargetToBackslash bool, additionalValidators ...mountValidator) (*MountPoint, error) { - arr, err := windowsSplitRawSpec(raw, destRegex) - if err != nil { - return nil, err - } - - var spec mount.Mount - var mode string - switch len(arr) { - case 1: - // Just a destination path in the container - spec.Target = arr[0] - case 2: - if windowsValidMountMode(arr[1]) { - // Destination + Mode is not a valid volume - volumes - // cannot include a mode. e.g. /foo:rw - return nil, errInvalidSpec(raw) - } - // Host Source Path or Name + Destination - spec.Source = strings.Replace(arr[0], `/`, `\`, -1) - spec.Target = arr[1] - case 3: - // HostSourcePath+DestinationPath+Mode - spec.Source = strings.Replace(arr[0], `/`, `\`, -1) - spec.Target = arr[1] - mode = arr[2] - default: - return nil, errInvalidSpec(raw) - } - if convertTargetToBackslash { - spec.Target = strings.Replace(spec.Target, `/`, `\`, -1) - } - - if !windowsValidMountMode(mode) { - return nil, errInvalidMode(mode) - } - - spec.Type = windowsDetectMountType(spec.Source) - spec.ReadOnly = !p.ReadWrite(mode) - - // cannot assume that if a volume driver is passed in that we should set it - if volumeDriver != "" && spec.Type == mount.TypeVolume { - spec.VolumeOptions = &mount.VolumeOptions{ - DriverConfig: &mount.Driver{Name: volumeDriver}, - } - } - - if copyData, isSet := getCopyMode(mode, p.DefaultCopyMode()); isSet { - if spec.VolumeOptions == nil { - spec.VolumeOptions = &mount.VolumeOptions{} - } - spec.VolumeOptions.NoCopy = !copyData - } - - mp, err := p.parseMountSpec(spec, destRegex, convertTargetToBackslash, additionalValidators...) - if mp != nil { - mp.Mode = mode - } - if err != nil { - err = fmt.Errorf("%v: %v", errInvalidSpec(raw), err) - } - return mp, err -} - -func (p *windowsParser) ParseMountSpec(cfg mount.Mount) (*MountPoint, error) { - return p.parseMountSpec(cfg, rxDestination, true, windowsSpecificValidators) -} -func (p *windowsParser) parseMountSpec(cfg mount.Mount, destRegex string, convertTargetToBackslash bool, additionalValidators ...mountValidator) (*MountPoint, error) { - if err := p.validateMountConfigReg(&cfg, destRegex, additionalValidators...); err != nil { - return nil, err - } - mp := &MountPoint{ - RW: !cfg.ReadOnly, - Destination: cfg.Target, - Type: cfg.Type, - Spec: cfg, - } - if convertTargetToBackslash { - mp.Destination = strings.Replace(cfg.Target, `/`, `\`, -1) - } - - switch cfg.Type { - case mount.TypeVolume: - if cfg.Source == "" { - mp.Name = stringid.GenerateRandomID() - } else { - mp.Name = cfg.Source - } - mp.CopyData = p.DefaultCopyMode() - - if cfg.VolumeOptions != nil { - if cfg.VolumeOptions.DriverConfig != nil { - mp.Driver = cfg.VolumeOptions.DriverConfig.Name - } - if cfg.VolumeOptions.NoCopy { - mp.CopyData = false - } - } - case mount.TypeBind: - mp.Source = strings.Replace(cfg.Source, `/`, `\`, -1) - case mount.TypeNamedPipe: - mp.Source = strings.Replace(cfg.Source, `/`, `\`, -1) - } - // cleanup trailing `\` except for paths like `c:\` - if len(mp.Source) > 3 && mp.Source[len(mp.Source)-1] == '\\' { - mp.Source = mp.Source[:len(mp.Source)-1] - } - if len(mp.Destination) > 3 && mp.Destination[len(mp.Destination)-1] == '\\' { - mp.Destination = mp.Destination[:len(mp.Destination)-1] - } - return mp, nil -} - -func (p *windowsParser) ParseVolumesFrom(spec string) (string, string, error) { - if len(spec) == 0 { - return "", "", fmt.Errorf("volumes-from specification cannot be an empty string") - } - - specParts := strings.SplitN(spec, ":", 2) - id := specParts[0] - mode := "rw" - - if len(specParts) == 2 { - mode = specParts[1] - if !windowsValidMountMode(mode) { - return "", "", errInvalidMode(mode) - } - - // Do not allow copy modes on volumes-from - if _, isSet := getCopyMode(mode, p.DefaultCopyMode()); isSet { - return "", "", errInvalidMode(mode) - } - } - return id, mode, nil -} - -func (p *windowsParser) DefaultPropagationMode() mount.Propagation { - return mount.Propagation("") -} - -func (p *windowsParser) ConvertTmpfsOptions(opt *mount.TmpfsOptions, readOnly bool) (string, error) { - return "", fmt.Errorf("%s does not support tmpfs", runtime.GOOS) -} -func (p *windowsParser) DefaultCopyMode() bool { - return false -} -func (p *windowsParser) IsBackwardCompatible(m *MountPoint) bool { - return false -} - -func (p *windowsParser) ValidateTmpfsMountDestination(dest string) error { - return errors.New("Platform does not support tmpfs") -} diff --git a/vendor/github.com/docker/docker/volume/volume.go b/vendor/github.com/docker/docker/volume/volume.go deleted file mode 100644 index 61c8243979f1..000000000000 --- a/vendor/github.com/docker/docker/volume/volume.go +++ /dev/null @@ -1,69 +0,0 @@ -package volume // import "github.com/docker/docker/volume" - -import ( - "time" -) - -// DefaultDriverName is the driver name used for the driver -// implemented in the local package. -const DefaultDriverName = "local" - -// Scopes define if a volume has is cluster-wide (global) or local only. -// Scopes are returned by the volume driver when it is queried for capabilities and then set on a volume -const ( - LocalScope = "local" - GlobalScope = "global" -) - -// Driver is for creating and removing volumes. -type Driver interface { - // Name returns the name of the volume driver. - Name() string - // Create makes a new volume with the given name. - Create(name string, opts map[string]string) (Volume, error) - // Remove deletes the volume. - Remove(vol Volume) (err error) - // List lists all the volumes the driver has - List() ([]Volume, error) - // Get retrieves the volume with the requested name - Get(name string) (Volume, error) - // Scope returns the scope of the driver (e.g. `global` or `local`). - // Scope determines how the driver is handled at a cluster level - Scope() string -} - -// Capability defines a set of capabilities that a driver is able to handle. -type Capability struct { - // Scope is the scope of the driver, `global` or `local` - // A `global` scope indicates that the driver manages volumes across the cluster - // A `local` scope indicates that the driver only manages volumes resources local to the host - // Scope is declared by the driver - Scope string -} - -// Volume is a place to store data. It is backed by a specific driver, and can be mounted. -type Volume interface { - // Name returns the name of the volume - Name() string - // DriverName returns the name of the driver which owns this volume. - DriverName() string - // Path returns the absolute path to the volume. - Path() string - // Mount mounts the volume and returns the absolute path to - // where it can be consumed. - Mount(id string) (string, error) - // Unmount unmounts the volume when it is no longer in use. - Unmount(id string) error - // CreatedAt returns Volume Creation time - CreatedAt() (time.Time, error) - // Status returns low-level status information about a volume - Status() map[string]interface{} -} - -// DetailedVolume wraps a Volume with user-defined labels, options, and cluster scope (e.g., `local` or `global`) -type DetailedVolume interface { - Labels() map[string]string - Options() map[string]string - Scope() string - Volume -} diff --git a/vendor/github.com/docker/go-connections/sockets/README.md b/vendor/github.com/docker/go-connections/sockets/README.md deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/vendor/github.com/docker/go-connections/sockets/inmem_socket.go b/vendor/github.com/docker/go-connections/sockets/inmem_socket.go deleted file mode 100644 index 99846ffddb1a..000000000000 --- a/vendor/github.com/docker/go-connections/sockets/inmem_socket.go +++ /dev/null @@ -1,81 +0,0 @@ -package sockets - -import ( - "errors" - "net" - "sync" -) - -var errClosed = errors.New("use of closed network connection") - -// InmemSocket implements net.Listener using in-memory only connections. -type InmemSocket struct { - chConn chan net.Conn - chClose chan struct{} - addr string - mu sync.Mutex -} - -// dummyAddr is used to satisfy net.Addr for the in-mem socket -// it is just stored as a string and returns the string for all calls -type dummyAddr string - -// NewInmemSocket creates an in-memory only net.Listener -// The addr argument can be any string, but is used to satisfy the `Addr()` part -// of the net.Listener interface -func NewInmemSocket(addr string, bufSize int) *InmemSocket { - return &InmemSocket{ - chConn: make(chan net.Conn, bufSize), - chClose: make(chan struct{}), - addr: addr, - } -} - -// Addr returns the socket's addr string to satisfy net.Listener -func (s *InmemSocket) Addr() net.Addr { - return dummyAddr(s.addr) -} - -// Accept implements the Accept method in the Listener interface; it waits for the next call and returns a generic Conn. -func (s *InmemSocket) Accept() (net.Conn, error) { - select { - case conn := <-s.chConn: - return conn, nil - case <-s.chClose: - return nil, errClosed - } -} - -// Close closes the listener. It will be unavailable for use once closed. -func (s *InmemSocket) Close() error { - s.mu.Lock() - defer s.mu.Unlock() - select { - case <-s.chClose: - default: - close(s.chClose) - } - return nil -} - -// Dial is used to establish a connection with the in-mem server -func (s *InmemSocket) Dial(network, addr string) (net.Conn, error) { - srvConn, clientConn := net.Pipe() - select { - case s.chConn <- srvConn: - case <-s.chClose: - return nil, errClosed - } - - return clientConn, nil -} - -// Network returns the addr string, satisfies net.Addr -func (a dummyAddr) Network() string { - return string(a) -} - -// String returns the string form -func (a dummyAddr) String() string { - return string(a) -} diff --git a/vendor/github.com/docker/go-connections/sockets/proxy.go b/vendor/github.com/docker/go-connections/sockets/proxy.go deleted file mode 100644 index 98e9a1dc61b5..000000000000 --- a/vendor/github.com/docker/go-connections/sockets/proxy.go +++ /dev/null @@ -1,51 +0,0 @@ -package sockets - -import ( - "net" - "net/url" - "os" - "strings" - - "golang.org/x/net/proxy" -) - -// GetProxyEnv allows access to the uppercase and the lowercase forms of -// proxy-related variables. See the Go specification for details on these -// variables. https://golang.org/pkg/net/http/ -func GetProxyEnv(key string) string { - proxyValue := os.Getenv(strings.ToUpper(key)) - if proxyValue == "" { - return os.Getenv(strings.ToLower(key)) - } - return proxyValue -} - -// DialerFromEnvironment takes in a "direct" *net.Dialer and returns a -// proxy.Dialer which will route the connections through the proxy using the -// given dialer. -func DialerFromEnvironment(direct *net.Dialer) (proxy.Dialer, error) { - allProxy := GetProxyEnv("all_proxy") - if len(allProxy) == 0 { - return direct, nil - } - - proxyURL, err := url.Parse(allProxy) - if err != nil { - return direct, err - } - - proxyFromURL, err := proxy.FromURL(proxyURL, direct) - if err != nil { - return direct, err - } - - noProxy := GetProxyEnv("no_proxy") - if len(noProxy) == 0 { - return proxyFromURL, nil - } - - perHost := proxy.NewPerHost(proxyFromURL, direct) - perHost.AddFromString(noProxy) - - return perHost, nil -} diff --git a/vendor/github.com/docker/go-connections/sockets/sockets.go b/vendor/github.com/docker/go-connections/sockets/sockets.go deleted file mode 100644 index a1d7beb4d805..000000000000 --- a/vendor/github.com/docker/go-connections/sockets/sockets.go +++ /dev/null @@ -1,38 +0,0 @@ -// Package sockets provides helper functions to create and configure Unix or TCP sockets. -package sockets - -import ( - "errors" - "net" - "net/http" - "time" -) - -// Why 32? See https://github.com/docker/docker/pull/8035. -const defaultTimeout = 32 * time.Second - -// ErrProtocolNotAvailable is returned when a given transport protocol is not provided by the operating system. -var ErrProtocolNotAvailable = errors.New("protocol not available") - -// ConfigureTransport configures the specified Transport according to the -// specified proto and addr. -// If the proto is unix (using a unix socket to communicate) or npipe the -// compression is disabled. -func ConfigureTransport(tr *http.Transport, proto, addr string) error { - switch proto { - case "unix": - return configureUnixTransport(tr, proto, addr) - case "npipe": - return configureNpipeTransport(tr, proto, addr) - default: - tr.Proxy = http.ProxyFromEnvironment - dialer, err := DialerFromEnvironment(&net.Dialer{ - Timeout: defaultTimeout, - }) - if err != nil { - return err - } - tr.Dial = dialer.Dial - } - return nil -} diff --git a/vendor/github.com/docker/go-connections/sockets/sockets_unix.go b/vendor/github.com/docker/go-connections/sockets/sockets_unix.go deleted file mode 100644 index 386cf0dbbdec..000000000000 --- a/vendor/github.com/docker/go-connections/sockets/sockets_unix.go +++ /dev/null @@ -1,35 +0,0 @@ -// +build !windows - -package sockets - -import ( - "fmt" - "net" - "net/http" - "syscall" - "time" -) - -const maxUnixSocketPathSize = len(syscall.RawSockaddrUnix{}.Path) - -func configureUnixTransport(tr *http.Transport, proto, addr string) error { - if len(addr) > maxUnixSocketPathSize { - return fmt.Errorf("Unix socket path %q is too long", addr) - } - // No need for compression in local communications. - tr.DisableCompression = true - tr.Dial = func(_, _ string) (net.Conn, error) { - return net.DialTimeout(proto, addr, defaultTimeout) - } - return nil -} - -func configureNpipeTransport(tr *http.Transport, proto, addr string) error { - return ErrProtocolNotAvailable -} - -// DialPipe connects to a Windows named pipe. -// This is not supported on other OSes. -func DialPipe(_ string, _ time.Duration) (net.Conn, error) { - return nil, syscall.EAFNOSUPPORT -} diff --git a/vendor/github.com/docker/go-connections/sockets/sockets_windows.go b/vendor/github.com/docker/go-connections/sockets/sockets_windows.go deleted file mode 100644 index 5c21644e1fe7..000000000000 --- a/vendor/github.com/docker/go-connections/sockets/sockets_windows.go +++ /dev/null @@ -1,27 +0,0 @@ -package sockets - -import ( - "net" - "net/http" - "time" - - "github.com/Microsoft/go-winio" -) - -func configureUnixTransport(tr *http.Transport, proto, addr string) error { - return ErrProtocolNotAvailable -} - -func configureNpipeTransport(tr *http.Transport, proto, addr string) error { - // No need for compression in local communications. - tr.DisableCompression = true - tr.Dial = func(_, _ string) (net.Conn, error) { - return DialPipe(addr, defaultTimeout) - } - return nil -} - -// DialPipe connects to a Windows named pipe. -func DialPipe(addr string, timeout time.Duration) (net.Conn, error) { - return winio.DialPipe(addr, &timeout) -} diff --git a/vendor/github.com/docker/go-connections/sockets/tcp_socket.go b/vendor/github.com/docker/go-connections/sockets/tcp_socket.go deleted file mode 100644 index 53cbb6c79e47..000000000000 --- a/vendor/github.com/docker/go-connections/sockets/tcp_socket.go +++ /dev/null @@ -1,22 +0,0 @@ -// Package sockets provides helper functions to create and configure Unix or TCP sockets. -package sockets - -import ( - "crypto/tls" - "net" -) - -// NewTCPSocket creates a TCP socket listener with the specified address and -// the specified tls configuration. If TLSConfig is set, will encapsulate the -// TCP listener inside a TLS one. -func NewTCPSocket(addr string, tlsConfig *tls.Config) (net.Listener, error) { - l, err := net.Listen("tcp", addr) - if err != nil { - return nil, err - } - if tlsConfig != nil { - tlsConfig.NextProtos = []string{"http/1.1"} - l = tls.NewListener(l, tlsConfig) - } - return l, nil -} diff --git a/vendor/github.com/docker/go-connections/sockets/unix_socket.go b/vendor/github.com/docker/go-connections/sockets/unix_socket.go deleted file mode 100644 index a8b5dbb6fdc0..000000000000 --- a/vendor/github.com/docker/go-connections/sockets/unix_socket.go +++ /dev/null @@ -1,32 +0,0 @@ -// +build !windows - -package sockets - -import ( - "net" - "os" - "syscall" -) - -// NewUnixSocket creates a unix socket with the specified path and group. -func NewUnixSocket(path string, gid int) (net.Listener, error) { - if err := syscall.Unlink(path); err != nil && !os.IsNotExist(err) { - return nil, err - } - mask := syscall.Umask(0777) - defer syscall.Umask(mask) - - l, err := net.Listen("unix", path) - if err != nil { - return nil, err - } - if err := os.Chown(path, 0, gid); err != nil { - l.Close() - return nil, err - } - if err := os.Chmod(path, 0660); err != nil { - l.Close() - return nil, err - } - return l, nil -} diff --git a/vendor/github.com/docker/go-units/LICENSE.code b/vendor/github.com/docker/go-units/LICENSE similarity index 100% rename from vendor/github.com/docker/go-units/LICENSE.code rename to vendor/github.com/docker/go-units/LICENSE diff --git a/vendor/github.com/docker/go-units/LICENSE.docs b/vendor/github.com/docker/go-units/LICENSE.docs deleted file mode 100644 index e26cd4fc8ed9..000000000000 --- a/vendor/github.com/docker/go-units/LICENSE.docs +++ /dev/null @@ -1,425 +0,0 @@ -Attribution-ShareAlike 4.0 International - -======================================================================= - -Creative Commons Corporation ("Creative Commons") is not a law firm and -does not provide legal services or legal advice. Distribution of -Creative Commons public licenses does not create a lawyer-client or -other relationship. Creative Commons makes its licenses and related -information available on an "as-is" basis. Creative Commons gives no -warranties regarding its licenses, any material licensed under their -terms and conditions, or any related information. Creative Commons -disclaims all liability for damages resulting from their use to the -fullest extent possible. - -Using Creative Commons Public Licenses - -Creative Commons public licenses provide a standard set of terms and -conditions that creators and other rights holders may use to share -original works of authorship and other material subject to copyright -and certain other rights specified in the public license below. The -following considerations are for informational purposes only, are not -exhaustive, and do not form part of our licenses. - - Considerations for licensors: Our public licenses are - intended for use by those authorized to give the public - permission to use material in ways otherwise restricted by - copyright and certain other rights. Our licenses are - irrevocable. Licensors should read and understand the terms - and conditions of the license they choose before applying it. - Licensors should also secure all rights necessary before - applying our licenses so that the public can reuse the - material as expected. Licensors should clearly mark any - material not subject to the license. This includes other CC- - licensed material, or material used under an exception or - limitation to copyright. More considerations for licensors: - wiki.creativecommons.org/Considerations_for_licensors - - Considerations for the public: By using one of our public - licenses, a licensor grants the public permission to use the - licensed material under specified terms and conditions. If - the licensor's permission is not necessary for any reason--for - example, because of any applicable exception or limitation to - copyright--then that use is not regulated by the license. Our - licenses grant only permissions under copyright and certain - other rights that a licensor has authority to grant. Use of - the licensed material may still be restricted for other - reasons, including because others have copyright or other - rights in the material. A licensor may make special requests, - such as asking that all changes be marked or described. - Although not required by our licenses, you are encouraged to - respect those requests where reasonable. More_considerations - for the public: - wiki.creativecommons.org/Considerations_for_licensees - -======================================================================= - -Creative Commons Attribution-ShareAlike 4.0 International Public -License - -By exercising the Licensed Rights (defined below), You accept and agree -to be bound by the terms and conditions of this Creative Commons -Attribution-ShareAlike 4.0 International Public License ("Public -License"). To the extent this Public License may be interpreted as a -contract, You are granted the Licensed Rights in consideration of Your -acceptance of these terms and conditions, and the Licensor grants You -such rights in consideration of benefits the Licensor receives from -making the Licensed Material available under these terms and -conditions. - - -Section 1 -- Definitions. - - a. Adapted Material means material subject to Copyright and Similar - Rights that is derived from or based upon the Licensed Material - and in which the Licensed Material is translated, altered, - arranged, transformed, or otherwise modified in a manner requiring - permission under the Copyright and Similar Rights held by the - Licensor. For purposes of this Public License, where the Licensed - Material is a musical work, performance, or sound recording, - Adapted Material is always produced where the Licensed Material is - synched in timed relation with a moving image. - - b. Adapter's License means the license You apply to Your Copyright - and Similar Rights in Your contributions to Adapted Material in - accordance with the terms and conditions of this Public License. - - c. BY-SA Compatible License means a license listed at - creativecommons.org/compatiblelicenses, approved by Creative - Commons as essentially the equivalent of this Public License. - - d. Copyright and Similar Rights means copyright and/or similar rights - closely related to copyright including, without limitation, - performance, broadcast, sound recording, and Sui Generis Database - Rights, without regard to how the rights are labeled or - categorized. For purposes of this Public License, the rights - specified in Section 2(b)(1)-(2) are not Copyright and Similar - Rights. - - e. Effective Technological Measures means those measures that, in the - absence of proper authority, may not be circumvented under laws - fulfilling obligations under Article 11 of the WIPO Copyright - Treaty adopted on December 20, 1996, and/or similar international - agreements. - - f. Exceptions and Limitations means fair use, fair dealing, and/or - any other exception or limitation to Copyright and Similar Rights - that applies to Your use of the Licensed Material. - - g. License Elements means the license attributes listed in the name - of a Creative Commons Public License. The License Elements of this - Public License are Attribution and ShareAlike. - - h. Licensed Material means the artistic or literary work, database, - or other material to which the Licensor applied this Public - License. - - i. Licensed Rights means the rights granted to You subject to the - terms and conditions of this Public License, which are limited to - all Copyright and Similar Rights that apply to Your use of the - Licensed Material and that the Licensor has authority to license. - - j. Licensor means the individual(s) or entity(ies) granting rights - under this Public License. - - k. Share means to provide material to the public by any means or - process that requires permission under the Licensed Rights, such - as reproduction, public display, public performance, distribution, - dissemination, communication, or importation, and to make material - available to the public including in ways that members of the - public may access the material from a place and at a time - individually chosen by them. - - l. Sui Generis Database Rights means rights other than copyright - resulting from Directive 96/9/EC of the European Parliament and of - the Council of 11 March 1996 on the legal protection of databases, - as amended and/or succeeded, as well as other essentially - equivalent rights anywhere in the world. - - m. You means the individual or entity exercising the Licensed Rights - under this Public License. Your has a corresponding meaning. - - -Section 2 -- Scope. - - a. License grant. - - 1. Subject to the terms and conditions of this Public License, - the Licensor hereby grants You a worldwide, royalty-free, - non-sublicensable, non-exclusive, irrevocable license to - exercise the Licensed Rights in the Licensed Material to: - - a. reproduce and Share the Licensed Material, in whole or - in part; and - - b. produce, reproduce, and Share Adapted Material. - - 2. Exceptions and Limitations. For the avoidance of doubt, where - Exceptions and Limitations apply to Your use, this Public - License does not apply, and You do not need to comply with - its terms and conditions. - - 3. Term. The term of this Public License is specified in Section - 6(a). - - 4. Media and formats; technical modifications allowed. The - Licensor authorizes You to exercise the Licensed Rights in - all media and formats whether now known or hereafter created, - and to make technical modifications necessary to do so. The - Licensor waives and/or agrees not to assert any right or - authority to forbid You from making technical modifications - necessary to exercise the Licensed Rights, including - technical modifications necessary to circumvent Effective - Technological Measures. For purposes of this Public License, - simply making modifications authorized by this Section 2(a) - (4) never produces Adapted Material. - - 5. Downstream recipients. - - a. Offer from the Licensor -- Licensed Material. Every - recipient of the Licensed Material automatically - receives an offer from the Licensor to exercise the - Licensed Rights under the terms and conditions of this - Public License. - - b. Additional offer from the Licensor -- Adapted Material. - Every recipient of Adapted Material from You - automatically receives an offer from the Licensor to - exercise the Licensed Rights in the Adapted Material - under the conditions of the Adapter's License You apply. - - c. No downstream restrictions. You may not offer or impose - any additional or different terms or conditions on, or - apply any Effective Technological Measures to, the - Licensed Material if doing so restricts exercise of the - Licensed Rights by any recipient of the Licensed - Material. - - 6. No endorsement. Nothing in this Public License constitutes or - may be construed as permission to assert or imply that You - are, or that Your use of the Licensed Material is, connected - with, or sponsored, endorsed, or granted official status by, - the Licensor or others designated to receive attribution as - provided in Section 3(a)(1)(A)(i). - - b. Other rights. - - 1. Moral rights, such as the right of integrity, are not - licensed under this Public License, nor are publicity, - privacy, and/or other similar personality rights; however, to - the extent possible, the Licensor waives and/or agrees not to - assert any such rights held by the Licensor to the limited - extent necessary to allow You to exercise the Licensed - Rights, but not otherwise. - - 2. Patent and trademark rights are not licensed under this - Public License. - - 3. To the extent possible, the Licensor waives any right to - collect royalties from You for the exercise of the Licensed - Rights, whether directly or through a collecting society - under any voluntary or waivable statutory or compulsory - licensing scheme. In all other cases the Licensor expressly - reserves any right to collect such royalties. - - -Section 3 -- License Conditions. - -Your exercise of the Licensed Rights is expressly made subject to the -following conditions. - - a. Attribution. - - 1. If You Share the Licensed Material (including in modified - form), You must: - - a. retain the following if it is supplied by the Licensor - with the Licensed Material: - - i. identification of the creator(s) of the Licensed - Material and any others designated to receive - attribution, in any reasonable manner requested by - the Licensor (including by pseudonym if - designated); - - ii. a copyright notice; - - iii. a notice that refers to this Public License; - - iv. a notice that refers to the disclaimer of - warranties; - - v. a URI or hyperlink to the Licensed Material to the - extent reasonably practicable; - - b. indicate if You modified the Licensed Material and - retain an indication of any previous modifications; and - - c. indicate the Licensed Material is licensed under this - Public License, and include the text of, or the URI or - hyperlink to, this Public License. - - 2. You may satisfy the conditions in Section 3(a)(1) in any - reasonable manner based on the medium, means, and context in - which You Share the Licensed Material. For example, it may be - reasonable to satisfy the conditions by providing a URI or - hyperlink to a resource that includes the required - information. - - 3. If requested by the Licensor, You must remove any of the - information required by Section 3(a)(1)(A) to the extent - reasonably practicable. - - b. ShareAlike. - - In addition to the conditions in Section 3(a), if You Share - Adapted Material You produce, the following conditions also apply. - - 1. The Adapter's License You apply must be a Creative Commons - license with the same License Elements, this version or - later, or a BY-SA Compatible License. - - 2. You must include the text of, or the URI or hyperlink to, the - Adapter's License You apply. You may satisfy this condition - in any reasonable manner based on the medium, means, and - context in which You Share Adapted Material. - - 3. You may not offer or impose any additional or different terms - or conditions on, or apply any Effective Technological - Measures to, Adapted Material that restrict exercise of the - rights granted under the Adapter's License You apply. - - -Section 4 -- Sui Generis Database Rights. - -Where the Licensed Rights include Sui Generis Database Rights that -apply to Your use of the Licensed Material: - - a. for the avoidance of doubt, Section 2(a)(1) grants You the right - to extract, reuse, reproduce, and Share all or a substantial - portion of the contents of the database; - - b. if You include all or a substantial portion of the database - contents in a database in which You have Sui Generis Database - Rights, then the database in which You have Sui Generis Database - Rights (but not its individual contents) is Adapted Material, - - including for purposes of Section 3(b); and - c. You must comply with the conditions in Section 3(a) if You Share - all or a substantial portion of the contents of the database. - -For the avoidance of doubt, this Section 4 supplements and does not -replace Your obligations under this Public License where the Licensed -Rights include other Copyright and Similar Rights. - - -Section 5 -- Disclaimer of Warranties and Limitation of Liability. - - a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE - EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS - AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF - ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, - IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, - WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, - ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT - KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT - ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. - - b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE - TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, - NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, - INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, - COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR - USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN - ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR - DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR - IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. - - c. The disclaimer of warranties and limitation of liability provided - above shall be interpreted in a manner that, to the extent - possible, most closely approximates an absolute disclaimer and - waiver of all liability. - - -Section 6 -- Term and Termination. - - a. This Public License applies for the term of the Copyright and - Similar Rights licensed here. However, if You fail to comply with - this Public License, then Your rights under this Public License - terminate automatically. - - b. Where Your right to use the Licensed Material has terminated under - Section 6(a), it reinstates: - - 1. automatically as of the date the violation is cured, provided - it is cured within 30 days of Your discovery of the - violation; or - - 2. upon express reinstatement by the Licensor. - - For the avoidance of doubt, this Section 6(b) does not affect any - right the Licensor may have to seek remedies for Your violations - of this Public License. - - c. For the avoidance of doubt, the Licensor may also offer the - Licensed Material under separate terms or conditions or stop - distributing the Licensed Material at any time; however, doing so - will not terminate this Public License. - - d. Sections 1, 5, 6, 7, and 8 survive termination of this Public - License. - - -Section 7 -- Other Terms and Conditions. - - a. The Licensor shall not be bound by any additional or different - terms or conditions communicated by You unless expressly agreed. - - b. Any arrangements, understandings, or agreements regarding the - Licensed Material not stated herein are separate from and - independent of the terms and conditions of this Public License. - - -Section 8 -- Interpretation. - - a. For the avoidance of doubt, this Public License does not, and - shall not be interpreted to, reduce, limit, restrict, or impose - conditions on any use of the Licensed Material that could lawfully - be made without permission under this Public License. - - b. To the extent possible, if any provision of this Public License is - deemed unenforceable, it shall be automatically reformed to the - minimum extent necessary to make it enforceable. If the provision - cannot be reformed, it shall be severed from this Public License - without affecting the enforceability of the remaining terms and - conditions. - - c. No term or condition of this Public License will be waived and no - failure to comply consented to unless expressly agreed to by the - Licensor. - - d. Nothing in this Public License constitutes or may be interpreted - as a limitation upon, or waiver of, any privileges and immunities - that apply to the Licensor or You, including from the legal - processes of any jurisdiction or authority. - - -======================================================================= - -Creative Commons is not a party to its public licenses. -Notwithstanding, Creative Commons may elect to apply one of its public -licenses to material it publishes and in those instances will be -considered the "Licensor." Except for the limited purpose of indicating -that material is shared under a Creative Commons public license or as -otherwise permitted by the Creative Commons policies published at -creativecommons.org/policies, Creative Commons does not authorize the -use of the trademark "Creative Commons" or any other trademark or logo -of Creative Commons without its prior written consent including, -without limitation, in connection with any unauthorized modifications -to any of its public licenses or any other arrangements, -understandings, or agreements concerning use of licensed material. For -the avoidance of doubt, this paragraph does not form part of the public -licenses. - -Creative Commons may be contacted at creativecommons.org. diff --git a/vendor/github.com/docker/go-units/MAINTAINERS b/vendor/github.com/docker/go-units/MAINTAINERS index 477be8b214bf..4aac7c741107 100644 --- a/vendor/github.com/docker/go-units/MAINTAINERS +++ b/vendor/github.com/docker/go-units/MAINTAINERS @@ -1,6 +1,6 @@ -# go-connections maintainers file +# go-units maintainers file # -# This file describes who runs the docker/go-connections project and how. +# This file describes who runs the docker/go-units project and how. # This is a living document - if you see something out of date or missing, speak up! # # It is structured to be consumable by both humans and programs. @@ -11,7 +11,10 @@ [Org] [Org."Core maintainers"] people = [ - "calavera", + "akihirosuda", + "dnephin", + "thajeztah", + "vdemeester", ] [people] @@ -21,7 +24,23 @@ # in the people section. # ADD YOURSELF HERE IN ALPHABETICAL ORDER - [people.calavera] - Name = "David Calavera" - Email = "david.calavera@gmail.com" - GitHub = "calavera" + + [people.akihirosuda] + Name = "Akihiro Suda" + Email = "akihiro.suda.cz@hco.ntt.co.jp" + GitHub = "AkihiroSuda" + + [people.dnephin] + Name = "Daniel Nephin" + Email = "dnephin@gmail.com" + GitHub = "dnephin" + + [people.thajeztah] + Name = "Sebastiaan van Stijn" + Email = "github@gone.nl" + GitHub = "thaJeztah" + + [people.vdemeester] + Name = "Vincent Demeester" + Email = "vincent@sbr.pm" + GitHub = "vdemeester" \ No newline at end of file diff --git a/vendor/github.com/docker/go-units/README.md b/vendor/github.com/docker/go-units/README.md index 3ce4d79daca6..4f70a4e1345f 100644 --- a/vendor/github.com/docker/go-units/README.md +++ b/vendor/github.com/docker/go-units/README.md @@ -10,9 +10,7 @@ See the [docs in godoc](https://godoc.org/github.com/docker/go-units) for exampl ## Copyright and license -Copyright © 2015 Docker, Inc. All rights reserved, except as follows. Code -is released under the Apache 2.0 license. The README.md file, and files in the -"docs" folder are licensed under the Creative Commons Attribution 4.0 -International License under the terms and conditions set forth in the file -"LICENSE.docs". You may obtain a duplicate copy of the same license, titled -CC-BY-SA-4.0, at http://creativecommons.org/licenses/by/4.0/. +Copyright © 2015 Docker, Inc. + +go-units is licensed under the Apache License, Version 2.0. +See [LICENSE](LICENSE) for the full text of the license. diff --git a/vendor/github.com/docker/go-units/circle.yml b/vendor/github.com/docker/go-units/circle.yml index 9043b35478c9..af9d6055293d 100644 --- a/vendor/github.com/docker/go-units/circle.yml +++ b/vendor/github.com/docker/go-units/circle.yml @@ -1,7 +1,7 @@ dependencies: post: # install golint - - go get github.com/golang/lint/golint + - go get golang.org/x/lint/golint test: pre: diff --git a/vendor/github.com/docker/go-units/duration.go b/vendor/github.com/docker/go-units/duration.go index c219a8a968c4..48dd8744d433 100644 --- a/vendor/github.com/docker/go-units/duration.go +++ b/vendor/github.com/docker/go-units/duration.go @@ -12,19 +12,21 @@ import ( func HumanDuration(d time.Duration) string { if seconds := int(d.Seconds()); seconds < 1 { return "Less than a second" + } else if seconds == 1 { + return "1 second" } else if seconds < 60 { return fmt.Sprintf("%d seconds", seconds) } else if minutes := int(d.Minutes()); minutes == 1 { return "About a minute" } else if minutes < 60 { return fmt.Sprintf("%d minutes", minutes) - } else if hours := int(d.Hours()); hours == 1 { + } else if hours := int(d.Hours() + 0.5); hours == 1 { return "About an hour" } else if hours < 48 { return fmt.Sprintf("%d hours", hours) } else if hours < 24*7*2 { return fmt.Sprintf("%d days", hours/24) - } else if hours < 24*30*3 { + } else if hours < 24*30*2 { return fmt.Sprintf("%d weeks", hours/24/7) } else if hours < 24*365*2 { return fmt.Sprintf("%d months", hours/24/30) diff --git a/vendor/github.com/docker/go-units/size.go b/vendor/github.com/docker/go-units/size.go index 989edd29bbc4..85f6ab07155b 100644 --- a/vendor/github.com/docker/go-units/size.go +++ b/vendor/github.com/docker/go-units/size.go @@ -31,33 +31,46 @@ type unitMap map[string]int64 var ( decimalMap = unitMap{"k": KB, "m": MB, "g": GB, "t": TB, "p": PB} binaryMap = unitMap{"k": KiB, "m": MiB, "g": GiB, "t": TiB, "p": PiB} - sizeRegex = regexp.MustCompile(`^(\d+(\.\d+)*) ?([kKmMgGtTpP])?[bB]?$`) + sizeRegex = regexp.MustCompile(`^(\d+(\.\d+)*) ?([kKmMgGtTpP])?[iI]?[bB]?$`) ) var decimapAbbrs = []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"} var binaryAbbrs = []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"} -// CustomSize returns a human-readable approximation of a size -// using custom format. -func CustomSize(format string, size float64, base float64, _map []string) string { +func getSizeAndUnit(size float64, base float64, _map []string) (float64, string) { i := 0 - for size >= base { + unitsLimit := len(_map) - 1 + for size >= base && i < unitsLimit { size = size / base i++ } - return fmt.Sprintf(format, size, _map[i]) + return size, _map[i] +} + +// CustomSize returns a human-readable approximation of a size +// using custom format. +func CustomSize(format string, size float64, base float64, _map []string) string { + size, unit := getSizeAndUnit(size, base, _map) + return fmt.Sprintf(format, size, unit) +} + +// HumanSizeWithPrecision allows the size to be in any precision, +// instead of 4 digit precision used in units.HumanSize. +func HumanSizeWithPrecision(size float64, precision int) string { + size, unit := getSizeAndUnit(size, 1000.0, decimapAbbrs) + return fmt.Sprintf("%.*g%s", precision, size, unit) } // HumanSize returns a human-readable approximation of a size // capped at 4 valid numbers (eg. "2.746 MB", "796 KB"). func HumanSize(size float64) string { - return CustomSize("%.4g %s", size, 1000.0, decimapAbbrs) + return HumanSizeWithPrecision(size, 4) } // BytesSize returns a human-readable size in bytes, kibibytes, // mebibytes, gibibytes, or tebibytes (eg. "44kiB", "17MiB"). func BytesSize(size float64) string { - return CustomSize("%.4g %s", size, 1024.0, binaryAbbrs) + return CustomSize("%.4g%s", size, 1024.0, binaryAbbrs) } // FromHumanSize returns an integer from a human-readable specification of a diff --git a/vendor/github.com/docker/go-units/ulimit.go b/vendor/github.com/docker/go-units/ulimit.go index 5ac7fd825fce..fca0400cc82b 100644 --- a/vendor/github.com/docker/go-units/ulimit.go +++ b/vendor/github.com/docker/go-units/ulimit.go @@ -96,8 +96,13 @@ func ParseUlimit(val string) (*Ulimit, error) { return nil, fmt.Errorf("too many limit value arguments - %s, can only have up to two, `soft[:hard]`", parts[1]) } - if soft > *hard { - return nil, fmt.Errorf("ulimit soft limit must be less than or equal to hard limit: %d > %d", soft, *hard) + if *hard != -1 { + if soft == -1 { + return nil, fmt.Errorf("ulimit soft limit must be less than or equal to hard limit: soft: -1 (unlimited), hard: %d", *hard) + } + if soft > *hard { + return nil, fmt.Errorf("ulimit soft limit must be less than or equal to hard limit: %d > %d", soft, *hard) + } } return &Ulimit{Name: parts[0], Soft: soft, Hard: *hard}, nil diff --git a/vendor/github.com/docker/libnetwork/LICENSE b/vendor/github.com/docker/libnetwork/LICENSE deleted file mode 100644 index e06d2081865a..000000000000 --- a/vendor/github.com/docker/libnetwork/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/vendor/github.com/docker/libnetwork/ipamutils/utils.go b/vendor/github.com/docker/libnetwork/ipamutils/utils.go deleted file mode 100644 index 3fd37cd88403..000000000000 --- a/vendor/github.com/docker/libnetwork/ipamutils/utils.go +++ /dev/null @@ -1,135 +0,0 @@ -// Package ipamutils provides utility functions for ipam management -package ipamutils - -import ( - "fmt" - "net" - "sync" -) - -var ( - // PredefinedLocalScopeDefaultNetworks contains a list of 31 IPv4 private networks with host size 16 and 12 - // (172.17-31.x.x/16, 192.168.x.x/20) which do not overlap with the networks in `PredefinedGlobalScopeDefaultNetworks` - PredefinedLocalScopeDefaultNetworks []*net.IPNet - // PredefinedGlobalScopeDefaultNetworks contains a list of 64K IPv4 private networks with host size 8 - // (10.x.x.x/24) which do not overlap with the networks in `PredefinedLocalScopeDefaultNetworks` - PredefinedGlobalScopeDefaultNetworks []*net.IPNet - mutex sync.Mutex - localScopeDefaultNetworks = []*NetworkToSplit{{"172.17.0.0/16", 16}, {"172.18.0.0/16", 16}, {"172.19.0.0/16", 16}, - {"172.20.0.0/14", 16}, {"172.24.0.0/14", 16}, {"172.28.0.0/14", 16}, - {"192.168.0.0/16", 20}} - globalScopeDefaultNetworks = []*NetworkToSplit{{"10.0.0.0/8", 24}} -) - -// NetworkToSplit represent a network that has to be split in chunks with mask length Size. -// Each subnet in the set is derived from the Base pool. Base is to be passed -// in CIDR format. -// Example: a Base "10.10.0.0/16 with Size 24 will define the set of 256 -// 10.10.[0-255].0/24 address pools -type NetworkToSplit struct { - Base string `json:"base"` - Size int `json:"size"` -} - -func init() { - var err error - if PredefinedGlobalScopeDefaultNetworks, err = splitNetworks(globalScopeDefaultNetworks); err != nil { - //we are going to panic in case of error as we should never get into this state - panic("InitAddressPools failed to initialize the global scope default address pool") - } - - if PredefinedLocalScopeDefaultNetworks, err = splitNetworks(localScopeDefaultNetworks); err != nil { - //we are going to panic in case of error as we should never get into this state - panic("InitAddressPools failed to initialize the local scope default address pool") - } -} - -// configDefaultNetworks configures local as well global default pool based on input -func configDefaultNetworks(defaultAddressPool []*NetworkToSplit, result *[]*net.IPNet) error { - mutex.Lock() - defer mutex.Unlock() - defaultNetworks, err := splitNetworks(defaultAddressPool) - if err != nil { - return err - } - *result = defaultNetworks - return nil -} - -// GetGlobalScopeDefaultNetworks returns PredefinedGlobalScopeDefaultNetworks -func GetGlobalScopeDefaultNetworks() []*net.IPNet { - mutex.Lock() - defer mutex.Unlock() - return PredefinedGlobalScopeDefaultNetworks -} - -// GetLocalScopeDefaultNetworks returns PredefinedLocalScopeDefaultNetworks -func GetLocalScopeDefaultNetworks() []*net.IPNet { - mutex.Lock() - defer mutex.Unlock() - return PredefinedLocalScopeDefaultNetworks -} - -// ConfigGlobalScopeDefaultNetworks configures global default pool. -// Ideally this will be called from SwarmKit as part of swarm init -func ConfigGlobalScopeDefaultNetworks(defaultAddressPool []*NetworkToSplit) error { - if defaultAddressPool == nil { - defaultAddressPool = globalScopeDefaultNetworks - } - return configDefaultNetworks(defaultAddressPool, &PredefinedGlobalScopeDefaultNetworks) -} - -// ConfigLocalScopeDefaultNetworks configures local default pool. -// Ideally this will be called during libnetwork init -func ConfigLocalScopeDefaultNetworks(defaultAddressPool []*NetworkToSplit) error { - if defaultAddressPool == nil { - return nil - } - return configDefaultNetworks(defaultAddressPool, &PredefinedLocalScopeDefaultNetworks) -} - -// splitNetworks takes a slice of networks, split them accordingly and returns them -func splitNetworks(list []*NetworkToSplit) ([]*net.IPNet, error) { - localPools := make([]*net.IPNet, 0, len(list)) - - for _, p := range list { - _, b, err := net.ParseCIDR(p.Base) - if err != nil { - return nil, fmt.Errorf("invalid base pool %q: %v", p.Base, err) - } - ones, _ := b.Mask.Size() - if p.Size <= 0 || p.Size < ones { - return nil, fmt.Errorf("invalid pools size: %d", p.Size) - } - localPools = append(localPools, splitNetwork(p.Size, b)...) - } - return localPools, nil -} - -func splitNetwork(size int, base *net.IPNet) []*net.IPNet { - one, bits := base.Mask.Size() - mask := net.CIDRMask(size, bits) - n := 1 << uint(size-one) - s := uint(bits - size) - list := make([]*net.IPNet, 0, n) - - for i := 0; i < n; i++ { - ip := copyIP(base.IP) - addIntToIP(ip, uint(i<= 0; i-- { - array[i] |= (byte)(ordinal & 0xff) - ordinal >>= 8 - } -} diff --git a/vendor/github.com/dustin/go-humanize/.travis.yml b/vendor/github.com/dustin/go-humanize/.travis.yml new file mode 100644 index 000000000000..ba95cdd15c31 --- /dev/null +++ b/vendor/github.com/dustin/go-humanize/.travis.yml @@ -0,0 +1,21 @@ +sudo: false +language: go +go: + - 1.3.x + - 1.5.x + - 1.6.x + - 1.7.x + - 1.8.x + - 1.9.x + - master +matrix: + allow_failures: + - go: master + fast_finish: true +install: + - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step). +script: + - go get -t -v ./... + - diff -u <(echo -n) <(gofmt -d -s .) + - go tool vet . + - go test -v -race ./... diff --git a/vendor/github.com/dustin/go-humanize/README.markdown b/vendor/github.com/dustin/go-humanize/README.markdown index 5fcdfa419dc7..91b4ae56464b 100644 --- a/vendor/github.com/dustin/go-humanize/README.markdown +++ b/vendor/github.com/dustin/go-humanize/README.markdown @@ -1,9 +1,9 @@ -# Humane Units +# Humane Units [![Build Status](https://travis-ci.org/dustin/go-humanize.svg?branch=master)](https://travis-ci.org/dustin/go-humanize) [![GoDoc](https://godoc.org/github.com/dustin/go-humanize?status.svg)](https://godoc.org/github.com/dustin/go-humanize) Just a few functions for helping humanize times and sizes. `go get` it as `github.com/dustin/go-humanize`, import it as -`"github.com/dustin/go-humanize"`, use it as `humanize` +`"github.com/dustin/go-humanize"`, use it as `humanize`. See [godoc](https://godoc.org/github.com/dustin/go-humanize) for complete documentation. @@ -11,12 +11,12 @@ complete documentation. ## Sizes This lets you take numbers like `82854982` and convert them to useful -strings like, `83MB` or `79MiB` (whichever you prefer). +strings like, `83 MB` or `79 MiB` (whichever you prefer). Example: ```go -fmt.Printf("That file is %s.", humanize.Bytes(82854982)) +fmt.Printf("That file is %s.", humanize.Bytes(82854982)) // That file is 83 MB. ``` ## Times @@ -27,11 +27,11 @@ For example, `12 seconds ago` or `3 days from now`. Example: ```go -fmt.Printf("This was touched %s", humanize.Time(someTimeInstance)) +fmt.Printf("This was touched %s.", humanize.Time(someTimeInstance)) // This was touched 7 hours ago. ``` Thanks to Kyle Lemons for the time implementation from an IRC -conversation one day. It's pretty neat. +conversation one day. It's pretty neat. ## Ordinals @@ -48,12 +48,12 @@ to label ordinals. Example: ```go -fmt.Printf("You're my %s best friend.", humanize.Ordinal(193)) +fmt.Printf("You're my %s best friend.", humanize.Ordinal(193)) // You are my 193rd best friend. ``` ## Commas -Want to shove commas into numbers? Be my guest. +Want to shove commas into numbers? Be my guest. 0 -> 0 100 -> 100 @@ -64,7 +64,7 @@ Want to shove commas into numbers? Be my guest. Example: ```go -fmt.Printf("You owe $%s.\n", humanize.Comma(6582491)) +fmt.Printf("You owe $%s.\n", humanize.Comma(6582491)) // You owe $6,582,491. ``` ## Ftoa @@ -72,10 +72,10 @@ fmt.Printf("You owe $%s.\n", humanize.Comma(6582491)) Nicer float64 formatter that removes trailing zeros. ```go -fmt.Printf("%f", 2.24) // 2.240000 -fmt.Printf("%s", humanize.Ftoa(2.24)) // 2.24 -fmt.Printf("%f", 2.0) // 2.000000 -fmt.Printf("%s", humanize.Ftoa(2.0)) // 2 +fmt.Printf("%f", 2.24) // 2.240000 +fmt.Printf("%s", humanize.Ftoa(2.24)) // 2.24 +fmt.Printf("%f", 2.0) // 2.000000 +fmt.Printf("%s", humanize.Ftoa(2.0)) // 2 ``` ## SI notation @@ -85,7 +85,39 @@ Format numbers with [SI notation][sinotation]. Example: ```go -humanize.SI(0.00000000223, "M") // 2.23nM +humanize.SI(0.00000000223, "M") // 2.23 nM +``` + +## English-specific functions + +The following functions are in the `humanize/english` subpackage. + +### Plurals + +Simple English pluralization + +```go +english.PluralWord(1, "object", "") // object +english.PluralWord(42, "object", "") // objects +english.PluralWord(2, "bus", "") // buses +english.PluralWord(99, "locus", "loci") // loci + +english.Plural(1, "object", "") // 1 object +english.Plural(42, "object", "") // 42 objects +english.Plural(2, "bus", "") // 2 buses +english.Plural(99, "locus", "loci") // 99 loci +``` + +### Word series + +Format comma-separated words lists with conjuctions: + +```go +english.WordSeries([]string{"foo"}, "and") // foo +english.WordSeries([]string{"foo", "bar"}, "and") // foo and bar +english.WordSeries([]string{"foo", "bar", "baz"}, "and") // foo, bar and baz + +english.OxfordWordSeries([]string{"foo", "bar", "baz"}, "and") // foo, bar, and baz ``` [odisc]: https://groups.google.com/d/topic/golang-nuts/l8NhI74jl-4/discussion diff --git a/vendor/github.com/dustin/go-humanize/bigbytes.go b/vendor/github.com/dustin/go-humanize/bigbytes.go index 67ea5c823da2..1a2bf6172392 100644 --- a/vendor/github.com/dustin/go-humanize/bigbytes.go +++ b/vendor/github.com/dustin/go-humanize/bigbytes.go @@ -113,7 +113,7 @@ func humanateBigBytes(s, base *big.Int, sizes []string) string { // // See also: ParseBigBytes. // -// BigBytes(82854982) -> 83MB +// BigBytes(82854982) -> 83 MB func BigBytes(s *big.Int) string { sizes := []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"} return humanateBigBytes(s, bigSIExp, sizes) @@ -123,7 +123,7 @@ func BigBytes(s *big.Int) string { // // See also: ParseBigBytes. // -// BigIBytes(82854982) -> 79MiB +// BigIBytes(82854982) -> 79 MiB func BigIBytes(s *big.Int) string { sizes := []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"} return humanateBigBytes(s, bigIECExp, sizes) @@ -134,19 +134,28 @@ func BigIBytes(s *big.Int) string { // // See also: BigBytes, BigIBytes. // -// ParseBigBytes("42MB") -> 42000000, nil -// ParseBigBytes("42mib") -> 44040192, nil +// ParseBigBytes("42 MB") -> 42000000, nil +// ParseBigBytes("42 mib") -> 44040192, nil func ParseBigBytes(s string) (*big.Int, error) { lastDigit := 0 + hasComma := false for _, r := range s { - if !(unicode.IsDigit(r) || r == '.') { + if !(unicode.IsDigit(r) || r == '.' || r == ',') { break } + if r == ',' { + hasComma = true + } lastDigit++ } + num := s[:lastDigit] + if hasComma { + num = strings.Replace(num, ",", "", -1) + } + val := &big.Rat{} - _, err := fmt.Sscanf(s[:lastDigit], "%f", val) + _, err := fmt.Sscanf(num, "%f", val) if err != nil { return nil, err } diff --git a/vendor/github.com/dustin/go-humanize/bytes.go b/vendor/github.com/dustin/go-humanize/bytes.go index dacbb9c1e4c9..0b498f4885c5 100644 --- a/vendor/github.com/dustin/go-humanize/bytes.go +++ b/vendor/github.com/dustin/go-humanize/bytes.go @@ -84,7 +84,7 @@ func humanateBytes(s uint64, base float64, sizes []string) string { // // See also: ParseBytes. // -// Bytes(82854982) -> 83MB +// Bytes(82854982) -> 83 MB func Bytes(s uint64) string { sizes := []string{"B", "kB", "MB", "GB", "TB", "PB", "EB"} return humanateBytes(s, 1000, sizes) @@ -94,7 +94,7 @@ func Bytes(s uint64) string { // // See also: ParseBytes. // -// IBytes(82854982) -> 79MiB +// IBytes(82854982) -> 79 MiB func IBytes(s uint64) string { sizes := []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"} return humanateBytes(s, 1024, sizes) @@ -105,18 +105,27 @@ func IBytes(s uint64) string { // // See Also: Bytes, IBytes. // -// ParseBytes("42MB") -> 42000000, nil -// ParseBytes("42mib") -> 44040192, nil +// ParseBytes("42 MB") -> 42000000, nil +// ParseBytes("42 mib") -> 44040192, nil func ParseBytes(s string) (uint64, error) { lastDigit := 0 + hasComma := false for _, r := range s { - if !(unicode.IsDigit(r) || r == '.') { + if !(unicode.IsDigit(r) || r == '.' || r == ',') { break } + if r == ',' { + hasComma = true + } lastDigit++ } - f, err := strconv.ParseFloat(s[:lastDigit], 64) + num := s[:lastDigit] + if hasComma { + num = strings.Replace(num, ",", "", -1) + } + + f, err := strconv.ParseFloat(num, 64) if err != nil { return 0, err } diff --git a/vendor/github.com/dustin/go-humanize/comma.go b/vendor/github.com/dustin/go-humanize/comma.go index b65ea6fa78c0..520ae3e57d92 100644 --- a/vendor/github.com/dustin/go-humanize/comma.go +++ b/vendor/github.com/dustin/go-humanize/comma.go @@ -2,6 +2,7 @@ package humanize import ( "bytes" + "math" "math/big" "strconv" "strings" @@ -13,6 +14,12 @@ import ( // e.g. Comma(834142) -> 834,142 func Comma(v int64) string { sign := "" + + // Min int64 can't be negated to a usable value, so it has to be special cased. + if v == math.MinInt64 { + return "-9,223,372,036,854,775,808" + } + if v < 0 { sign = "-" v = 0 - v @@ -39,7 +46,7 @@ func Comma(v int64) string { // Commaf produces a string form of the given number in base 10 with // commas after every three orders of magnitude. // -// e.g. Comma(834142.32) -> 834,142.32 +// e.g. Commaf(834142.32) -> 834,142.32 func Commaf(v float64) string { buf := &bytes.Buffer{} if v < 0 { @@ -69,6 +76,14 @@ func Commaf(v float64) string { return buf.String() } +// CommafWithDigits works like the Commaf but limits the resulting +// string to the given number of decimal places. +// +// e.g. CommafWithDigits(834142.32, 1) -> 834,142.3 +func CommafWithDigits(f float64, decimals int) string { + return stripTrailingDigits(Commaf(f), decimals) +} + // BigComma produces a string form of the given big.Int in base 10 // with commas after every three orders of magnitude. func BigComma(b *big.Int) string { diff --git a/vendor/github.com/dustin/go-humanize/commaf.go b/vendor/github.com/dustin/go-humanize/commaf.go new file mode 100644 index 000000000000..620690dec7dd --- /dev/null +++ b/vendor/github.com/dustin/go-humanize/commaf.go @@ -0,0 +1,40 @@ +// +build go1.6 + +package humanize + +import ( + "bytes" + "math/big" + "strings" +) + +// BigCommaf produces a string form of the given big.Float in base 10 +// with commas after every three orders of magnitude. +func BigCommaf(v *big.Float) string { + buf := &bytes.Buffer{} + if v.Sign() < 0 { + buf.Write([]byte{'-'}) + v.Abs(v) + } + + comma := []byte{','} + + parts := strings.Split(v.Text('f', -1), ".") + pos := 0 + if len(parts[0])%3 != 0 { + pos += len(parts[0]) % 3 + buf.WriteString(parts[0][:pos]) + buf.Write(comma) + } + for ; pos < len(parts[0]); pos += 3 { + buf.WriteString(parts[0][pos : pos+3]) + buf.Write(comma) + } + buf.Truncate(buf.Len() - 1) + + if len(parts) > 1 { + buf.Write([]byte{'.'}) + buf.WriteString(parts[1]) + } + return buf.String() +} diff --git a/vendor/github.com/dustin/go-humanize/ftoa.go b/vendor/github.com/dustin/go-humanize/ftoa.go index c76190b10671..1c62b640d47c 100644 --- a/vendor/github.com/dustin/go-humanize/ftoa.go +++ b/vendor/github.com/dustin/go-humanize/ftoa.go @@ -1,6 +1,9 @@ package humanize -import "strconv" +import ( + "strconv" + "strings" +) func stripTrailingZeros(s string) string { offset := len(s) - 1 @@ -17,7 +20,27 @@ func stripTrailingZeros(s string) string { return s[:offset+1] } +func stripTrailingDigits(s string, digits int) string { + if i := strings.Index(s, "."); i >= 0 { + if digits <= 0 { + return s[:i] + } + i++ + if i+digits >= len(s) { + return s + } + return s[:i+digits] + } + return s +} + // Ftoa converts a float to a string with no trailing zeros. func Ftoa(num float64) string { return stripTrailingZeros(strconv.FormatFloat(num, 'f', 6, 64)) } + +// FtoaWithDigits converts a float to a string but limits the resulting string +// to the given number of decimal places, and no trailing zeros. +func FtoaWithDigits(num float64, digits int) string { + return stripTrailingZeros(stripTrailingDigits(strconv.FormatFloat(num, 'f', 6, 64), digits)) +} diff --git a/vendor/github.com/dustin/go-humanize/humanize.go b/vendor/github.com/dustin/go-humanize/humanize.go index a69540a06b6b..a2c2da31ef1a 100644 --- a/vendor/github.com/dustin/go-humanize/humanize.go +++ b/vendor/github.com/dustin/go-humanize/humanize.go @@ -2,7 +2,7 @@ Package humanize converts boring ugly numbers to human-friendly strings and back. Durations can be turned into strings such as "3 days ago", numbers -representing sizes like 82854982 into useful strings like, "83MB" or -"79MiB" (whichever you prefer). +representing sizes like 82854982 into useful strings like, "83 MB" or +"79 MiB" (whichever you prefer). */ package humanize diff --git a/vendor/github.com/dustin/go-humanize/number.go b/vendor/github.com/dustin/go-humanize/number.go index 32141348c803..dec618659969 100644 --- a/vendor/github.com/dustin/go-humanize/number.go +++ b/vendor/github.com/dustin/go-humanize/number.go @@ -160,7 +160,7 @@ func FormatFloat(format string, n float64) string { intf, fracf := math.Modf(n + renderFloatPrecisionRounders[precision]) // generate integer part string - intStr := strconv.Itoa(int(intf)) + intStr := strconv.FormatInt(int64(intf), 10) // add thousand separator if required if len(thousandStr) > 0 { diff --git a/vendor/github.com/dustin/go-humanize/si.go b/vendor/github.com/dustin/go-humanize/si.go index fe86fe556cd4..ae659e0e4979 100644 --- a/vendor/github.com/dustin/go-humanize/si.go +++ b/vendor/github.com/dustin/go-humanize/si.go @@ -41,7 +41,7 @@ func revfmap(in map[float64]string) map[string]float64 { var riParseRegex *regexp.Regexp func init() { - ri := `^([0-9.]+)\s?([` + ri := `^([\-0-9.]+)\s?([` for _, v := range siPrefixTable { ri += v } @@ -61,18 +61,21 @@ func ComputeSI(input float64) (float64, string) { if input == 0 { return 0, "" } - exponent := math.Floor(logn(input, 10)) + mag := math.Abs(input) + exponent := math.Floor(logn(mag, 10)) exponent = math.Floor(exponent/3) * 3 - value := input / math.Pow(10, exponent) + value := mag / math.Pow(10, exponent) // Handle special case where value is exactly 1000.0 - // Should return 1M instead of 1000k + // Should return 1 M instead of 1000 k if value == 1000.0 { exponent += 3 - value = input / math.Pow(10, exponent) + value = mag / math.Pow(10, exponent) } + value = math.Copysign(value, input) + prefix := siPrefixTable[exponent] return value, prefix } @@ -83,20 +86,30 @@ func ComputeSI(input float64) (float64, string) { // // See also: ComputeSI, ParseSI. // -// e.g. SI(1000000, B) -> 1MB -// e.g. SI(2.2345e-12, "F") -> 2.2345pF +// e.g. SI(1000000, "B") -> 1 MB +// e.g. SI(2.2345e-12, "F") -> 2.2345 pF func SI(input float64, unit string) string { value, prefix := ComputeSI(input) return Ftoa(value) + " " + prefix + unit } +// SIWithDigits works like SI but limits the resulting string to the +// given number of decimal places. +// +// e.g. SIWithDigits(1000000, 0, "B") -> 1 MB +// e.g. SIWithDigits(2.2345e-12, 2, "F") -> 2.23 pF +func SIWithDigits(input float64, decimals int, unit string) string { + value, prefix := ComputeSI(input) + return FtoaWithDigits(value, decimals) + " " + prefix + unit +} + var errInvalid = errors.New("invalid input") // ParseSI parses an SI string back into the number and unit. // // See also: SI, ComputeSI. // -// e.g. ParseSI(2.2345pF) -> (2.2345e-12, "F", nil) +// e.g. ParseSI("2.2345 pF") -> (2.2345e-12, "F", nil) func ParseSI(input string) (float64, string, error) { found := riParseRegex.FindStringSubmatch(input) if len(found) != 4 { diff --git a/vendor/github.com/dustin/go-humanize/times.go b/vendor/github.com/dustin/go-humanize/times.go index 592ebe1d6250..dd3fbf5efc0c 100644 --- a/vendor/github.com/dustin/go-humanize/times.go +++ b/vendor/github.com/dustin/go-humanize/times.go @@ -9,9 +9,7 @@ import ( // Seconds-based time units const ( - Minute = 60 - Hour = 60 * Minute - Day = 24 * Hour + Day = 24 * time.Hour Week = 7 * Day Month = 30 * Day Year = 12 * Month @@ -25,18 +23,35 @@ func Time(then time.Time) string { return RelTime(then, time.Now(), "ago", "from now") } -var magnitudes = []struct { - d int64 - format string - divby int64 -}{ - {1, "now", 1}, - {2, "1 second %s", 1}, - {Minute, "%d seconds %s", 1}, - {2 * Minute, "1 minute %s", 1}, - {Hour, "%d minutes %s", Minute}, - {2 * Hour, "1 hour %s", 1}, - {Day, "%d hours %s", Hour}, +// A RelTimeMagnitude struct contains a relative time point at which +// the relative format of time will switch to a new format string. A +// slice of these in ascending order by their "D" field is passed to +// CustomRelTime to format durations. +// +// The Format field is a string that may contain a "%s" which will be +// replaced with the appropriate signed label (e.g. "ago" or "from +// now") and a "%d" that will be replaced by the quantity. +// +// The DivBy field is the amount of time the time difference must be +// divided by in order to display correctly. +// +// e.g. if D is 2*time.Minute and you want to display "%d minutes %s" +// DivBy should be time.Minute so whatever the duration is will be +// expressed in minutes. +type RelTimeMagnitude struct { + D time.Duration + Format string + DivBy time.Duration +} + +var defaultMagnitudes = []RelTimeMagnitude{ + {time.Second, "now", time.Second}, + {2 * time.Second, "1 second %s", 1}, + {time.Minute, "%d seconds %s", time.Second}, + {2 * time.Minute, "1 minute %s", 1}, + {time.Hour, "%d minutes %s", time.Minute}, + {2 * time.Hour, "1 hour %s", 1}, + {Day, "%d hours %s", time.Hour}, {2 * Day, "1 day %s", 1}, {Week, "%d days %s", Day}, {2 * Week, "1 week %s", 1}, @@ -57,35 +72,46 @@ var magnitudes = []struct { // // RelTime(timeInPast, timeInFuture, "earlier", "later") -> "3 weeks earlier" func RelTime(a, b time.Time, albl, blbl string) string { + return CustomRelTime(a, b, albl, blbl, defaultMagnitudes) +} + +// CustomRelTime formats a time into a relative string. +// +// It takes two times two labels and a table of relative time formats. +// In addition to the generic time delta string (e.g. 5 minutes), the +// labels are used applied so that the label corresponding to the +// smaller time is applied. +func CustomRelTime(a, b time.Time, albl, blbl string, magnitudes []RelTimeMagnitude) string { lbl := albl - diff := b.Unix() - a.Unix() + diff := b.Sub(a) - after := a.After(b) - if after { + if a.After(b) { lbl = blbl - diff = a.Unix() - b.Unix() + diff = a.Sub(b) } n := sort.Search(len(magnitudes), func(i int) bool { - return magnitudes[i].d > diff + return magnitudes[i].D > diff }) + if n >= len(magnitudes) { + n = len(magnitudes) - 1 + } mag := magnitudes[n] args := []interface{}{} escaped := false - for _, ch := range mag.format { + for _, ch := range mag.Format { if escaped { switch ch { - case '%': case 's': args = append(args, lbl) case 'd': - args = append(args, diff/mag.divby) + args = append(args, diff/mag.DivBy) } escaped = false } else { escaped = ch == '%' } } - return fmt.Sprintf(mag.format, args...) + return fmt.Sprintf(mag.Format, args...) } diff --git a/vendor/github.com/elazarl/go-bindata-assetfs/README.md b/vendor/github.com/elazarl/go-bindata-assetfs/README.md index 27ee48f09d9d..b326dca19617 100644 --- a/vendor/github.com/elazarl/go-bindata-assetfs/README.md +++ b/vendor/github.com/elazarl/go-bindata-assetfs/README.md @@ -1,6 +1,6 @@ # go-bindata-assetfs -Serve embedded files from [jteeuwen/go-bindata](https://github.com/jteeuwen/go-bindata) with `net/http`. +Serve embedded files from [go-bindata](https://github.com/go-bindata/go-bindata) with `net/http`. [GoDoc](http://godoc.org/github.com/elazarl/go-bindata-assetfs) @@ -8,12 +8,12 @@ Serve embedded files from [jteeuwen/go-bindata](https://github.com/jteeuwen/go-b Install with - $ go get github.com/jteeuwen/go-bindata/... + $ go get github.com/go-bindata/go-bindata/... $ go get github.com/elazarl/go-bindata-assetfs/... ### Creating embedded data -Usage is identical to [jteeuwen/go-bindata](https://github.com/jteeuwen/go-bindata) usage, +Usage is identical to [go-bindata](https://github.com/go-bindata/go-bindata) usage, instead of running `go-bindata` run `go-bindata-assetfs`. The tool will create a `bindata_assetfs.go` file, which contains the embedded data. @@ -37,10 +37,26 @@ You can always just run the `go-bindata` tool, and then use - import "github.com/elazarl/go-bindata-assetfs" - ... - http.Handle("/", - http.FileServer( - &assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo, Prefix: "data"})) +```go +import "github.com/elazarl/go-bindata-assetfs" +... +http.Handle("/", +http.FileServer( +&assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo, Prefix: "data"})) +``` to serve files embedded from the `data` directory. + +## SPA applications + +For single page applications you can use `Fallback: "index.html"` in AssetFS context, so if route doesn't match the pattern it will fallback to file specified. + +example + +```go +import "github.com/elazarl/go-bindata-assetfs" +... +http.Handle("/", +http.FileServer( +&assetfs.AssetFS{Asset: Asset, AssetDir: AssetDir, AssetInfo: AssetInfo, Prefix: "data", Fallback: "index.html"})) +``` diff --git a/vendor/github.com/elazarl/go-bindata-assetfs/assetfs.go b/vendor/github.com/elazarl/go-bindata-assetfs/assetfs.go index 04f6d7a39d9c..81874973d3a5 100644 --- a/vendor/github.com/elazarl/go-bindata-assetfs/assetfs.go +++ b/vendor/github.com/elazarl/go-bindata-assetfs/assetfs.go @@ -137,6 +137,8 @@ type AssetFS struct { AssetInfo func(path string) (os.FileInfo, error) // Prefix would be prepended to http requests Prefix string + // Fallback file that is served if no other is found + Fallback string } func (fs *AssetFS) Open(name string) (http.File, error) { @@ -153,9 +155,13 @@ func (fs *AssetFS) Open(name string) (http.File, error) { } return NewAssetFile(name, b, timestamp), nil } - if children, err := fs.AssetDir(name); err == nil { - return NewAssetDirectory(name, children, fs), nil - } else { + children, err := fs.AssetDir(name) + + if err != nil { + if len(fs.Fallback) > 0 { + return fs.Open(fs.Fallback) + } + // If the error is not found, return an error that will // result in a 404 error. Otherwise the server returns // a 500 error for files not found. @@ -164,4 +170,6 @@ func (fs *AssetFS) Open(name string) (http.File, error) { } return nil, err } + + return NewAssetDirectory(name, children, fs), nil } diff --git a/vendor/github.com/elazarl/go-bindata-assetfs/doc.go b/vendor/github.com/elazarl/go-bindata-assetfs/doc.go index a664249f342b..8f8f2c3dbe8c 100644 --- a/vendor/github.com/elazarl/go-bindata-assetfs/doc.go +++ b/vendor/github.com/elazarl/go-bindata-assetfs/doc.go @@ -1,7 +1,7 @@ // assetfs allows packages to serve static content embedded // with the go-bindata tool with the standard net/http package. // -// See https://github.com/jteeuwen/go-bindata for more information +// See https://github.com/go-bindata/go-bindata for more information // about embedding binary data with go-bindata. // // Usage example, after running diff --git a/vendor/github.com/fatih/color/Gopkg.lock b/vendor/github.com/fatih/color/Gopkg.lock deleted file mode 100644 index 7d879e9caf0b..000000000000 --- a/vendor/github.com/fatih/color/Gopkg.lock +++ /dev/null @@ -1,27 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - name = "github.com/mattn/go-colorable" - packages = ["."] - revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072" - version = "v0.0.9" - -[[projects]] - name = "github.com/mattn/go-isatty" - packages = ["."] - revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39" - version = "v0.0.3" - -[[projects]] - branch = "master" - name = "golang.org/x/sys" - packages = ["unix"] - revision = "37707fdb30a5b38865cfb95e5aab41707daec7fd" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "e8a50671c3cb93ea935bf210b1cd20702876b9d9226129be581ef646d1565cdc" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/vendor/github.com/fatih/color/Gopkg.toml b/vendor/github.com/fatih/color/Gopkg.toml deleted file mode 100644 index ff1617f71da8..000000000000 --- a/vendor/github.com/fatih/color/Gopkg.toml +++ /dev/null @@ -1,30 +0,0 @@ - -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" - - -[[constraint]] - name = "github.com/mattn/go-colorable" - version = "0.0.9" - -[[constraint]] - name = "github.com/mattn/go-isatty" - version = "0.0.3" diff --git a/vendor/github.com/fatih/color/README.md b/vendor/github.com/fatih/color/README.md index 3fc954460285..42d9abc07ed3 100644 --- a/vendor/github.com/fatih/color/README.md +++ b/vendor/github.com/fatih/color/README.md @@ -1,6 +1,12 @@ -# Color [![GoDoc](https://godoc.org/github.com/fatih/color?status.svg)](https://godoc.org/github.com/fatih/color) [![Build Status](https://img.shields.io/travis/fatih/color.svg?style=flat-square)](https://travis-ci.org/fatih/color) +# Archived project. No maintenance. +This project is not maintained anymore and is archived. Feel free to fork and +make your own changes if needed. For more detail read my blog post: [Taking an indefinite sabbatical from my projects](https://arslan.io/2018/10/09/taking-an-indefinite-sabbatical-from-my-projects/) +Thanks to everyone for their valuable feedback and contributions. + + +# Color [![GoDoc](https://godoc.org/github.com/fatih/color?status.svg)](https://godoc.org/github.com/fatih/color) Color lets you use colorized outputs in terms of [ANSI Escape Codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors) in Go (Golang). It @@ -17,9 +23,6 @@ suits you. go get github.com/fatih/color ``` -Note that the `vendor` folder is here for stability. Remove the folder if you -already have the dependencies in your GOPATH. - ## Examples ### Standard colors diff --git a/vendor/github.com/fatih/color/color.go b/vendor/github.com/fatih/color/color.go index b1f591d45f56..91c8e9f0620f 100644 --- a/vendor/github.com/fatih/color/color.go +++ b/vendor/github.com/fatih/color/color.go @@ -24,6 +24,9 @@ var ( // os.Stdout is used. Output = colorable.NewColorableStdout() + // Error defines a color supporting writer for os.Stderr. + Error = colorable.NewColorableStderr() + // colorsCache is used to reduce the count of created Color objects and // allows to reuse already created objects with required Attribute. colorsCache = make(map[Attribute]*Color) diff --git a/vendor/github.com/fatih/color/go.mod b/vendor/github.com/fatih/color/go.mod new file mode 100644 index 000000000000..bc0df754586f --- /dev/null +++ b/vendor/github.com/fatih/color/go.mod @@ -0,0 +1,8 @@ +module github.com/fatih/color + +go 1.13 + +require ( + github.com/mattn/go-colorable v0.1.4 + github.com/mattn/go-isatty v0.0.11 +) diff --git a/vendor/github.com/fatih/color/go.sum b/vendor/github.com/fatih/color/go.sum new file mode 100644 index 000000000000..44328a8db54c --- /dev/null +++ b/vendor/github.com/fatih/color/go.sum @@ -0,0 +1,8 @@ +github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/vendor/github.com/fsouza/go-dockerclient/.gitattributes b/vendor/github.com/fsouza/go-dockerclient/.gitattributes new file mode 100644 index 000000000000..6313b56c5784 --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/vendor/github.com/fsouza/go-dockerclient/.gitignore b/vendor/github.com/fsouza/go-dockerclient/.gitignore new file mode 100644 index 000000000000..5f6b48eae0d6 --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/.gitignore @@ -0,0 +1,2 @@ +# temporary symlink for testing +testing/data/symlink diff --git a/vendor/github.com/fsouza/go-dockerclient/.golangci.yaml b/vendor/github.com/fsouza/go-dockerclient/.golangci.yaml new file mode 100644 index 000000000000..33bc2f8a3463 --- /dev/null +++ b/vendor/github.com/fsouza/go-dockerclient/.golangci.yaml @@ -0,0 +1,33 @@ +run: + deadline: 5m + + skip-dirs: + - internal + +issues: + exclude-rules: + - path: _test\.go + linters: + - bodyclose + - goconst + - gosec + - scopelint + - path: testing[/\\].+\.go + linters: + - gosec + +linters: + enable-all: true + disable: + - dupl + - errcheck + - funlen + - gochecknoglobals + - gocognit + - goconst + - godot + - gomnd + - lll + - nestif + - testpackage + - wsl diff --git a/vendor/github.com/go-ole/go-ole/.travis.yml b/vendor/github.com/go-ole/go-ole/.travis.yml new file mode 100644 index 000000000000..0c2c02bdf2e6 --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/.travis.yml @@ -0,0 +1,9 @@ +language: go +sudo: false + +go: + - 1.1 + - 1.2 + - 1.3 + - 1.4 + - tip diff --git a/vendor/github.com/go-ole/go-ole/LICENSE b/vendor/github.com/go-ole/go-ole/LICENSE new file mode 100644 index 000000000000..623ec06f91ca --- /dev/null +++ b/vendor/github.com/go-ole/go-ole/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright © 2013-2017 Yasuhiro Matsumoto, + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Softwareâ€), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS ISâ€, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/go-ole/go-ole/appveyor.yml b/vendor/github.com/go-ole/go-ole/appveyor.yml index e66dd31a1dbc..0d557ac2ff55 100644 --- a/vendor/github.com/go-ole/go-ole/appveyor.yml +++ b/vendor/github.com/go-ole/go-ole/appveyor.yml @@ -23,7 +23,7 @@ environment: GOPATH: c:\gopath matrix: - GOARCH: amd64 - GOVERSION: 1.4 + GOVERSION: 1.5 GOROOT: c:\go DOWNLOADPLATFORM: "x64" @@ -37,15 +37,6 @@ install: # - set - go version - go env - - c:\gopath\src\github.com\go-ole\go-ole\build\compile-go.bat - - go tool dist install -v cmd/8a - - go tool dist install -v cmd/8c - - go tool dist install -v cmd/8g - - go tool dist install -v cmd/8l - - go tool dist install -v cmd/6a - - go tool dist install -v cmd/6c - - go tool dist install -v cmd/6g - - go tool dist install -v cmd/6l - go get -u golang.org/x/tools/cmd/cover - go get -u golang.org/x/tools/cmd/godoc - go get -u golang.org/x/tools/cmd/stringer diff --git a/vendor/github.com/go-ole/go-ole/com.go b/vendor/github.com/go-ole/go-ole/com.go index f224fa069abc..75ebbf13f6c7 100644 --- a/vendor/github.com/go-ole/go-ole/com.go +++ b/vendor/github.com/go-ole/go-ole/com.go @@ -321,9 +321,9 @@ func DispatchMessage(msg *Msg) (ret int32) { // GetVariantDate converts COM Variant Time value to Go time.Time. func GetVariantDate(value float64) (time.Time, error) { var st syscall.Systemtime - r, _, _ := procVariantTimeToSystemTime.Call(uintptr(unsafe.Pointer(&value)), uintptr(unsafe.Pointer(&st))) + r, _, _ := procVariantTimeToSystemTime.Call(uintptr(value), uintptr(unsafe.Pointer(&st))) if r != 0 { - return time.Date(int(st.Year), time.Month(st.Month), int(st.Day), int(st.Hour), int(st.Minute), int(st.Second), int(st.Milliseconds/1000), nil), nil + return time.Date(int(st.Year), time.Month(st.Month), int(st.Day), int(st.Hour), int(st.Minute), int(st.Second), int(st.Milliseconds/1000), time.UTC), nil } return time.Now(), errors.New("Could not convert to time, passing current time.") } diff --git a/vendor/github.com/go-ole/go-ole/idispatch_windows.go b/vendor/github.com/go-ole/go-ole/idispatch_windows.go index bb736903825e..020e4f51b02a 100644 --- a/vendor/github.com/go-ole/go-ole/idispatch_windows.go +++ b/vendor/github.com/go-ole/go-ole/idispatch_windows.go @@ -63,6 +63,10 @@ func invoke(disp *IDispatch, dispid int32, dispatch int16, params ...interface{} dispnames := [1]int32{DISPID_PROPERTYPUT} dispparams.rgdispidNamedArgs = uintptr(unsafe.Pointer(&dispnames[0])) dispparams.cNamedArgs = 1 + } else if dispatch&DISPATCH_PROPERTYPUTREF != 0 { + dispnames := [1]int32{DISPID_PROPERTYPUT} + dispparams.rgdispidNamedArgs = uintptr(unsafe.Pointer(&dispnames[0])) + dispparams.cNamedArgs = 1 } var vargs []VARIANT if len(params) > 0 { diff --git a/vendor/github.com/go-ole/go-ole/oleutil/connection_windows.go b/vendor/github.com/go-ole/go-ole/oleutil/connection_windows.go index 6b5c0599936c..ab9c0d8dcbd4 100644 --- a/vendor/github.com/go-ole/go-ole/oleutil/connection_windows.go +++ b/vendor/github.com/go-ole/go-ole/oleutil/connection_windows.go @@ -49,6 +49,7 @@ func ConnectObject(disp *ole.IDispatch, iid *ole.GUID, idisp interface{}) (cooki point.Release() return } + return } container.Release() diff --git a/vendor/github.com/go-ole/go-ole/oleutil/oleutil.go b/vendor/github.com/go-ole/go-ole/oleutil/oleutil.go index 55e072a6361a..f7803c1e30f2 100644 --- a/vendor/github.com/go-ole/go-ole/oleutil/oleutil.go +++ b/vendor/github.com/go-ole/go-ole/oleutil/oleutil.go @@ -87,3 +87,41 @@ func MustPutProperty(disp *ole.IDispatch, name string, params ...interface{}) (r } return r } + +// PutPropertyRef mutates property reference. +func PutPropertyRef(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT, err error) { + return disp.InvokeWithOptionalArgs(name, ole.DISPATCH_PROPERTYPUTREF, params) +} + +// MustPutPropertyRef mutates property reference or panics. +func MustPutPropertyRef(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT) { + r, err := PutPropertyRef(disp, name, params...) + if err != nil { + panic(err.Error()) + } + return r +} + +func ForEach(disp *ole.IDispatch, f func(v *ole.VARIANT) error) error { + newEnum, err := disp.GetProperty("_NewEnum") + if err != nil { + return err + } + defer newEnum.Clear() + + enum, err := newEnum.ToIUnknown().IEnumVARIANT(ole.IID_IEnumVariant) + if err != nil { + return err + } + defer enum.Release() + + for item, length, err := enum.Next(1); length > 0; item, length, err = enum.Next(1) { + if err != nil { + return err + } + if ferr := f(&item); ferr != nil { + return ferr + } + } + return nil +} diff --git a/vendor/github.com/godbus/dbus/.travis.yml b/vendor/github.com/godbus/dbus/.travis.yml new file mode 100644 index 000000000000..9cd57f432b01 --- /dev/null +++ b/vendor/github.com/godbus/dbus/.travis.yml @@ -0,0 +1,46 @@ +dist: precise +language: go +go_import_path: github.com/godbus/dbus +sudo: true + +go: + - 1.7.3 + - 1.8.7 + - 1.9.5 + - 1.10.1 + - tip + +env: + global: + matrix: + - TARGET=amd64 + - TARGET=arm64 + - TARGET=arm + - TARGET=386 + - TARGET=ppc64le + +matrix: + fast_finish: true + allow_failures: + - go: tip + exclude: + - go: tip + env: TARGET=arm + - go: tip + env: TARGET=arm64 + - go: tip + env: TARGET=386 + - go: tip + env: TARGET=ppc64le + +addons: + apt: + packages: + - dbus + - dbus-x11 + +before_install: + +script: + - go test -v -race ./... # Run all the tests with the race detector enabled + - go vet ./... # go vet is the official Go static analyzer diff --git a/vendor/github.com/godbus/dbus/auth.go b/vendor/github.com/godbus/dbus/auth.go index 31abac629d7a..b0dcb54e6b5f 100644 --- a/vendor/github.com/godbus/dbus/auth.go +++ b/vendor/github.com/godbus/dbus/auth.go @@ -77,7 +77,7 @@ func (conn *Conn) Auth(methods []Auth) error { for _, m := range methods { if name, data, status := m.FirstData(); bytes.Equal(v, name) { var ok bool - err = authWriteLine(conn.transport, []byte("AUTH"), v, data) + err = authWriteLine(conn.transport, []byte("AUTH"), []byte(v), data) if err != nil { return err } @@ -127,7 +127,7 @@ func (conn *Conn) Auth(methods []Auth) error { // tryAuth tries to authenticate with m as the mechanism, using state as the // initial authState and in for reading input. It returns (nil, true) on // success, (nil, false) on a REJECTED and (someErr, false) if some other -// error occurred. +// error occured. func (conn *Conn) tryAuth(m Auth, state authState, in *bufio.Reader) (error, bool) { for { s, err := authReadLine(in) diff --git a/vendor/github.com/godbus/dbus/auth_sha1.go b/vendor/github.com/godbus/dbus/auth_sha1.go index 80286700b6d1..df15b4611989 100644 --- a/vendor/github.com/godbus/dbus/auth_sha1.go +++ b/vendor/github.com/godbus/dbus/auth_sha1.go @@ -60,7 +60,7 @@ func (a authCookieSha1) HandleData(data []byte) ([]byte, AuthStatus) { // getCookie searches for the cookie identified by id in context and returns // the cookie content or nil. (Since HandleData can't return a specific error, -// but only whether an error occurred, this function also doesn't bother to +// but only whether an error occured, this function also doesn't bother to // return an error.) func (a authCookieSha1) getCookie(context, id []byte) []byte { file, err := os.Open(a.home + "/.dbus-keyrings/" + string(context)) diff --git a/vendor/github.com/godbus/dbus/conn.go b/vendor/github.com/godbus/dbus/conn.go index b55bc99c8540..b38920baf5b1 100644 --- a/vendor/github.com/godbus/dbus/conn.go +++ b/vendor/github.com/godbus/dbus/conn.go @@ -5,6 +5,7 @@ import ( "errors" "io" "os" + "reflect" "strings" "sync" ) @@ -30,12 +31,6 @@ var ErrClosed = errors.New("dbus: connection closed by user") type Conn struct { transport - ctx context.Context - cancelCtx context.CancelFunc - - closeOnce sync.Once - closeErr error - busObj BusObject unixFD bool uuid string @@ -43,8 +38,6 @@ type Conn struct { handler Handler signalHandler SignalHandler serialGen SerialGenerator - inInt Interceptor - outInt Interceptor names *nameTracker calls *callTracker @@ -141,8 +134,6 @@ func SystemBus() (conn *Conn, err error) { } // SystemBusPrivate returns a new private connection to the system bus. -// Note: this connection is not ready to use. One must perform Auth and Hello -// on the connection before it is useable. func SystemBusPrivate(opts ...ConnOption) (*Conn, error) { return Dial(getSystemBusPlatformAddress(), opts...) } @@ -197,33 +188,6 @@ func WithSerialGenerator(gen SerialGenerator) ConnOption { } } -// Interceptor intercepts incoming and outgoing messages. -type Interceptor func(msg *Message) - -// WithIncomingInterceptor sets the given interceptor for incoming messages. -func WithIncomingInterceptor(interceptor Interceptor) ConnOption { - return func(conn *Conn) error { - conn.inInt = interceptor - return nil - } -} - -// WithOutgoingInterceptor sets the given interceptor for outgoing messages. -func WithOutgoingInterceptor(interceptor Interceptor) ConnOption { - return func(conn *Conn) error { - conn.outInt = interceptor - return nil - } -} - -// WithContext overrides the default context for the connection. -func WithContext(ctx context.Context) ConnOption { - return func(conn *Conn) error { - conn.ctx = ctx - return nil - } -} - // NewConn creates a new private *Conn from an already established connection. func NewConn(conn io.ReadWriteCloser, opts ...ConnOption) (*Conn, error) { return newConn(genericTransport{conn}, opts...) @@ -245,15 +209,6 @@ func newConn(tr transport, opts ...ConnOption) (*Conn, error) { return nil, err } } - if conn.ctx == nil { - conn.ctx = context.Background() - } - conn.ctx, conn.cancelCtx = context.WithCancel(conn.ctx) - go func() { - <-conn.ctx.Done() - conn.Close() - }() - conn.calls = newCallTracker() if conn.handler == nil { conn.handler = NewDefaultHandler() @@ -280,38 +235,27 @@ func (conn *Conn) BusObject() BusObject { // and the channels passed to Eavesdrop and Signal are closed. This method must // not be called on shared connections. func (conn *Conn) Close() error { - conn.closeOnce.Do(func() { - conn.outHandler.close() - if term, ok := conn.signalHandler.(Terminator); ok { - term.Terminate() - } - - if term, ok := conn.handler.(Terminator); ok { - term.Terminate() - } - - conn.eavesdroppedLck.Lock() - if conn.eavesdropped != nil { - close(conn.eavesdropped) - } - conn.eavesdroppedLck.Unlock() + conn.outHandler.close() + if term, ok := conn.signalHandler.(Terminator); ok { + term.Terminate() + } - conn.cancelCtx() + if term, ok := conn.handler.(Terminator); ok { + term.Terminate() + } - conn.closeErr = conn.transport.Close() - }) - return conn.closeErr -} + conn.eavesdroppedLck.Lock() + if conn.eavesdropped != nil { + close(conn.eavesdropped) + } + conn.eavesdroppedLck.Unlock() -// Context returns the context associated with the connection. The -// context will be cancelled when the connection is closed. -func (conn *Conn) Context() context.Context { - return conn.ctx + return conn.transport.Close() } // Eavesdrop causes conn to send all incoming messages to the given channel // without further processing. Method replies, errors and signals will not be -// sent to the appropriate channels and method calls will not be handled. If nil +// sent to the appropiate channels and method calls will not be handled. If nil // is passed, the normal behaviour is restored. // // The caller has to make sure that ch is sufficiently buffered; @@ -323,7 +267,7 @@ func (conn *Conn) Eavesdrop(ch chan<- *Message) { conn.eavesdroppedLck.Unlock() } -// getSerial returns an unused serial. +// GetSerial returns an unused serial. func (conn *Conn) getSerial() uint32 { return conn.serialGen.GetSerial() } @@ -348,7 +292,7 @@ func (conn *Conn) inWorker() { msg, err := conn.ReadMessage() if err != nil { if _, ok := err.(InvalidMessageError); !ok { - // Some read error occurred (usually EOF); we can't really do + // Some read error occured (usually EOF); we can't really do // anything but to shut down all stuff and returns errors to all // pending replies. conn.Close() @@ -377,10 +321,6 @@ func (conn *Conn) inWorker() { // Ignore it. continue } - - if conn.inInt != nil { - conn.inInt(msg) - } switch msg.Type { case TypeError: conn.serialGen.RetireSerial(conn.calls.handleDBusError(msg)) @@ -441,10 +381,13 @@ func (conn *Conn) Object(dest string, path ObjectPath) BusObject { return &Object{conn, dest, path} } +// outWorker runs in an own goroutine, encoding and sending messages that are +// sent to conn.out. +func (conn *Conn) sendMessage(msg *Message) { + conn.sendMessageAndIfClosed(msg, func() {}) +} + func (conn *Conn) sendMessageAndIfClosed(msg *Message, ifClosed func()) { - if conn.outInt != nil { - conn.outInt(msg) - } err := conn.outHandler.sendAndIfClosed(msg, ifClosed) conn.calls.handleSendError(msg, err) if err != nil { @@ -540,7 +483,7 @@ func (conn *Conn) sendError(err error, dest string, serial uint32) { if len(e.Body) > 0 { msg.Headers[FieldSignature] = MakeVariant(SignatureOf(e.Body...)) } - conn.sendMessageAndIfClosed(msg, nil) + conn.sendMessage(msg) } // sendReply creates a method reply message corresponding to the parameters and @@ -558,54 +501,33 @@ func (conn *Conn) sendReply(dest string, serial uint32, values ...interface{}) { if len(values) > 0 { msg.Headers[FieldSignature] = MakeVariant(SignatureOf(values...)) } - conn.sendMessageAndIfClosed(msg, nil) -} - -// AddMatchSignal registers the given match rule to receive broadcast -// signals based on their contents. -func (conn *Conn) AddMatchSignal(options ...MatchOption) error { - options = append([]MatchOption{withMatchType("signal")}, options...) - return conn.busObj.Call( - "org.freedesktop.DBus.AddMatch", 0, - formatMatchOptions(options), - ).Store() + conn.sendMessage(msg) } -// RemoveMatchSignal removes the first rule that matches previously registered with AddMatchSignal. -func (conn *Conn) RemoveMatchSignal(options ...MatchOption) error { - options = append([]MatchOption{withMatchType("signal")}, options...) - return conn.busObj.Call( - "org.freedesktop.DBus.RemoveMatch", 0, - formatMatchOptions(options), - ).Store() +func (conn *Conn) defaultSignalAction(fn func(h *defaultSignalHandler, ch chan<- *Signal), ch chan<- *Signal) { + if !isDefaultSignalHandler(conn.signalHandler) { + return + } + handler := conn.signalHandler.(*defaultSignalHandler) + fn(handler, ch) } // Signal registers the given channel to be passed all received signal messages. +// The caller has to make sure that ch is sufficiently buffered; if a message +// arrives when a write to c is not possible, it is discarded. // // Multiple of these channels can be registered at the same time. // // These channels are "overwritten" by Eavesdrop; i.e., if there currently is a // channel for eavesdropped messages, this channel receives all signals, and // none of the channels passed to Signal will receive any signals. -// -// Panics if the signal handler is not a `SignalRegistrar`. func (conn *Conn) Signal(ch chan<- *Signal) { - handler, ok := conn.signalHandler.(SignalRegistrar) - if !ok { - panic("cannot use this method with a non SignalRegistrar handler") - } - handler.AddSignal(ch) + conn.defaultSignalAction((*defaultSignalHandler).addSignal, ch) } // RemoveSignal removes the given channel from the list of the registered channels. -// -// Panics if the signal handler is not a `SignalRegistrar`. func (conn *Conn) RemoveSignal(ch chan<- *Signal) { - handler, ok := conn.signalHandler.(SignalRegistrar) - if !ok { - panic("cannot use this method with a non SignalRegistrar handler") - } - handler.RemoveSignal(ch) + conn.defaultSignalAction((*defaultSignalHandler).removeSignal, ch) } // SupportsUnixFDs returns whether the underlying transport supports passing of @@ -692,6 +614,18 @@ func getTransport(address string) (transport, error) { return nil, err } +// dereferenceAll returns a slice that, assuming that vs is a slice of pointers +// of arbitrary types, containes the values that are obtained from dereferencing +// all elements in vs. +func dereferenceAll(vs []interface{}) []interface{} { + for i := range vs { + v := reflect.ValueOf(vs[i]) + v = v.Elem() + vs[i] = v.Interface() + } + return vs +} + // getKey gets a key from a the list of keys. Returns "" on error / not found... func getKey(s, key string) string { for _, keyEqualsValue := range strings.Split(s, ",") { @@ -716,9 +650,7 @@ func (h *outputHandler) sendAndIfClosed(msg *Message, ifClosed func()) error { h.closed.lck.RLock() defer h.closed.lck.RUnlock() if h.closed.isClosed { - if ifClosed != nil { - ifClosed() - } + ifClosed() return nil } h.sendLck.Lock() @@ -869,6 +801,7 @@ func (tracker *callTracker) finalize(sn uint32) { delete(tracker.calls, sn) c.ContextCancel() } + return } func (tracker *callTracker) finalizeWithBody(sn uint32, body []interface{}) { @@ -882,6 +815,7 @@ func (tracker *callTracker) finalizeWithBody(sn uint32, body []interface{}) { c.Body = body c.done() } + return } func (tracker *callTracker) finalizeWithError(sn uint32, err error) { @@ -895,6 +829,7 @@ func (tracker *callTracker) finalizeWithError(sn uint32, err error) { c.Err = err c.done() } + return } func (tracker *callTracker) finalizeAllWithError(err error) { diff --git a/vendor/github.com/godbus/dbus/conn_other.go b/vendor/github.com/godbus/dbus/conn_other.go index 616dcf66449f..289044a44d4b 100644 --- a/vendor/github.com/godbus/dbus/conn_other.go +++ b/vendor/github.com/godbus/dbus/conn_other.go @@ -14,10 +14,8 @@ import ( "strings" ) -var execCommand = exec.Command - func getSessionBusPlatformAddress() (string, error) { - cmd := execCommand("dbus-launch") + cmd := exec.Command("dbus-launch") b, err := cmd.CombinedOutput() if err != nil { @@ -27,7 +25,7 @@ func getSessionBusPlatformAddress() (string, error) { i := bytes.IndexByte(b, '=') j := bytes.IndexByte(b, '\n') - if i == -1 || j == -1 || i > j { + if i == -1 || j == -1 { return "", errors.New("dbus: couldn't determine address of session bus") } diff --git a/vendor/github.com/godbus/dbus/conn_unix.go b/vendor/github.com/godbus/dbus/conn_unix.go index 58aee7d2af5e..4cba8ae8ec30 100644 --- a/vendor/github.com/godbus/dbus/conn_unix.go +++ b/vendor/github.com/godbus/dbus/conn_unix.go @@ -4,6 +4,7 @@ package dbus import ( "os" + "fmt" ) const defaultSystemBusAddress = "unix:path=/var/run/dbus/system_bus_socket" @@ -11,7 +12,7 @@ const defaultSystemBusAddress = "unix:path=/var/run/dbus/system_bus_socket" func getSystemBusPlatformAddress() string { address := os.Getenv("DBUS_SYSTEM_BUS_ADDRESS") if address != "" { - return address + return fmt.Sprintf("unix:path=%s", address) } return defaultSystemBusAddress -} +} \ No newline at end of file diff --git a/vendor/github.com/godbus/dbus/dbus.go b/vendor/github.com/godbus/dbus/dbus.go index 428923d26672..c6d0d3ce0e3b 100644 --- a/vendor/github.com/godbus/dbus/dbus.go +++ b/vendor/github.com/godbus/dbus/dbus.go @@ -87,7 +87,6 @@ func setDest(dest, src reflect.Value) error { } if isVariant(src.Type()) && !isVariant(dest.Type()) { src = getVariantValue(src) - return store(dest, src) } if !src.Type().ConvertibleTo(dest.Type()) { return fmt.Errorf( diff --git a/vendor/github.com/godbus/dbus/decoder.go b/vendor/github.com/godbus/dbus/decoder.go index ede91575b3e8..5c27d3b51f6a 100644 --- a/vendor/github.com/godbus/dbus/decoder.go +++ b/vendor/github.com/godbus/dbus/decoder.go @@ -188,14 +188,8 @@ func (dec *decoder) decode(s string, depth int) interface{} { if depth >= 64 { panic(FormatError("input exceeds container depth limit")) } - sig := s[1:] length := dec.decode("u", depth).(uint32) - // capacity can be determined only for fixed-size element types - var capacity int - if s := sigByteSize(sig); s != 0 { - capacity = int(length) / s - } - v := reflect.MakeSlice(reflect.SliceOf(typeFor(sig)), 0, capacity) + v := reflect.MakeSlice(reflect.SliceOf(typeFor(s[1:])), 0, int(length)) // Even for empty arrays, the correct padding must be included align := alignment(typeFor(s[1:])) if len(s) > 1 && s[1] == '(' { @@ -233,51 +227,6 @@ func (dec *decoder) decode(s string, depth int) interface{} { } } -// sigByteSize tries to calculates size of the given signature in bytes. -// -// It returns zero when it can't, for example when it contains non-fixed size -// types such as strings, maps and arrays that require reading of the transmitted -// data, for that we would need to implement the unread method for Decoder first. -func sigByteSize(sig string) int { - var total int - for offset := 0; offset < len(sig); { - switch sig[offset] { - case 'y': - total += 1 - offset += 1 - case 'n', 'q': - total += 2 - offset += 1 - case 'b', 'i', 'u', 'h': - total += 4 - offset += 1 - case 'x', 't', 'd': - total += 8 - offset += 1 - case '(': - i := 1 - depth := 1 - for i < len(sig[offset:]) && depth != 0 { - if sig[offset+i] == '(' { - depth++ - } else if sig[offset+i] == ')' { - depth-- - } - i++ - } - s := sigByteSize(sig[offset+1 : offset+i-1]) - if s == 0 { - return 0 - } - total += s - offset += i - default: - return 0 - } - } - return total -} - // A FormatError is an error in the wire format. type FormatError string diff --git a/vendor/github.com/godbus/dbus/default_handler.go b/vendor/github.com/godbus/dbus/default_handler.go index 6d8bf32f9f9f..81dbcc7e42a7 100644 --- a/vendor/github.com/godbus/dbus/default_handler.go +++ b/vendor/github.com/godbus/dbus/default_handler.go @@ -47,7 +47,7 @@ func (h *defaultHandler) introspectPath(path ObjectPath) string { subpath := make(map[string]struct{}) var xml bytes.Buffer xml.WriteString("") - for obj := range h.objects { + for obj, _ := range h.objects { p := string(path) if p != "/" { p += "/" @@ -57,7 +57,7 @@ func (h *defaultHandler) introspectPath(path ObjectPath) string { subpath[node_name] = struct{}{} } } - for s := range subpath { + for s, _ := range subpath { xml.WriteString("\n\t") } xml.WriteString("\n") @@ -234,95 +234,88 @@ func (obj *exportedIntf) isFallbackInterface() bool { // // Deprecated: this is the default value, don't use it, it will be unexported. func NewDefaultSignalHandler() *defaultSignalHandler { - return &defaultSignalHandler{} + return &defaultSignalHandler{ + closeChan: make(chan struct{}), + } +} + +func isDefaultSignalHandler(handler SignalHandler) bool { + _, ok := handler.(*defaultSignalHandler) + return ok } type defaultSignalHandler struct { - mu sync.RWMutex - closed bool - signals []*signalChannelData + sync.RWMutex + closed bool + signals []chan<- *Signal + closeChan chan struct{} } func (sh *defaultSignalHandler) DeliverSignal(intf, name string, signal *Signal) { - sh.mu.RLock() - defer sh.mu.RUnlock() + sh.RLock() + defer sh.RUnlock() if sh.closed { return } - for _, scd := range sh.signals { - scd.deliver(signal) + for _, ch := range sh.signals { + select { + case ch <- signal: + case <-sh.closeChan: + return + default: + go func() { + select { + case ch <- signal: + case <-sh.closeChan: + return + } + }() + } } } -func (sh *defaultSignalHandler) Terminate() { - sh.mu.Lock() - defer sh.mu.Unlock() - if sh.closed { - return - } +func (sh *defaultSignalHandler) Init() error { + sh.Lock() + sh.signals = make([]chan<- *Signal, 0) + sh.closeChan = make(chan struct{}) + sh.Unlock() + return nil +} - for _, scd := range sh.signals { - scd.close() - close(scd.ch) +func (sh *defaultSignalHandler) Terminate() { + sh.Lock() + if !sh.closed { + close(sh.closeChan) } sh.closed = true + for _, ch := range sh.signals { + close(ch) + } sh.signals = nil + sh.Unlock() } -func (sh *defaultSignalHandler) AddSignal(ch chan<- *Signal) { - sh.mu.Lock() - defer sh.mu.Unlock() +func (sh *defaultSignalHandler) addSignal(ch chan<- *Signal) { + sh.Lock() + defer sh.Unlock() if sh.closed { return } - sh.signals = append(sh.signals, &signalChannelData{ - ch: ch, - done: make(chan struct{}), - }) + sh.signals = append(sh.signals, ch) + } -func (sh *defaultSignalHandler) RemoveSignal(ch chan<- *Signal) { - sh.mu.Lock() - defer sh.mu.Unlock() +func (sh *defaultSignalHandler) removeSignal(ch chan<- *Signal) { + sh.Lock() + defer sh.Unlock() if sh.closed { return } for i := len(sh.signals) - 1; i >= 0; i-- { - if ch == sh.signals[i].ch { - sh.signals[i].close() + if ch == sh.signals[i] { copy(sh.signals[i:], sh.signals[i+1:]) sh.signals[len(sh.signals)-1] = nil sh.signals = sh.signals[:len(sh.signals)-1] } } } - -type signalChannelData struct { - wg sync.WaitGroup - ch chan<- *Signal - done chan struct{} -} - -func (scd *signalChannelData) deliver(signal *Signal) { - select { - case scd.ch <- signal: - case <-scd.done: - return - default: - scd.wg.Add(1) - go scd.deferredDeliver(signal) - } -} - -func (scd *signalChannelData) deferredDeliver(signal *Signal) { - select { - case scd.ch <- signal: - case <-scd.done: - } - scd.wg.Done() -} - -func (scd *signalChannelData) close() { - close(scd.done) - scd.wg.Wait() // wait until all spawned goroutines return -} diff --git a/vendor/github.com/godbus/dbus/doc.go b/vendor/github.com/godbus/dbus/doc.go index ade1df951cd2..895036a8c110 100644 --- a/vendor/github.com/godbus/dbus/doc.go +++ b/vendor/github.com/godbus/dbus/doc.go @@ -61,7 +61,7 @@ Handling Unix file descriptors deserves special mention. To use them, you should first check that they are supported on a connection by calling SupportsUnixFDs. If it returns true, all method of Connection will translate messages containing UnixFD's to messages that are accompanied by the given file descriptors with the -UnixFD values being substituted by the correct indices. Similarly, the indices +UnixFD values being substituted by the correct indices. Similarily, the indices of incoming messages are automatically resolved. It shouldn't be necessary to use UnixFDIndex. diff --git a/vendor/github.com/godbus/dbus/encoder.go b/vendor/github.com/godbus/dbus/encoder.go index adfbb75c5595..8bb717761cdd 100644 --- a/vendor/github.com/godbus/dbus/encoder.go +++ b/vendor/github.com/godbus/dbus/encoder.go @@ -60,7 +60,7 @@ func (enc *encoder) binwrite(v interface{}) { } } -// Encode encodes the given values to the underlying reader. All written values +// Encode encodes the given values to the underyling reader. All written values // are aligned properly as required by the D-Bus spec. func (enc *encoder) Encode(vs ...interface{}) (err error) { defer func() { diff --git a/vendor/github.com/godbus/dbus/export.go b/vendor/github.com/godbus/dbus/export.go index c277ab142622..95d0e29582d4 100644 --- a/vendor/github.com/godbus/dbus/export.go +++ b/vendor/github.com/godbus/dbus/export.go @@ -171,7 +171,7 @@ func (conn *Conn) handleCall(msg *Message) { } reply.Headers[FieldSignature] = MakeVariant(SignatureOf(reply.Body...)) - conn.sendMessageAndIfClosed(reply, nil) + conn.sendMessage(reply) } } diff --git a/vendor/github.com/godbus/dbus/go.mod b/vendor/github.com/godbus/dbus/go.mod index 15b920203c55..bdcd12598b47 100644 --- a/vendor/github.com/godbus/dbus/go.mod +++ b/vendor/github.com/godbus/dbus/go.mod @@ -1,3 +1 @@ -module github.com/godbus/dbus/v5 - -go 1.12 +module github.com/godbus/dbus diff --git a/vendor/github.com/godbus/dbus/match.go b/vendor/github.com/godbus/dbus/match.go deleted file mode 100644 index 086ee336a9a4..000000000000 --- a/vendor/github.com/godbus/dbus/match.go +++ /dev/null @@ -1,62 +0,0 @@ -package dbus - -import ( - "strings" -) - -// MatchOption specifies option for dbus routing match rule. Options can be constructed with WithMatch* helpers. -// For full list of available options consult -// https://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-routing-match-rules -type MatchOption struct { - key string - value string -} - -func formatMatchOptions(options []MatchOption) string { - items := make([]string, 0, len(options)) - for _, option := range options { - items = append(items, option.key+"='"+option.value+"'") - } - return strings.Join(items, ",") -} - -// WithMatchOption creates match option with given key and value -func WithMatchOption(key, value string) MatchOption { - return MatchOption{key, value} -} - -// doesn't make sense to export this option because clients can only -// subscribe to messages with signal type. -func withMatchType(typ string) MatchOption { - return WithMatchOption("type", typ) -} - -// WithMatchSender sets sender match option. -func WithMatchSender(sender string) MatchOption { - return WithMatchOption("sender", sender) -} - -// WithMatchSender sets interface match option. -func WithMatchInterface(iface string) MatchOption { - return WithMatchOption("interface", iface) -} - -// WithMatchMember sets member match option. -func WithMatchMember(member string) MatchOption { - return WithMatchOption("member", member) -} - -// WithMatchObjectPath creates match option that filters events based on given path -func WithMatchObjectPath(path ObjectPath) MatchOption { - return WithMatchOption("path", string(path)) -} - -// WithMatchPathNamespace sets path_namespace match option. -func WithMatchPathNamespace(namespace ObjectPath) MatchOption { - return WithMatchOption("path_namespace", string(namespace)) -} - -// WithMatchDestination sets destination match option. -func WithMatchDestination(destination string) MatchOption { - return WithMatchOption("destination", destination) -} diff --git a/vendor/github.com/godbus/dbus/object.go b/vendor/github.com/godbus/dbus/object.go index 8acd7fc8b1a4..f27ffe144a8f 100644 --- a/vendor/github.com/godbus/dbus/object.go +++ b/vendor/github.com/godbus/dbus/object.go @@ -16,7 +16,6 @@ type BusObject interface { AddMatchSignal(iface, member string, options ...MatchOption) *Call RemoveMatchSignal(iface, member string, options ...MatchOption) *Call GetProperty(p string) (Variant, error) - SetProperty(p string, v interface{}) error Destination() string Path() ObjectPath } @@ -38,16 +37,41 @@ func (o *Object) CallWithContext(ctx context.Context, method string, flags Flags return <-o.createCall(ctx, method, flags, make(chan *Call, 1), args...).Done } +// MatchOption specifies option for dbus routing match rule. Options can be constructed with WithMatch* helpers. +// For full list of available options consult +// https://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-routing-match-rules +type MatchOption struct { + key string + value string +} + +// WithMatchOption creates match option with given key and value +func WithMatchOption(key, value string) MatchOption { + return MatchOption{key, value} +} + +// WithMatchObjectPath creates match option that filters events based on given path +func WithMatchObjectPath(path ObjectPath) MatchOption { + return MatchOption{"path", string(path)} +} + +func formatMatchOptions(options []MatchOption) string { + items := make([]string, 0, len(options)) + for _, option := range options { + items = append(items, option.key+"='"+option.value+"'") + } + + return strings.Join(items, ",") +} + // AddMatchSignal subscribes BusObject to signals from specified interface, // method (member). Additional filter rules can be added via WithMatch* option constructors. // Note: To filter events by object path you have to specify this path via an option. -// -// Deprecated: use (*Conn) AddMatchSignal instead. func (o *Object) AddMatchSignal(iface, member string, options ...MatchOption) *Call { base := []MatchOption{ - withMatchType("signal"), - WithMatchInterface(iface), - WithMatchMember(member), + {"type", "signal"}, + {"interface", iface}, + {"member", member}, } options = append(base, options...) @@ -60,13 +84,11 @@ func (o *Object) AddMatchSignal(iface, member string, options ...MatchOption) *C // RemoveMatchSignal unsubscribes BusObject from signals from specified interface, // method (member). Additional filter rules can be added via WithMatch* option constructors -// -// Deprecated: use (*Conn) RemoveMatchSignal instead. func (o *Object) RemoveMatchSignal(iface, member string, options ...MatchOption) *Call { base := []MatchOption{ - withMatchType("signal"), - WithMatchInterface(iface), - WithMatchMember(member), + {"type", "signal"}, + {"interface", iface}, + {"member", member}, } options = append(base, options...) @@ -124,7 +146,7 @@ func (o *Object) createCall(ctx context.Context, method string, flags Flags, ch } if msg.Flags&FlagNoReplyExpected == 0 { if ch == nil { - ch = make(chan *Call, 1) + ch = make(chan *Call, 10) } else if cap(ch) == 0 { panic("dbus: unbuffered channel passed to (*Object).Go") } @@ -165,7 +187,7 @@ func (o *Object) createCall(ctx context.Context, method string, flags Flags, ch return call } -// GetProperty calls org.freedesktop.DBus.Properties.Get on the given +// GetProperty calls org.freedesktop.DBus.Properties.GetProperty on the given // object. The property name must be given in interface.member notation. func (o *Object) GetProperty(p string) (Variant, error) { idx := strings.LastIndex(p, ".") @@ -186,20 +208,6 @@ func (o *Object) GetProperty(p string) (Variant, error) { return result, nil } -// SetProperty calls org.freedesktop.DBus.Properties.Set on the given -// object. The property name must be given in interface.member notation. -func (o *Object) SetProperty(p string, v interface{}) error { - idx := strings.LastIndex(p, ".") - if idx == -1 || idx+1 == len(p) { - return errors.New("dbus: invalid property " + p) - } - - iface := p[:idx] - prop := p[idx+1:] - - return o.Call("org.freedesktop.DBus.Properties.Set", 0, iface, prop, v).Err -} - // Destination returns the destination that calls on (o *Object) are sent to. func (o *Object) Destination() string { return o.dest diff --git a/vendor/github.com/godbus/dbus/server_interfaces.go b/vendor/github.com/godbus/dbus/server_interfaces.go index 79d97edf3ece..01166f0bd2ac 100644 --- a/vendor/github.com/godbus/dbus/server_interfaces.go +++ b/vendor/github.com/godbus/dbus/server_interfaces.go @@ -77,14 +77,6 @@ type SignalHandler interface { DeliverSignal(iface, name string, signal *Signal) } -// SignalRegistrar manages signal delivery channels. -// -// This is an optional set of methods for `SignalHandler`. -type SignalRegistrar interface { - AddSignal(ch chan<- *Signal) - RemoveSignal(ch chan<- *Signal) -} - // A DBusError is used to convert a generic object to a D-Bus error. // // Any custom error mechanism may implement this interface to provide diff --git a/vendor/github.com/godbus/dbus/transport_tcp.go b/vendor/github.com/godbus/dbus/transport_tcp.go index f91c9b7d709c..dd1c8e59c5b8 100644 --- a/vendor/github.com/godbus/dbus/transport_tcp.go +++ b/vendor/github.com/godbus/dbus/transport_tcp.go @@ -1,3 +1,5 @@ +//+build !windows + package dbus import ( diff --git a/vendor/github.com/godbus/dbus/transport_unix.go b/vendor/github.com/godbus/dbus/transport_unix.go index c7cd02f97fdf..f000c6b5d455 100644 --- a/vendor/github.com/godbus/dbus/transport_unix.go +++ b/vendor/github.com/godbus/dbus/transport_unix.go @@ -203,7 +203,7 @@ func (t *unixTransport) SendMessage(msg *Message) error { } } else { if err := msg.EncodeTo(t, nativeEndian); err != nil { - return err + return nil } } return nil diff --git a/vendor/github.com/godbus/dbus/variant.go b/vendor/github.com/godbus/dbus/variant.go index 5b51828c8248..0ca123b01288 100644 --- a/vendor/github.com/godbus/dbus/variant.go +++ b/vendor/github.com/godbus/dbus/variant.go @@ -26,7 +26,7 @@ func MakeVariantWithSignature(v interface{}, s Signature) Variant { } // ParseVariant parses the given string as a variant as described at -// https://developer.gnome.org/glib/stable/gvariant-text.html. If sig is not +// https://developer.gnome.org/glib/unstable/gvariant-text.html. If sig is not // empty, it is taken to be the expected signature for the variant. func ParseVariant(s string, sig Signature) (Variant, error) { tokens := varLex(s) @@ -129,7 +129,7 @@ func (v Variant) Signature() Signature { } // String returns the string representation of the underlying value of v as -// described at https://developer.gnome.org/glib/stable/gvariant-text.html. +// described at https://developer.gnome.org/glib/unstable/gvariant-text.html. func (v Variant) String() string { s, unamb := v.format() if !unamb { diff --git a/vendor/github.com/godbus/dbus/variant_lexer.go b/vendor/github.com/godbus/dbus/variant_lexer.go index bf1398c8f057..332007d6f123 100644 --- a/vendor/github.com/godbus/dbus/variant_lexer.go +++ b/vendor/github.com/godbus/dbus/variant_lexer.go @@ -51,7 +51,7 @@ func varLex(s string) []varToken { } func (l *varLexer) accept(valid string) bool { - if strings.ContainsRune(valid, l.next()) { + if strings.IndexRune(valid, l.next()) >= 0 { return true } l.backup() @@ -214,17 +214,17 @@ func varLexNumber(l *varLexer) lexState { digits = "01234567" } } - for strings.ContainsRune(digits, l.next()) { + for strings.IndexRune(digits, l.next()) >= 0 { } l.backup() if l.accept(".") { - for strings.ContainsRune(digits, l.next()) { + for strings.IndexRune(digits, l.next()) >= 0 { } l.backup() } if l.accept("eE") { l.accept("+-") - for strings.ContainsRune("0123456789", l.next()) { + for strings.IndexRune("0123456789", l.next()) >= 0 { } l.backup() } diff --git a/vendor/github.com/gogo/protobuf/AUTHORS b/vendor/github.com/gogo/protobuf/AUTHORS new file mode 100644 index 000000000000..3d97fc7a29f8 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/AUTHORS @@ -0,0 +1,15 @@ +# This is the official list of GoGo authors for copyright purposes. +# This file is distinct from the CONTRIBUTORS file, which +# lists people. For example, employees are listed in CONTRIBUTORS, +# but not in AUTHORS, because the employer holds the copyright. + +# Names should be added to this file as one of +# Organization's name +# Individual's name +# Individual's name + +# Please keep the list sorted. + +Sendgrid, Inc +Vastech SA (PTY) LTD +Walter Schulze diff --git a/vendor/github.com/gogo/protobuf/CONTRIBUTORS b/vendor/github.com/gogo/protobuf/CONTRIBUTORS new file mode 100644 index 000000000000..1b4f6c208a14 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/CONTRIBUTORS @@ -0,0 +1,23 @@ +Anton Povarov +Brian Goff +Clayton Coleman +Denis Smirnov +DongYun Kang +Dwayne Schultz +Georg Apitz +Gustav Paul +Johan Brandhorst +John Shahid +John Tuley +Laurent +Patrick Lee +Peter Edge +Roger Johansson +Sam Nguyen +Sergio Arbeo +Stephen J Day +Tamir Duberstein +Todd Eisenberger +Tormod Erevik Lea +Vyacheslav Kim +Walter Schulze diff --git a/vendor/github.com/gogo/protobuf/LICENSE b/vendor/github.com/gogo/protobuf/LICENSE index 7be0cc7b62cf..f57de90da8ac 100644 --- a/vendor/github.com/gogo/protobuf/LICENSE +++ b/vendor/github.com/gogo/protobuf/LICENSE @@ -1,7 +1,6 @@ -Protocol Buffers for Go with Gadgets - Copyright (c) 2013, The GoGo Authors. All rights reserved. -http://github.com/gogo/protobuf + +Protocol Buffers for Go with Gadgets Go support for Protocol Buffers - Google's data interchange format diff --git a/vendor/github.com/gogo/protobuf/proto/Makefile b/vendor/github.com/gogo/protobuf/proto/Makefile index 41c717573ea5..00d65f327732 100644 --- a/vendor/github.com/gogo/protobuf/proto/Makefile +++ b/vendor/github.com/gogo/protobuf/proto/Makefile @@ -38,6 +38,6 @@ test: install generate-test-pbs generate-test-pbs: make install - make -C testdata - protoc-min-version --version="3.0.0" --proto_path=.:../../../../:../protobuf --gogo_out=Mtestdata/test.proto=github.com/gogo/protobuf/proto/testdata,Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types:. proto3_proto/proto3.proto + make -C test_proto + make -C proto3_proto make diff --git a/vendor/github.com/gogo/protobuf/proto/clone.go b/vendor/github.com/gogo/protobuf/proto/clone.go index 5d4cba4b51c6..a26b046d94f1 100644 --- a/vendor/github.com/gogo/protobuf/proto/clone.go +++ b/vendor/github.com/gogo/protobuf/proto/clone.go @@ -35,22 +35,39 @@ package proto import ( + "fmt" "log" "reflect" "strings" ) // Clone returns a deep copy of a protocol buffer. -func Clone(pb Message) Message { - in := reflect.ValueOf(pb) +func Clone(src Message) Message { + in := reflect.ValueOf(src) if in.IsNil() { - return pb + return src } - out := reflect.New(in.Type().Elem()) - // out is empty so a merge is a deep copy. - mergeStruct(out.Elem(), in.Elem()) - return out.Interface().(Message) + dst := out.Interface().(Message) + Merge(dst, src) + return dst +} + +// Merger is the interface representing objects that can merge messages of the same type. +type Merger interface { + // Merge merges src into this message. + // Required and optional fields that are set in src will be set to that value in dst. + // Elements of repeated fields will be appended. + // + // Merge may panic if called with a different argument type than the receiver. + Merge(src Message) +} + +// generatedMerger is the custom merge method that generated protos will have. +// We must add this method since a generate Merge method will conflict with +// many existing protos that have a Merge data field already defined. +type generatedMerger interface { + XXX_Merge(src Message) } // Merge merges src into dst. @@ -58,17 +75,24 @@ func Clone(pb Message) Message { // Elements of repeated fields will be appended. // Merge panics if src and dst are not the same type, or if dst is nil. func Merge(dst, src Message) { + if m, ok := dst.(Merger); ok { + m.Merge(src) + return + } + in := reflect.ValueOf(src) out := reflect.ValueOf(dst) if out.IsNil() { panic("proto: nil destination") } if in.Type() != out.Type() { - // Explicit test prior to mergeStruct so that mistyped nils will fail - panic("proto: type mismatch") + panic(fmt.Sprintf("proto.Merge(%T, %T) type mismatch", dst, src)) } if in.IsNil() { - // Merging nil into non-nil is a quiet no-op + return // Merge from nil src is a noop + } + if m, ok := dst.(generatedMerger); ok { + m.XXX_Merge(src) return } mergeStruct(out.Elem(), in.Elem()) @@ -89,7 +113,7 @@ func mergeStruct(out, in reflect.Value) { bIn := emIn.GetExtensions() bOut := emOut.GetExtensions() *bOut = append(*bOut, *bIn...) - } else if emIn, ok := extendable(in.Addr().Interface()); ok { + } else if emIn, err := extendable(in.Addr().Interface()); err == nil { emOut, _ := extendable(out.Addr().Interface()) mIn, muIn := emIn.extensionsRead() if mIn != nil { diff --git a/vendor/github.com/gogo/protobuf/proto/custom_gogo.go b/vendor/github.com/gogo/protobuf/proto/custom_gogo.go new file mode 100644 index 000000000000..24552483c6ce --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/custom_gogo.go @@ -0,0 +1,39 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/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. +// +// 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 "reflect" + +type custom interface { + Marshal() ([]byte, error) + Unmarshal(data []byte) error + Size() int +} + +var customType = reflect.TypeOf((*custom)(nil)).Elem() diff --git a/vendor/github.com/gogo/protobuf/proto/decode.go b/vendor/github.com/gogo/protobuf/proto/decode.go index 737f2731d45d..63b0f08bef2a 100644 --- a/vendor/github.com/gogo/protobuf/proto/decode.go +++ b/vendor/github.com/gogo/protobuf/proto/decode.go @@ -39,8 +39,6 @@ import ( "errors" "fmt" "io" - "os" - "reflect" ) // errOverflow is returned when an integer is too large to be represented. @@ -50,10 +48,6 @@ var errOverflow = errors.New("proto: integer overflow") // wire type is encountered. It does not get returned to user code. var ErrInternalBadWireType = errors.New("proto: internal error: bad wiretype for oneof") -// The fundamental decoders that interpret bytes on the wire. -// Those that take integer types all return uint64 and are -// therefore of type valueDecoder. - // DecodeVarint reads a varint-encoded integer from the slice. // It returns the integer and the number of bytes consumed, or // zero if there is not enough. @@ -192,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 @@ -267,9 +260,6 @@ func (p *Buffer) DecodeZigzag32() (x uint64, err error) { return } -// These are not ValueDecoders: they produce an array of bytes or a string. -// bytes, embedded messages - // DecodeRawBytes reads a count-delimited byte buffer from the Buffer. // This is the format used for the bytes protocol buffer // type and for embedded messages. @@ -311,81 +301,29 @@ func (p *Buffer) DecodeStringBytes() (s string, err error) { return string(buf), nil } -// Skip the next item in the buffer. Its wire type is decoded and presented as an argument. -// If the protocol buffer has extensions, and the field matches, add it as an extension. -// Otherwise, if the XXX_unrecognized field exists, append the skipped data there. -func (o *Buffer) skipAndSave(t reflect.Type, tag, wire int, base structPointer, unrecField field) error { - oi := o.index - - err := o.skip(t, tag, wire) - if err != nil { - return err - } - - if !unrecField.IsValid() { - return nil - } - - ptr := structPointer_Bytes(base, unrecField) - - // Add the skipped field to struct field - obuf := o.buf - - o.buf = *ptr - o.EncodeVarint(uint64(tag<<3 | wire)) - *ptr = append(o.buf, obuf[oi:o.index]...) - - o.buf = obuf - - return nil -} - -// Skip the next item in the buffer. Its wire type is decoded and presented as an argument. -func (o *Buffer) skip(t reflect.Type, tag, wire int) error { - - var u uint64 - var err error - - switch wire { - case WireVarint: - _, err = o.DecodeVarint() - case WireFixed64: - _, err = o.DecodeFixed64() - case WireBytes: - _, err = o.DecodeRawBytes(false) - case WireFixed32: - _, err = o.DecodeFixed32() - case WireStartGroup: - for { - u, err = o.DecodeVarint() - if err != nil { - break - } - fwire := int(u & 0x7) - if fwire == WireEndGroup { - break - } - ftag := int(u >> 3) - err = o.skip(t, ftag, fwire) - if err != nil { - break - } - } - default: - err = fmt.Errorf("proto: can't skip unknown wire type %d for %s", wire, t) - } - return err -} - // Unmarshaler is the interface representing objects that can -// unmarshal themselves. The method should reset the receiver before -// decoding starts. The argument points to data that may be +// unmarshal themselves. The argument points to data that may be // overwritten, so implementations should not keep references to the // buffer. +// Unmarshal implementations should not clear the receiver. +// Any unmarshaled data should be merged into the receiver. +// Callers of Unmarshal that do not want to retain existing data +// should Reset the receiver before calling Unmarshal. type Unmarshaler interface { Unmarshal([]byte) error } +// newUnmarshaler is the interface representing objects that can +// unmarshal themselves. The semantics are identical to Unmarshaler. +// +// This exists to support protoc-gen-go generated messages. +// The proto package will stop type-asserting to this interface in the future. +// +// DO NOT DEPEND ON THIS. +type newUnmarshaler interface { + XXX_Unmarshal([]byte) error +} + // Unmarshal parses the protocol buffer representation in buf and places the // decoded result in pb. If the struct underlying pb does not match // the data in buf, the results can be unpredictable. @@ -395,7 +333,13 @@ type Unmarshaler interface { // to preserve and append to existing data. func Unmarshal(buf []byte, pb Message) error { pb.Reset() - return UnmarshalMerge(buf, pb) + if u, ok := pb.(newUnmarshaler); ok { + return u.XXX_Unmarshal(buf) + } + if u, ok := pb.(Unmarshaler); ok { + return u.Unmarshal(buf) + } + return NewBuffer(buf).Unmarshal(pb) } // UnmarshalMerge parses the protocol buffer representation in buf and @@ -405,8 +349,16 @@ func Unmarshal(buf []byte, pb Message) error { // UnmarshalMerge merges into existing data in pb. // Most code should use Unmarshal instead. func UnmarshalMerge(buf []byte, pb Message) error { - // If the object can unmarshal itself, let it. + if u, ok := pb.(newUnmarshaler); ok { + return u.XXX_Unmarshal(buf) + } if u, ok := pb.(Unmarshaler); ok { + // NOTE: The history of proto have unfortunately been inconsistent + // whether Unmarshaler should or should not implicitly clear itself. + // Some implementations do, most do not. + // Thus, calling this here may or may not do what people want. + // + // See https://github.com/golang/protobuf/issues/424 return u.Unmarshal(buf) } return NewBuffer(buf).Unmarshal(pb) @@ -422,12 +374,17 @@ func (p *Buffer) DecodeMessage(pb Message) error { } // DecodeGroup reads a tag-delimited group from the Buffer. +// StartGroup tag is already consumed. This function consumes +// EndGroup tag. func (p *Buffer) DecodeGroup(pb Message) error { - typ, base, err := getbase(pb) - if err != nil { - return err + b := p.buf[p.index:] + x, y := findEndGroup(b) + if x < 0 { + return io.ErrUnexpectedEOF } - return p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), true, base) + err := Unmarshal(b[:x], pb) + p.index += y + return err } // Unmarshal parses the protocol buffer representation in the @@ -438,541 +395,33 @@ func (p *Buffer) DecodeGroup(pb Message) error { // Unlike proto.Unmarshal, this does not reset pb before starting to unmarshal. func (p *Buffer) Unmarshal(pb Message) error { // If the object can unmarshal itself, let it. - if u, ok := pb.(Unmarshaler); ok { - err := u.Unmarshal(p.buf[p.index:]) + if u, ok := pb.(newUnmarshaler); ok { + err := u.XXX_Unmarshal(p.buf[p.index:]) p.index = len(p.buf) return err } - - typ, base, err := getbase(pb) - if err != nil { - return err - } - - err = p.unmarshalType(typ.Elem(), GetProperties(typ.Elem()), false, base) - - if collectStats { - stats.Decode++ - } - - return err -} - -// unmarshalType does the work of unmarshaling a structure. -func (o *Buffer) unmarshalType(st reflect.Type, prop *StructProperties, is_group bool, base structPointer) error { - var state errorState - required, reqFields := prop.reqCount, uint64(0) - - var err error - for err == nil && o.index < len(o.buf) { - oi := o.index - var u uint64 - u, err = o.DecodeVarint() - if err != nil { - break - } - wire := int(u & 0x7) - if wire == WireEndGroup { - if is_group { - if required > 0 { - // Not enough information to determine the exact field. - // (See below.) - return &RequiredNotSetError{"{Unknown}"} - } - return nil // input is satisfied - } - return fmt.Errorf("proto: %s: wiretype end group for non-group", st) - } - tag := int(u >> 3) - if tag <= 0 { - return fmt.Errorf("proto: %s: illegal tag %d (wire type %d)", st, tag, wire) - } - fieldnum, ok := prop.decoderTags.get(tag) - if !ok { - // Maybe it's an extension? - if prop.extendable { - if e, eok := structPointer_Interface(base, st).(extensionsBytes); eok { - if isExtensionField(e, int32(tag)) { - if err = o.skip(st, tag, wire); err == nil { - ext := e.GetExtensions() - *ext = append(*ext, o.buf[oi:o.index]...) - } - continue - } - } else if e, _ := extendable(structPointer_Interface(base, st)); isExtensionField(e, int32(tag)) { - if err = o.skip(st, tag, wire); err == nil { - extmap := e.extensionsWrite() - ext := extmap[int32(tag)] // may be missing - ext.enc = append(ext.enc, o.buf[oi:o.index]...) - extmap[int32(tag)] = ext - } - continue - } - } - // Maybe it's a oneof? - if prop.oneofUnmarshaler != nil { - m := structPointer_Interface(base, st).(Message) - // First return value indicates whether tag is a oneof field. - ok, err = prop.oneofUnmarshaler(m, tag, wire, o) - if err == ErrInternalBadWireType { - // Map the error to something more descriptive. - // Do the formatting here to save generated code space. - err = fmt.Errorf("bad wiretype for oneof field in %T", m) - } - if ok { - continue - } - } - err = o.skipAndSave(st, tag, wire, base, prop.unrecField) - continue - } - p := prop.Prop[fieldnum] - - if p.dec == nil { - fmt.Fprintf(os.Stderr, "proto: no protobuf decoder for %s.%s\n", st, st.Field(fieldnum).Name) - continue - } - dec := p.dec - if wire != WireStartGroup && wire != p.WireType { - if wire == WireBytes && p.packedDec != nil { - // a packable field - dec = p.packedDec - } else { - err = fmt.Errorf("proto: bad wiretype for field %s.%s: got wiretype %d, want %d", st, st.Field(fieldnum).Name, wire, p.WireType) - continue - } - } - decErr := dec(o, p, base) - if decErr != nil && !state.shouldContinue(decErr, p) { - err = decErr - } - if err == nil && p.Required { - // Successfully decoded a required field. - if tag <= 64 { - // use bitmap for fields 1-64 to catch field reuse. - var mask uint64 = 1 << uint64(tag-1) - if reqFields&mask == 0 { - // new required field - reqFields |= mask - required-- - } - } else { - // This is imprecise. It can be fooled by a required field - // with a tag > 64 that is encoded twice; that's very rare. - // A fully correct implementation would require allocating - // a data structure, which we would like to avoid. - required-- - } - } - } - if err == nil { - if is_group { - return io.ErrUnexpectedEOF - } - if state.err != nil { - return state.err - } - if required > 0 { - // Not enough information to determine the exact field. If we use extra - // CPU, we could determine the field only if the missing required field - // has a tag <= 64 and we check reqFields. - return &RequiredNotSetError{"{Unknown}"} - } - } - return err -} - -// Individual type decoders -// For each, -// u is the decoded value, -// v is a pointer to the field (pointer) in the struct - -// Sizes of the pools to allocate inside the Buffer. -// The goal is modest amortization and allocation -// on at least 16-byte boundaries. -const ( - boolPoolSize = 16 - uint32PoolSize = 8 - uint64PoolSize = 4 -) - -// Decode a bool. -func (o *Buffer) dec_bool(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - if len(o.bools) == 0 { - o.bools = make([]bool, boolPoolSize) - } - o.bools[0] = u != 0 - *structPointer_Bool(base, p.field) = &o.bools[0] - o.bools = o.bools[1:] - return nil -} - -func (o *Buffer) dec_proto3_bool(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - *structPointer_BoolVal(base, p.field) = u != 0 - return nil -} - -// Decode an int32. -func (o *Buffer) dec_int32(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word32_Set(structPointer_Word32(base, p.field), o, uint32(u)) - return nil -} - -func (o *Buffer) dec_proto3_int32(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word32Val_Set(structPointer_Word32Val(base, p.field), uint32(u)) - return nil -} - -// Decode an int64. -func (o *Buffer) dec_int64(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word64_Set(structPointer_Word64(base, p.field), o, u) - return nil -} - -func (o *Buffer) dec_proto3_int64(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - word64Val_Set(structPointer_Word64Val(base, p.field), o, u) - return nil -} - -// Decode a string. -func (o *Buffer) dec_string(p *Properties, base structPointer) error { - s, err := o.DecodeStringBytes() - if err != nil { - return err - } - *structPointer_String(base, p.field) = &s - return nil -} - -func (o *Buffer) dec_proto3_string(p *Properties, base structPointer) error { - s, err := o.DecodeStringBytes() - if err != nil { - return err - } - *structPointer_StringVal(base, p.field) = s - return nil -} - -// Decode a slice of bytes ([]byte). -func (o *Buffer) dec_slice_byte(p *Properties, base structPointer) error { - b, err := o.DecodeRawBytes(true) - if err != nil { - return err - } - *structPointer_Bytes(base, p.field) = b - return nil -} - -// Decode a slice of bools ([]bool). -func (o *Buffer) dec_slice_bool(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - v := structPointer_BoolSlice(base, p.field) - *v = append(*v, u != 0) - return nil -} - -// Decode a slice of bools ([]bool) in packed format. -func (o *Buffer) dec_slice_packed_bool(p *Properties, base structPointer) error { - v := structPointer_BoolSlice(base, p.field) - - nn, err := o.DecodeVarint() - if err != nil { - return err - } - nb := int(nn) // number of bytes of encoded bools - fin := o.index + nb - if fin < o.index { - return errOverflow - } - - y := *v - for o.index < fin { - u, err := p.valDec(o) - if err != nil { - return err - } - y = append(y, u != 0) - } - - *v = y - return nil -} - -// Decode a slice of int32s ([]int32). -func (o *Buffer) dec_slice_int32(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - structPointer_Word32Slice(base, p.field).Append(uint32(u)) - return nil -} - -// Decode a slice of int32s ([]int32) in packed format. -func (o *Buffer) dec_slice_packed_int32(p *Properties, base structPointer) error { - v := structPointer_Word32Slice(base, p.field) - - nn, err := o.DecodeVarint() - if err != nil { - return err - } - nb := int(nn) // number of bytes of encoded int32s - - fin := o.index + nb - if fin < o.index { - return errOverflow - } - for o.index < fin { - u, err := p.valDec(o) - if err != nil { - return err - } - v.Append(uint32(u)) - } - return nil -} - -// Decode a slice of int64s ([]int64). -func (o *Buffer) dec_slice_int64(p *Properties, base structPointer) error { - u, err := p.valDec(o) - if err != nil { - return err - } - - structPointer_Word64Slice(base, p.field).Append(u) - return nil -} - -// Decode a slice of int64s ([]int64) in packed format. -func (o *Buffer) dec_slice_packed_int64(p *Properties, base structPointer) error { - v := structPointer_Word64Slice(base, p.field) - - nn, err := o.DecodeVarint() - if err != nil { - return err - } - nb := int(nn) // number of bytes of encoded int64s - - fin := o.index + nb - if fin < o.index { - return errOverflow - } - for o.index < fin { - u, err := p.valDec(o) - if err != nil { - return err - } - v.Append(u) - } - return nil -} - -// Decode a slice of strings ([]string). -func (o *Buffer) dec_slice_string(p *Properties, base structPointer) error { - s, err := o.DecodeStringBytes() - if err != nil { - return err - } - v := structPointer_StringSlice(base, p.field) - *v = append(*v, s) - return nil -} - -// Decode a slice of slice of bytes ([][]byte). -func (o *Buffer) dec_slice_slice_byte(p *Properties, base structPointer) error { - b, err := o.DecodeRawBytes(true) - if err != nil { - return err - } - v := structPointer_BytesSlice(base, p.field) - *v = append(*v, b) - return nil -} - -// Decode a map field. -func (o *Buffer) dec_new_map(p *Properties, base structPointer) error { - raw, err := o.DecodeRawBytes(false) - if err != nil { - return err - } - oi := o.index // index at the end of this map entry - o.index -= len(raw) // move buffer back to start of map entry - - mptr := structPointer_NewAt(base, p.field, p.mtype) // *map[K]V - if mptr.Elem().IsNil() { - mptr.Elem().Set(reflect.MakeMap(mptr.Type().Elem())) - } - v := mptr.Elem() // map[K]V - - // Prepare addressable doubly-indirect placeholders for the key and value types. - // See enc_new_map for why. - keyptr := reflect.New(reflect.PtrTo(p.mtype.Key())).Elem() // addressable *K - keybase := toStructPointer(keyptr.Addr()) // **K - - var valbase structPointer - var valptr reflect.Value - switch p.mtype.Elem().Kind() { - case reflect.Slice: - // []byte - var dummy []byte - valptr = reflect.ValueOf(&dummy) // *[]byte - valbase = toStructPointer(valptr) // *[]byte - case reflect.Ptr: - // message; valptr is **Msg; need to allocate the intermediate pointer - valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V - valptr.Set(reflect.New(valptr.Type().Elem())) - valbase = toStructPointer(valptr) - default: - // everything else - valptr = reflect.New(reflect.PtrTo(p.mtype.Elem())).Elem() // addressable *V - valbase = toStructPointer(valptr.Addr()) // **V - } - - // Decode. - // This parses a restricted wire format, namely the encoding of a message - // with two fields. See enc_new_map for the format. - for o.index < oi { - // tagcode for key and value properties are always a single byte - // because they have tags 1 and 2. - tagcode := o.buf[o.index] - o.index++ - switch tagcode { - case p.mkeyprop.tagcode[0]: - if err := p.mkeyprop.dec(o, p.mkeyprop, keybase); err != nil { - return err - } - case p.mvalprop.tagcode[0]: - if err := p.mvalprop.dec(o, p.mvalprop, valbase); err != nil { - return err - } - default: - // TODO: Should we silently skip this instead? - return fmt.Errorf("proto: bad map data tag %d", raw[0]) - } - } - keyelem, valelem := keyptr.Elem(), valptr.Elem() - if !keyelem.IsValid() { - keyelem = reflect.Zero(p.mtype.Key()) - } - if !valelem.IsValid() { - valelem = reflect.Zero(p.mtype.Elem()) - } - - v.SetMapIndex(keyelem, valelem) - return nil -} - -// Decode a group. -func (o *Buffer) dec_struct_group(p *Properties, base structPointer) error { - bas := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(bas) { - // allocate new nested message - bas = toStructPointer(reflect.New(p.stype)) - structPointer_SetStructPointer(base, p.field, bas) - } - return o.unmarshalType(p.stype, p.sprop, true, bas) -} - -// Decode an embedded message. -func (o *Buffer) dec_struct_message(p *Properties, base structPointer) (err error) { - raw, e := o.DecodeRawBytes(false) - if e != nil { - return e - } - - bas := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(bas) { - // allocate new nested message - bas = toStructPointer(reflect.New(p.stype)) - structPointer_SetStructPointer(base, p.field, bas) - } - - // If the object can unmarshal itself, let it. - if p.isUnmarshaler { - iv := structPointer_Interface(bas, p.stype) - return iv.(Unmarshaler).Unmarshal(raw) - } - - obuf := o.buf - oi := o.index - o.buf = raw - o.index = 0 - - err = o.unmarshalType(p.stype, p.sprop, false, bas) - o.buf = obuf - o.index = oi - - return err -} - -// Decode a slice of embedded messages. -func (o *Buffer) dec_slice_struct_message(p *Properties, base structPointer) error { - return o.dec_slice_struct(p, false, base) -} - -// Decode a slice of embedded groups. -func (o *Buffer) dec_slice_struct_group(p *Properties, base structPointer) error { - return o.dec_slice_struct(p, true, base) -} - -// Decode a slice of structs ([]*struct). -func (o *Buffer) dec_slice_struct(p *Properties, is_group bool, base structPointer) error { - v := reflect.New(p.stype) - bas := toStructPointer(v) - structPointer_StructPointerSlice(base, p.field).Append(bas) - - if is_group { - err := o.unmarshalType(p.stype, p.sprop, is_group, bas) - return err - } - - raw, err := o.DecodeRawBytes(false) - if err != nil { + if u, ok := pb.(Unmarshaler); ok { + // NOTE: The history of proto have unfortunately been inconsistent + // whether Unmarshaler should or should not implicitly clear itself. + // Some implementations do, most do not. + // Thus, calling this here may or may not do what people want. + // + // See https://github.com/golang/protobuf/issues/424 + err := u.Unmarshal(p.buf[p.index:]) + p.index = len(p.buf) return err } - // If the object can unmarshal itself, let it. - if p.isUnmarshaler { - iv := v.Interface() - return iv.(Unmarshaler).Unmarshal(raw) - } - - obuf := o.buf - oi := o.index - o.buf = raw - o.index = 0 - - err = o.unmarshalType(p.stype, p.sprop, is_group, bas) - - o.buf = obuf - o.index = oi - + // Slow workaround for messages that aren't Unmarshalers. + // This includes some hand-coded .pb.go files and + // bootstrap protos. + // TODO: fix all of those and then add Unmarshal to + // the Message interface. Then: + // The cast above and code below can be deleted. + // The old unmarshaler can be deleted. + // Clients can call Unmarshal directly (can already do that, actually). + var info InternalMessageInfo + err := info.Unmarshal(pb, p.buf[p.index:]) + p.index = len(p.buf) return err } diff --git a/vendor/github.com/gogo/protobuf/proto/decode_gogo.go b/vendor/github.com/gogo/protobuf/proto/decode_gogo.go deleted file mode 100644 index 6fb74de4cc94..000000000000 --- a/vendor/github.com/gogo/protobuf/proto/decode_gogo.go +++ /dev/null @@ -1,172 +0,0 @@ -// Protocol Buffers for Go with Gadgets -// -// Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/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. -// -// 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 ( - "reflect" -) - -// Decode a reference to a struct pointer. -func (o *Buffer) dec_ref_struct_message(p *Properties, base structPointer) (err error) { - raw, e := o.DecodeRawBytes(false) - if e != nil { - return e - } - - // If the object can unmarshal itself, let it. - if p.isUnmarshaler { - panic("not supported, since this is a pointer receiver") - } - - obuf := o.buf - oi := o.index - o.buf = raw - o.index = 0 - - bas := structPointer_FieldPointer(base, p.field) - - err = o.unmarshalType(p.stype, p.sprop, false, bas) - o.buf = obuf - o.index = oi - - return err -} - -// Decode a slice of references to struct pointers ([]struct). -func (o *Buffer) dec_slice_ref_struct(p *Properties, is_group bool, base structPointer) error { - newBas := appendStructPointer(base, p.field, p.sstype) - - if is_group { - panic("not supported, maybe in future, if requested.") - } - - raw, err := o.DecodeRawBytes(false) - if err != nil { - return err - } - - // If the object can unmarshal itself, let it. - if p.isUnmarshaler { - panic("not supported, since this is not a pointer receiver.") - } - - obuf := o.buf - oi := o.index - o.buf = raw - o.index = 0 - - err = o.unmarshalType(p.stype, p.sprop, is_group, newBas) - - o.buf = obuf - o.index = oi - - return err -} - -// Decode a slice of references to struct pointers. -func (o *Buffer) dec_slice_ref_struct_message(p *Properties, base structPointer) error { - return o.dec_slice_ref_struct(p, false, base) -} - -func setPtrCustomType(base structPointer, f field, v interface{}) { - if v == nil { - return - } - structPointer_SetStructPointer(base, f, toStructPointer(reflect.ValueOf(v))) -} - -func setCustomType(base structPointer, f field, value interface{}) { - if value == nil { - return - } - v := reflect.ValueOf(value).Elem() - t := reflect.TypeOf(value).Elem() - kind := t.Kind() - switch kind { - case reflect.Slice: - slice := reflect.MakeSlice(t, v.Len(), v.Cap()) - reflect.Copy(slice, v) - oldHeader := structPointer_GetSliceHeader(base, f) - oldHeader.Data = slice.Pointer() - oldHeader.Len = v.Len() - oldHeader.Cap = v.Cap() - default: - size := reflect.TypeOf(value).Elem().Size() - structPointer_Copy(toStructPointer(reflect.ValueOf(value)), structPointer_Add(base, f), int(size)) - } -} - -func (o *Buffer) dec_custom_bytes(p *Properties, base structPointer) error { - b, err := o.DecodeRawBytes(true) - if err != nil { - return err - } - i := reflect.New(p.ctype.Elem()).Interface() - custom := (i).(Unmarshaler) - if err := custom.Unmarshal(b); err != nil { - return err - } - setPtrCustomType(base, p.field, custom) - return nil -} - -func (o *Buffer) dec_custom_ref_bytes(p *Properties, base structPointer) error { - b, err := o.DecodeRawBytes(true) - if err != nil { - return err - } - i := reflect.New(p.ctype).Interface() - custom := (i).(Unmarshaler) - if err := custom.Unmarshal(b); err != nil { - return err - } - if custom != nil { - setCustomType(base, p.field, custom) - } - return nil -} - -// Decode a slice of bytes ([]byte) into a slice of custom types. -func (o *Buffer) dec_custom_slice_bytes(p *Properties, base structPointer) error { - b, err := o.DecodeRawBytes(true) - if err != nil { - return err - } - i := reflect.New(p.ctype.Elem()).Interface() - custom := (i).(Unmarshaler) - if err := custom.Unmarshal(b); err != nil { - return err - } - newBas := appendStructPointer(base, p.field, p.ctype) - - var zero field - setCustomType(newBas, zero, custom) - - return nil -} diff --git a/vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/deprecated.go b/vendor/github.com/gogo/protobuf/proto/deprecated.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/deprecated.go rename to vendor/github.com/gogo/protobuf/proto/deprecated.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/discard.go b/vendor/github.com/gogo/protobuf/proto/discard.go similarity index 98% rename from vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/discard.go rename to vendor/github.com/gogo/protobuf/proto/discard.go index dea2617ced34..fe1bd7d904e2 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/discard.go +++ b/vendor/github.com/gogo/protobuf/proto/discard.go @@ -175,21 +175,21 @@ func (di *discardInfo) computeDiscardInfo() { case !isPointer: panic(fmt.Sprintf("%v.%s cannot be a direct struct value", t, f.Name)) case isSlice: // E.g., []*pb.T - di := getDiscardInfo(tf) + discardInfo := getDiscardInfo(tf) dfi.discard = func(src pointer) { sps := src.getPointerSlice() for _, sp := range sps { if !sp.isNil() { - di.discard(sp) + discardInfo.discard(sp) } } } default: // E.g., *pb.T - di := getDiscardInfo(tf) + discardInfo := getDiscardInfo(tf) dfi.discard = func(src pointer) { sp := src.getPointer() if !sp.isNil() { - di.discard(sp) + discardInfo.discard(sp) } } } diff --git a/vendor/github.com/gogo/protobuf/proto/duration_gogo.go b/vendor/github.com/gogo/protobuf/proto/duration_gogo.go index 18e2a5f77654..e748e1730e1c 100644 --- a/vendor/github.com/gogo/protobuf/proto/duration_gogo.go +++ b/vendor/github.com/gogo/protobuf/proto/duration_gogo.go @@ -47,157 +47,3 @@ func (*duration) String() string { return "duration" } func init() { RegisterType((*duration)(nil), "gogo.protobuf.proto.duration") } - -func (o *Buffer) decDuration() (time.Duration, error) { - b, err := o.DecodeRawBytes(true) - if err != nil { - return 0, err - } - dproto := &duration{} - if err := Unmarshal(b, dproto); err != nil { - return 0, err - } - return durationFromProto(dproto) -} - -func (o *Buffer) dec_duration(p *Properties, base structPointer) error { - d, err := o.decDuration() - if err != nil { - return err - } - word64_Set(structPointer_Word64(base, p.field), o, uint64(d)) - return nil -} - -func (o *Buffer) dec_ref_duration(p *Properties, base structPointer) error { - d, err := o.decDuration() - if err != nil { - return err - } - word64Val_Set(structPointer_Word64Val(base, p.field), o, uint64(d)) - return nil -} - -func (o *Buffer) dec_slice_duration(p *Properties, base structPointer) error { - d, err := o.decDuration() - if err != nil { - return err - } - newBas := appendStructPointer(base, p.field, reflect.SliceOf(reflect.PtrTo(durationType))) - var zero field - setPtrCustomType(newBas, zero, &d) - return nil -} - -func (o *Buffer) dec_slice_ref_duration(p *Properties, base structPointer) error { - d, err := o.decDuration() - if err != nil { - return err - } - structPointer_Word64Slice(base, p.field).Append(uint64(d)) - return nil -} - -func size_duration(p *Properties, base structPointer) (n int) { - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return 0 - } - dur := structPointer_Interface(structp, durationType).(*time.Duration) - d := durationProto(*dur) - size := Size(d) - return size + sizeVarint(uint64(size)) + len(p.tagcode) -} - -func (o *Buffer) enc_duration(p *Properties, base structPointer) error { - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return ErrNil - } - dur := structPointer_Interface(structp, durationType).(*time.Duration) - d := durationProto(*dur) - data, err := Marshal(d) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return nil -} - -func size_ref_duration(p *Properties, base structPointer) (n int) { - dur := structPointer_InterfaceAt(base, p.field, durationType).(*time.Duration) - d := durationProto(*dur) - size := Size(d) - return size + sizeVarint(uint64(size)) + len(p.tagcode) -} - -func (o *Buffer) enc_ref_duration(p *Properties, base structPointer) error { - dur := structPointer_InterfaceAt(base, p.field, durationType).(*time.Duration) - d := durationProto(*dur) - data, err := Marshal(d) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return nil -} - -func size_slice_duration(p *Properties, base structPointer) (n int) { - pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(reflect.PtrTo(durationType))).(*[]*time.Duration) - durs := *pdurs - for i := 0; i < len(durs); i++ { - if durs[i] == nil { - return 0 - } - dproto := durationProto(*durs[i]) - size := Size(dproto) - n += len(p.tagcode) + size + sizeVarint(uint64(size)) - } - return n -} - -func (o *Buffer) enc_slice_duration(p *Properties, base structPointer) error { - pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(reflect.PtrTo(durationType))).(*[]*time.Duration) - durs := *pdurs - for i := 0; i < len(durs); i++ { - if durs[i] == nil { - return errRepeatedHasNil - } - dproto := durationProto(*durs[i]) - data, err := Marshal(dproto) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - } - return nil -} - -func size_slice_ref_duration(p *Properties, base structPointer) (n int) { - pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(durationType)).(*[]time.Duration) - durs := *pdurs - for i := 0; i < len(durs); i++ { - dproto := durationProto(durs[i]) - size := Size(dproto) - n += len(p.tagcode) + size + sizeVarint(uint64(size)) - } - return n -} - -func (o *Buffer) enc_slice_ref_duration(p *Properties, base structPointer) error { - pdurs := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(durationType)).(*[]time.Duration) - durs := *pdurs - for i := 0; i < len(durs); i++ { - dproto := durationProto(durs[i]) - data, err := Marshal(dproto) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - } - return nil -} diff --git a/vendor/github.com/gogo/protobuf/proto/encode.go b/vendor/github.com/gogo/protobuf/proto/encode.go index 8b84d1b22d4c..9581ccd3042f 100644 --- a/vendor/github.com/gogo/protobuf/proto/encode.go +++ b/vendor/github.com/gogo/protobuf/proto/encode.go @@ -37,28 +37,9 @@ package proto import ( "errors" - "fmt" "reflect" - "sort" ) -// RequiredNotSetError is the error returned if Marshal is called with -// a protocol buffer struct whose required fields have not -// all been initialized. It is also the error returned if Unmarshal is -// called with an encoded protocol buffer that does not include all the -// required fields. -// -// When printed, RequiredNotSetError reports the first unset required field in a -// message. If the field cannot be precisely determined, it is reported as -// "{Unknown}". -type RequiredNotSetError struct { - field string -} - -func (e *RequiredNotSetError) Error() string { - return fmt.Sprintf("proto: required field %q not set", e.field) -} - var ( // errRepeatedHasNil is the error returned if Marshal is called with // a struct with a repeated field containing a nil element. @@ -82,10 +63,6 @@ var ( const maxVarintBytes = 10 // maximum length of a varint -// maxMarshalSize is the largest allowed size of an encoded protobuf, -// since C++ and Java use signed int32s for the size. -const maxMarshalSize = 1<<31 - 1 - // EncodeVarint returns the varint encoding of x. // This is the format for the // int32, int64, uint32, uint64, bool, and enum @@ -119,18 +96,27 @@ func (p *Buffer) EncodeVarint(x uint64) error { // SizeVarint returns the varint encoding size of an integer. func SizeVarint(x uint64) int { - return sizeVarint(x) -} - -func sizeVarint(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + switch { + case x < 1<<7: + return 1 + case x < 1<<14: + return 2 + case x < 1<<21: + return 3 + case x < 1<<28: + return 4 + case x < 1<<35: + return 5 + case x < 1<<42: + return 6 + case x < 1<<49: + return 7 + case x < 1<<56: + return 8 + case x < 1<<63: + return 9 + } + return 10 } // EncodeFixed64 writes a 64-bit integer to the Buffer. @@ -149,10 +135,6 @@ func (p *Buffer) EncodeFixed64(x uint64) error { return nil } -func sizeFixed64(x uint64) int { - return 8 -} - // EncodeFixed32 writes a 32-bit integer to the Buffer. // This is the format for the // fixed32, sfixed32, and float protocol buffer types. @@ -165,20 +147,12 @@ func (p *Buffer) EncodeFixed32(x uint64) error { return nil } -func sizeFixed32(x uint64) int { - return 4 -} - // EncodeZigzag64 writes a zigzag-encoded 64-bit integer // to the Buffer. // This is the format used for the sint64 protocol buffer type. func (p *Buffer) EncodeZigzag64(x uint64) error { // use signed number to get arithmetic right shift. - return p.EncodeVarint((x << 1) ^ uint64((int64(x) >> 63))) -} - -func sizeZigzag64(x uint64) int { - return sizeVarint((x << 1) ^ uint64((int64(x) >> 63))) + return p.EncodeVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } // EncodeZigzag32 writes a zigzag-encoded 32-bit integer @@ -189,10 +163,6 @@ func (p *Buffer) EncodeZigzag32(x uint64) error { return p.EncodeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) } -func sizeZigzag32(x uint64) int { - return sizeVarint(uint64((uint32(x) << 1) ^ uint32((int32(x) >> 31)))) -} - // EncodeRawBytes writes a count-delimited byte buffer to the Buffer. // This is the format used for the bytes protocol buffer // type and for embedded messages. @@ -202,11 +172,6 @@ func (p *Buffer) EncodeRawBytes(b []byte) error { return nil } -func sizeRawBytes(b []byte) int { - return sizeVarint(uint64(len(b))) + - len(b) -} - // EncodeStringBytes writes an encoded string to the Buffer. // This is the format used for the proto2 string type. func (p *Buffer) EncodeStringBytes(s string) error { @@ -215,319 +180,19 @@ func (p *Buffer) EncodeStringBytes(s string) error { return nil } -func sizeStringBytes(s string) int { - return sizeVarint(uint64(len(s))) + - len(s) -} - // Marshaler is the interface representing objects that can marshal themselves. type Marshaler interface { Marshal() ([]byte, error) } -// Marshal takes the protocol buffer -// and encodes it into the wire format, returning the data. -func Marshal(pb Message) ([]byte, error) { - // Can the object marshal itself? - if m, ok := pb.(Marshaler); ok { - return m.Marshal() - } - p := NewBuffer(nil) - err := p.Marshal(pb) - if p.buf == nil && err == nil { - // Return a non-nil slice on success. - return []byte{}, nil - } - return p.buf, err -} - // EncodeMessage writes the protocol buffer to the Buffer, // prefixed by a varint-encoded length. func (p *Buffer) EncodeMessage(pb Message) error { - t, base, err := getbase(pb) - if structPointer_IsNil(base) { - return ErrNil - } - if err == nil { - var state errorState - err = p.enc_len_struct(GetProperties(t.Elem()), base, &state) - } - return err -} - -// Marshal takes the protocol buffer -// and encodes it into the wire format, writing the result to the -// Buffer. -func (p *Buffer) Marshal(pb Message) error { - // Can the object marshal itself? - if m, ok := pb.(Marshaler); ok { - data, err := m.Marshal() - p.buf = append(p.buf, data...) - return err - } - - t, base, err := getbase(pb) - if structPointer_IsNil(base) { - return ErrNil - } - if err == nil { - err = p.enc_struct(GetProperties(t.Elem()), base) - } - - if collectStats { - (stats).Encode++ // Parens are to work around a goimports bug. - } - - if len(p.buf) > maxMarshalSize { - return ErrTooLarge - } - return err -} - -// Size returns the encoded size of a protocol buffer. -func Size(pb Message) (n int) { - // Can the object marshal itself? If so, Size is slow. - // TODO: add Size to Marshaler, or add a Sizer interface. - if m, ok := pb.(Marshaler); ok { - b, _ := m.Marshal() - return len(b) - } - - t, base, err := getbase(pb) - if structPointer_IsNil(base) { - return 0 - } - if err == nil { - n = size_struct(GetProperties(t.Elem()), base) - } - - if collectStats { - (stats).Size++ // Parens are to work around a goimports bug. - } - - return -} - -// Individual type encoders. - -// Encode a bool. -func (o *Buffer) enc_bool(p *Properties, base structPointer) error { - v := *structPointer_Bool(base, p.field) - if v == nil { - return ErrNil - } - x := 0 - if *v { - x = 1 - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func (o *Buffer) enc_proto3_bool(p *Properties, base structPointer) error { - v := *structPointer_BoolVal(base, p.field) - if !v { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, 1) - return nil -} - -func size_bool(p *Properties, base structPointer) int { - v := *structPointer_Bool(base, p.field) - if v == nil { - return 0 - } - return len(p.tagcode) + 1 // each bool takes exactly one byte -} - -func size_proto3_bool(p *Properties, base structPointer) int { - v := *structPointer_BoolVal(base, p.field) - if !v && !p.oneof { - return 0 - } - return len(p.tagcode) + 1 // each bool takes exactly one byte -} - -// Encode an int32. -func (o *Buffer) enc_int32(p *Properties, base structPointer) error { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return ErrNil - } - x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func (o *Buffer) enc_proto3_int32(p *Properties, base structPointer) error { - v := structPointer_Word32Val(base, p.field) - x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range - if x == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func size_int32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return 0 - } - x := int32(word32_Get(v)) // permit sign extension to use full 64-bit range - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -func size_proto3_int32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32Val(base, p.field) - x := int32(word32Val_Get(v)) // permit sign extension to use full 64-bit range - if x == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -// Encode a uint32. -// Exactly the same as int32, except for no sign extension. -func (o *Buffer) enc_uint32(p *Properties, base structPointer) error { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return ErrNil - } - x := word32_Get(v) - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func (o *Buffer) enc_proto3_uint32(p *Properties, base structPointer) error { - v := structPointer_Word32Val(base, p.field) - x := word32Val_Get(v) - if x == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func size_uint32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32(base, p.field) - if word32_IsNil(v) { - return 0 - } - x := word32_Get(v) - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -func size_proto3_uint32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32Val(base, p.field) - x := word32Val_Get(v) - if x == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -// Encode an int64. -func (o *Buffer) enc_int64(p *Properties, base structPointer) error { - v := structPointer_Word64(base, p.field) - if word64_IsNil(v) { - return ErrNil - } - x := word64_Get(v) - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, x) - return nil -} - -func (o *Buffer) enc_proto3_int64(p *Properties, base structPointer) error { - v := structPointer_Word64Val(base, p.field) - x := word64Val_Get(v) - if x == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, x) - return nil -} - -func size_int64(p *Properties, base structPointer) (n int) { - v := structPointer_Word64(base, p.field) - if word64_IsNil(v) { - return 0 - } - x := word64_Get(v) - n += len(p.tagcode) - n += p.valSize(x) - return -} - -func size_proto3_int64(p *Properties, base structPointer) (n int) { - v := structPointer_Word64Val(base, p.field) - x := word64Val_Get(v) - if x == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += p.valSize(x) - return -} - -// Encode a string. -func (o *Buffer) enc_string(p *Properties, base structPointer) error { - v := *structPointer_String(base, p.field) - if v == nil { - return ErrNil - } - x := *v - o.buf = append(o.buf, p.tagcode...) - o.EncodeStringBytes(x) - return nil -} - -func (o *Buffer) enc_proto3_string(p *Properties, base structPointer) error { - v := *structPointer_StringVal(base, p.field) - if v == "" { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeStringBytes(v) - return nil -} - -func size_string(p *Properties, base structPointer) (n int) { - v := *structPointer_String(base, p.field) - if v == nil { - return 0 - } - x := *v - n += len(p.tagcode) - n += sizeStringBytes(x) - return -} - -func size_proto3_string(p *Properties, base structPointer) (n int) { - v := *structPointer_StringVal(base, p.field) - if v == "" && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += sizeStringBytes(v) - return + siz := Size(pb) + sizVar := SizeVarint(uint64(siz)) + p.grow(siz + sizVar) + p.EncodeVarint(uint64(siz)) + return p.Marshal(pb) } // All protocol buffer fields are nillable, but be careful. @@ -538,825 +203,3 @@ func isNil(v reflect.Value) bool { } return false } - -// Encode a message struct. -func (o *Buffer) enc_struct_message(p *Properties, base structPointer) error { - var state errorState - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return ErrNil - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, err := m.Marshal() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return state.err - } - - o.buf = append(o.buf, p.tagcode...) - return o.enc_len_struct(p.sprop, structp, &state) -} - -func size_struct_message(p *Properties, base structPointer) int { - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return 0 - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, _ := m.Marshal() - n0 := len(p.tagcode) - n1 := sizeRawBytes(data) - return n0 + n1 - } - - n0 := len(p.tagcode) - n1 := size_struct(p.sprop, structp) - n2 := sizeVarint(uint64(n1)) // size of encoded length - return n0 + n1 + n2 -} - -// Encode a group struct. -func (o *Buffer) enc_struct_group(p *Properties, base structPointer) error { - var state errorState - b := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(b) { - return ErrNil - } - - o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup)) - err := o.enc_struct(p.sprop, b) - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup)) - return state.err -} - -func size_struct_group(p *Properties, base structPointer) (n int) { - b := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(b) { - return 0 - } - - n += sizeVarint(uint64((p.Tag << 3) | WireStartGroup)) - n += size_struct(p.sprop, b) - n += sizeVarint(uint64((p.Tag << 3) | WireEndGroup)) - return -} - -// Encode a slice of bools ([]bool). -func (o *Buffer) enc_slice_bool(p *Properties, base structPointer) error { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return ErrNil - } - for _, x := range s { - o.buf = append(o.buf, p.tagcode...) - v := uint64(0) - if x { - v = 1 - } - p.valEnc(o, v) - } - return nil -} - -func size_slice_bool(p *Properties, base structPointer) int { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return 0 - } - return l * (len(p.tagcode) + 1) // each bool takes exactly one byte -} - -// Encode a slice of bools ([]bool) in packed format. -func (o *Buffer) enc_slice_packed_bool(p *Properties, base structPointer) error { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(l)) // each bool takes exactly one byte - for _, x := range s { - v := uint64(0) - if x { - v = 1 - } - p.valEnc(o, v) - } - return nil -} - -func size_slice_packed_bool(p *Properties, base structPointer) (n int) { - s := *structPointer_BoolSlice(base, p.field) - l := len(s) - if l == 0 { - return 0 - } - n += len(p.tagcode) - n += sizeVarint(uint64(l)) - n += l // each bool takes exactly one byte - return -} - -// Encode a slice of bytes ([]byte). -func (o *Buffer) enc_slice_byte(p *Properties, base structPointer) error { - s := *structPointer_Bytes(base, p.field) - if s == nil { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(s) - return nil -} - -func (o *Buffer) enc_proto3_slice_byte(p *Properties, base structPointer) error { - s := *structPointer_Bytes(base, p.field) - if len(s) == 0 { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(s) - return nil -} - -func size_slice_byte(p *Properties, base structPointer) (n int) { - s := *structPointer_Bytes(base, p.field) - if s == nil && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += sizeRawBytes(s) - return -} - -func size_proto3_slice_byte(p *Properties, base structPointer) (n int) { - s := *structPointer_Bytes(base, p.field) - if len(s) == 0 && !p.oneof { - return 0 - } - n += len(p.tagcode) - n += sizeRawBytes(s) - return -} - -// Encode a slice of int32s ([]int32). -func (o *Buffer) enc_slice_int32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - p.valEnc(o, uint64(x)) - } - return nil -} - -func size_slice_int32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - for i := 0; i < l; i++ { - n += len(p.tagcode) - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - n += p.valSize(uint64(x)) - } - return -} - -// Encode a slice of int32s ([]int32) in packed format. -func (o *Buffer) enc_slice_packed_int32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - // TODO: Reuse a Buffer. - buf := NewBuffer(nil) - for i := 0; i < l; i++ { - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - p.valEnc(buf, uint64(x)) - } - - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(len(buf.buf))) - o.buf = append(o.buf, buf.buf...) - return nil -} - -func size_slice_packed_int32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - var bufSize int - for i := 0; i < l; i++ { - x := int32(s.Index(i)) // permit sign extension to use full 64-bit range - bufSize += p.valSize(uint64(x)) - } - - n += len(p.tagcode) - n += sizeVarint(uint64(bufSize)) - n += bufSize - return -} - -// Encode a slice of uint32s ([]uint32). -// Exactly the same as int32, except for no sign extension. -func (o *Buffer) enc_slice_uint32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - x := s.Index(i) - p.valEnc(o, uint64(x)) - } - return nil -} - -func size_slice_uint32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - for i := 0; i < l; i++ { - n += len(p.tagcode) - x := s.Index(i) - n += p.valSize(uint64(x)) - } - return -} - -// Encode a slice of uint32s ([]uint32) in packed format. -// Exactly the same as int32, except for no sign extension. -func (o *Buffer) enc_slice_packed_uint32(p *Properties, base structPointer) error { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - // TODO: Reuse a Buffer. - buf := NewBuffer(nil) - for i := 0; i < l; i++ { - p.valEnc(buf, uint64(s.Index(i))) - } - - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(len(buf.buf))) - o.buf = append(o.buf, buf.buf...) - return nil -} - -func size_slice_packed_uint32(p *Properties, base structPointer) (n int) { - s := structPointer_Word32Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - var bufSize int - for i := 0; i < l; i++ { - bufSize += p.valSize(uint64(s.Index(i))) - } - - n += len(p.tagcode) - n += sizeVarint(uint64(bufSize)) - n += bufSize - return -} - -// Encode a slice of int64s ([]int64). -func (o *Buffer) enc_slice_int64(p *Properties, base structPointer) error { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, s.Index(i)) - } - return nil -} - -func size_slice_int64(p *Properties, base structPointer) (n int) { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - for i := 0; i < l; i++ { - n += len(p.tagcode) - n += p.valSize(s.Index(i)) - } - return -} - -// Encode a slice of int64s ([]int64) in packed format. -func (o *Buffer) enc_slice_packed_int64(p *Properties, base structPointer) error { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return ErrNil - } - // TODO: Reuse a Buffer. - buf := NewBuffer(nil) - for i := 0; i < l; i++ { - p.valEnc(buf, s.Index(i)) - } - - o.buf = append(o.buf, p.tagcode...) - o.EncodeVarint(uint64(len(buf.buf))) - o.buf = append(o.buf, buf.buf...) - return nil -} - -func size_slice_packed_int64(p *Properties, base structPointer) (n int) { - s := structPointer_Word64Slice(base, p.field) - l := s.Len() - if l == 0 { - return 0 - } - var bufSize int - for i := 0; i < l; i++ { - bufSize += p.valSize(s.Index(i)) - } - - n += len(p.tagcode) - n += sizeVarint(uint64(bufSize)) - n += bufSize - return -} - -// Encode a slice of slice of bytes ([][]byte). -func (o *Buffer) enc_slice_slice_byte(p *Properties, base structPointer) error { - ss := *structPointer_BytesSlice(base, p.field) - l := len(ss) - if l == 0 { - return ErrNil - } - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(ss[i]) - } - return nil -} - -func size_slice_slice_byte(p *Properties, base structPointer) (n int) { - ss := *structPointer_BytesSlice(base, p.field) - l := len(ss) - if l == 0 { - return 0 - } - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - n += sizeRawBytes(ss[i]) - } - return -} - -// Encode a slice of strings ([]string). -func (o *Buffer) enc_slice_string(p *Properties, base structPointer) error { - ss := *structPointer_StringSlice(base, p.field) - l := len(ss) - for i := 0; i < l; i++ { - o.buf = append(o.buf, p.tagcode...) - o.EncodeStringBytes(ss[i]) - } - return nil -} - -func size_slice_string(p *Properties, base structPointer) (n int) { - ss := *structPointer_StringSlice(base, p.field) - l := len(ss) - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - n += sizeStringBytes(ss[i]) - } - return -} - -// Encode a slice of message structs ([]*struct). -func (o *Buffer) enc_slice_struct_message(p *Properties, base structPointer) error { - var state errorState - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - - for i := 0; i < l; i++ { - structp := s.Index(i) - if structPointer_IsNil(structp) { - return errRepeatedHasNil - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, err := m.Marshal() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - continue - } - - o.buf = append(o.buf, p.tagcode...) - err := o.enc_len_struct(p.sprop, structp, &state) - if err != nil && !state.shouldContinue(err, nil) { - if err == ErrNil { - return errRepeatedHasNil - } - return err - } - } - return state.err -} - -func size_slice_struct_message(p *Properties, base structPointer) (n int) { - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - structp := s.Index(i) - if structPointer_IsNil(structp) { - return // return the size up to this point - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, _ := m.Marshal() - n += sizeRawBytes(data) - continue - } - - n0 := size_struct(p.sprop, structp) - n1 := sizeVarint(uint64(n0)) // size of encoded length - n += n0 + n1 - } - return -} - -// Encode a slice of group structs ([]*struct). -func (o *Buffer) enc_slice_struct_group(p *Properties, base structPointer) error { - var state errorState - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - - for i := 0; i < l; i++ { - b := s.Index(i) - if structPointer_IsNil(b) { - return errRepeatedHasNil - } - - o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup)) - - err := o.enc_struct(p.sprop, b) - - if err != nil && !state.shouldContinue(err, nil) { - if err == ErrNil { - return errRepeatedHasNil - } - return err - } - - o.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup)) - } - return state.err -} - -func size_slice_struct_group(p *Properties, base structPointer) (n int) { - s := structPointer_StructPointerSlice(base, p.field) - l := s.Len() - - n += l * sizeVarint(uint64((p.Tag<<3)|WireStartGroup)) - n += l * sizeVarint(uint64((p.Tag<<3)|WireEndGroup)) - for i := 0; i < l; i++ { - b := s.Index(i) - if structPointer_IsNil(b) { - return // return size up to this point - } - - n += size_struct(p.sprop, b) - } - return -} - -// Encode an extension map. -func (o *Buffer) enc_map(p *Properties, base structPointer) error { - exts := structPointer_ExtMap(base, p.field) - if err := encodeExtensionsMap(*exts); err != nil { - return err - } - - return o.enc_map_body(*exts) -} - -func (o *Buffer) enc_exts(p *Properties, base structPointer) error { - exts := structPointer_Extensions(base, p.field) - - v, mu := exts.extensionsRead() - if v == nil { - return nil - } - - mu.Lock() - defer mu.Unlock() - if err := encodeExtensionsMap(v); err != nil { - return err - } - - return o.enc_map_body(v) -} - -func (o *Buffer) enc_map_body(v map[int32]Extension) error { - // Fast-path for common cases: zero or one extensions. - if len(v) <= 1 { - for _, e := range v { - o.buf = append(o.buf, e.enc...) - } - return nil - } - - // Sort keys to provide a deterministic encoding. - keys := make([]int, 0, len(v)) - for k := range v { - keys = append(keys, int(k)) - } - sort.Ints(keys) - - for _, k := range keys { - o.buf = append(o.buf, v[int32(k)].enc...) - } - return nil -} - -func size_map(p *Properties, base structPointer) int { - v := structPointer_ExtMap(base, p.field) - return extensionsMapSize(*v) -} - -func size_exts(p *Properties, base structPointer) int { - v := structPointer_Extensions(base, p.field) - return extensionsSize(v) -} - -// Encode a map field. -func (o *Buffer) enc_new_map(p *Properties, base structPointer) error { - var state errorState // XXX: or do we need to plumb this through? - - /* - A map defined as - map map_field = N; - is encoded in the same way as - message MapFieldEntry { - key_type key = 1; - value_type value = 2; - } - repeated MapFieldEntry map_field = N; - */ - - v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V - if v.Len() == 0 { - return nil - } - - keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype) - - enc := func() error { - if err := p.mkeyprop.enc(o, p.mkeyprop, keybase); err != nil { - return err - } - if err := p.mvalprop.enc(o, p.mvalprop, valbase); err != nil && err != ErrNil { - return err - } - return nil - } - - // Don't sort map keys. It is not required by the spec, and C++ doesn't do it. - for _, key := range v.MapKeys() { - val := v.MapIndex(key) - - keycopy.Set(key) - valcopy.Set(val) - - o.buf = append(o.buf, p.tagcode...) - if err := o.enc_len_thing(enc, &state); err != nil { - return err - } - } - return nil -} - -func size_new_map(p *Properties, base structPointer) int { - v := structPointer_NewAt(base, p.field, p.mtype).Elem() // map[K]V - - keycopy, valcopy, keybase, valbase := mapEncodeScratch(p.mtype) - - n := 0 - for _, key := range v.MapKeys() { - val := v.MapIndex(key) - keycopy.Set(key) - valcopy.Set(val) - - // Tag codes for key and val are the responsibility of the sub-sizer. - keysize := p.mkeyprop.size(p.mkeyprop, keybase) - valsize := p.mvalprop.size(p.mvalprop, valbase) - entry := keysize + valsize - // Add on tag code and length of map entry itself. - n += len(p.tagcode) + sizeVarint(uint64(entry)) + entry - } - return n -} - -// mapEncodeScratch returns a new reflect.Value matching the map's value type, -// and a structPointer suitable for passing to an encoder or sizer. -func mapEncodeScratch(mapType reflect.Type) (keycopy, valcopy reflect.Value, keybase, valbase structPointer) { - // Prepare addressable doubly-indirect placeholders for the key and value types. - // This is needed because the element-type encoders expect **T, but the map iteration produces T. - - keycopy = reflect.New(mapType.Key()).Elem() // addressable K - keyptr := reflect.New(reflect.PtrTo(keycopy.Type())).Elem() // addressable *K - keyptr.Set(keycopy.Addr()) // - keybase = toStructPointer(keyptr.Addr()) // **K - - // Value types are more varied and require special handling. - switch mapType.Elem().Kind() { - case reflect.Slice: - // []byte - var dummy []byte - valcopy = reflect.ValueOf(&dummy).Elem() // addressable []byte - valbase = toStructPointer(valcopy.Addr()) - case reflect.Ptr: - // message; the generated field type is map[K]*Msg (so V is *Msg), - // so we only need one level of indirection. - valcopy = reflect.New(mapType.Elem()).Elem() // addressable V - valbase = toStructPointer(valcopy.Addr()) - default: - // everything else - valcopy = reflect.New(mapType.Elem()).Elem() // addressable V - valptr := reflect.New(reflect.PtrTo(valcopy.Type())).Elem() // addressable *V - valptr.Set(valcopy.Addr()) // - valbase = toStructPointer(valptr.Addr()) // **V - } - return -} - -// Encode a struct. -func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error { - var state errorState - // Encode fields in tag order so that decoders may use optimizations - // that depend on the ordering. - // https://developers.google.com/protocol-buffers/docs/encoding#order - for _, i := range prop.order { - p := prop.Prop[i] - if p.enc != nil { - err := p.enc(o, p, base) - if err != nil { - if err == ErrNil { - if p.Required && state.err == nil { - state.err = &RequiredNotSetError{p.Name} - } - } else if err == errRepeatedHasNil { - // Give more context to nil values in repeated fields. - return errors.New("repeated field " + p.OrigName + " has nil element") - } else if !state.shouldContinue(err, p) { - return err - } - } - if len(o.buf) > maxMarshalSize { - return ErrTooLarge - } - } - } - - // Do oneof fields. - if prop.oneofMarshaler != nil { - m := structPointer_Interface(base, prop.stype).(Message) - if err := prop.oneofMarshaler(m, o); err == ErrNil { - return errOneofHasNil - } else if err != nil { - return err - } - } - - // Add unrecognized fields at the end. - if prop.unrecField.IsValid() { - v := *structPointer_Bytes(base, prop.unrecField) - if len(o.buf)+len(v) > maxMarshalSize { - return ErrTooLarge - } - if len(v) > 0 { - o.buf = append(o.buf, v...) - } - } - - return state.err -} - -func size_struct(prop *StructProperties, base structPointer) (n int) { - for _, i := range prop.order { - p := prop.Prop[i] - if p.size != nil { - n += p.size(p, base) - } - } - - // Add unrecognized fields at the end. - if prop.unrecField.IsValid() { - v := *structPointer_Bytes(base, prop.unrecField) - n += len(v) - } - - // Factor in any oneof fields. - if prop.oneofSizer != nil { - m := structPointer_Interface(base, prop.stype).(Message) - n += prop.oneofSizer(m) - } - - return -} - -var zeroes [20]byte // longer than any conceivable sizeVarint - -// Encode a struct, preceded by its encoded length (as a varint). -func (o *Buffer) enc_len_struct(prop *StructProperties, base structPointer, state *errorState) error { - return o.enc_len_thing(func() error { return o.enc_struct(prop, base) }, state) -} - -// Encode something, preceded by its encoded length (as a varint). -func (o *Buffer) enc_len_thing(enc func() error, state *errorState) error { - iLen := len(o.buf) - o.buf = append(o.buf, 0, 0, 0, 0) // reserve four bytes for length - iMsg := len(o.buf) - err := enc() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - lMsg := len(o.buf) - iMsg - lLen := sizeVarint(uint64(lMsg)) - switch x := lLen - (iMsg - iLen); { - case x > 0: // actual length is x bytes larger than the space we reserved - // Move msg x bytes right. - o.buf = append(o.buf, zeroes[:x]...) - copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg]) - case x < 0: // actual length is x bytes smaller than the space we reserved - // Move msg x bytes left. - copy(o.buf[iMsg+x:], o.buf[iMsg:iMsg+lMsg]) - o.buf = o.buf[:len(o.buf)+x] // x is negative - } - // Encode the length in the reserved space. - o.buf = o.buf[:iLen] - o.EncodeVarint(uint64(lMsg)) - o.buf = o.buf[:len(o.buf)+lMsg] - return state.err -} - -// errorState maintains the first error that occurs and updates that error -// with additional context. -type errorState struct { - err error -} - -// shouldContinue reports whether encoding should continue upon encountering the -// given error. If the error is RequiredNotSetError, shouldContinue returns true -// and, if this is the first appearance of that error, remembers it for future -// reporting. -// -// If prop is not nil, it may update any error with additional context about the -// field with the error. -func (s *errorState) shouldContinue(err error, prop *Properties) bool { - // Ignore unset required fields. - reqNotSet, ok := err.(*RequiredNotSetError) - if !ok { - return false - } - if s.err == nil { - if prop != nil { - err = &RequiredNotSetError{prop.Name + "." + reqNotSet.field} - } - s.err = err - } - return true -} diff --git a/vendor/github.com/gogo/protobuf/proto/encode_gogo.go b/vendor/github.com/gogo/protobuf/proto/encode_gogo.go index 32111b7f41d7..0f5fb173e9fd 100644 --- a/vendor/github.com/gogo/protobuf/proto/encode_gogo.go +++ b/vendor/github.com/gogo/protobuf/proto/encode_gogo.go @@ -3,11 +3,6 @@ // Copyright (c) 2013, The GoGo Authors. All rights reserved. // http://github.com/gogo/protobuf // -// Go support for Protocol Buffers - Google's data interchange format -// -// Copyright 2010 The Go Authors. All rights reserved. -// http://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: @@ -18,9 +13,6 @@ // 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 @@ -36,315 +28,6 @@ package proto -import ( - "reflect" -) - func NewRequiredNotSetError(field string) *RequiredNotSetError { return &RequiredNotSetError{field} } - -type Sizer interface { - Size() int -} - -func (o *Buffer) enc_ext_slice_byte(p *Properties, base structPointer) error { - s := *structPointer_Bytes(base, p.field) - if s == nil { - return ErrNil - } - o.buf = append(o.buf, s...) - return nil -} - -func size_ext_slice_byte(p *Properties, base structPointer) (n int) { - s := *structPointer_Bytes(base, p.field) - if s == nil { - return 0 - } - n += len(s) - return -} - -// Encode a reference to bool pointer. -func (o *Buffer) enc_ref_bool(p *Properties, base structPointer) error { - v := *structPointer_BoolVal(base, p.field) - x := 0 - if v { - x = 1 - } - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func size_ref_bool(p *Properties, base structPointer) int { - return len(p.tagcode) + 1 // each bool takes exactly one byte -} - -// Encode a reference to int32 pointer. -func (o *Buffer) enc_ref_int32(p *Properties, base structPointer) error { - v := structPointer_Word32Val(base, p.field) - x := int32(word32Val_Get(v)) - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func size_ref_int32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32Val(base, p.field) - x := int32(word32Val_Get(v)) - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -func (o *Buffer) enc_ref_uint32(p *Properties, base structPointer) error { - v := structPointer_Word32Val(base, p.field) - x := word32Val_Get(v) - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, uint64(x)) - return nil -} - -func size_ref_uint32(p *Properties, base structPointer) (n int) { - v := structPointer_Word32Val(base, p.field) - x := word32Val_Get(v) - n += len(p.tagcode) - n += p.valSize(uint64(x)) - return -} - -// Encode a reference to an int64 pointer. -func (o *Buffer) enc_ref_int64(p *Properties, base structPointer) error { - v := structPointer_Word64Val(base, p.field) - x := word64Val_Get(v) - o.buf = append(o.buf, p.tagcode...) - p.valEnc(o, x) - return nil -} - -func size_ref_int64(p *Properties, base structPointer) (n int) { - v := structPointer_Word64Val(base, p.field) - x := word64Val_Get(v) - n += len(p.tagcode) - n += p.valSize(x) - return -} - -// Encode a reference to a string pointer. -func (o *Buffer) enc_ref_string(p *Properties, base structPointer) error { - v := *structPointer_StringVal(base, p.field) - o.buf = append(o.buf, p.tagcode...) - o.EncodeStringBytes(v) - return nil -} - -func size_ref_string(p *Properties, base structPointer) (n int) { - v := *structPointer_StringVal(base, p.field) - n += len(p.tagcode) - n += sizeStringBytes(v) - return -} - -// Encode a reference to a message struct. -func (o *Buffer) enc_ref_struct_message(p *Properties, base structPointer) error { - var state errorState - structp := structPointer_GetRefStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return ErrNil - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, err := m.Marshal() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return nil - } - - o.buf = append(o.buf, p.tagcode...) - return o.enc_len_struct(p.sprop, structp, &state) -} - -//TODO this is only copied, please fix this -func size_ref_struct_message(p *Properties, base structPointer) int { - structp := structPointer_GetRefStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return 0 - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, _ := m.Marshal() - n0 := len(p.tagcode) - n1 := sizeRawBytes(data) - return n0 + n1 - } - - n0 := len(p.tagcode) - n1 := size_struct(p.sprop, structp) - n2 := sizeVarint(uint64(n1)) // size of encoded length - return n0 + n1 + n2 -} - -// Encode a slice of references to message struct pointers ([]struct). -func (o *Buffer) enc_slice_ref_struct_message(p *Properties, base structPointer) error { - var state errorState - ss := structPointer_StructRefSlice(base, p.field, p.stype.Size()) - l := ss.Len() - for i := 0; i < l; i++ { - structp := ss.Index(i) - if structPointer_IsNil(structp) { - return errRepeatedHasNil - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, err := m.Marshal() - if err != nil && !state.shouldContinue(err, nil) { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - continue - } - - o.buf = append(o.buf, p.tagcode...) - err := o.enc_len_struct(p.sprop, structp, &state) - if err != nil && !state.shouldContinue(err, nil) { - if err == ErrNil { - return errRepeatedHasNil - } - return err - } - - } - return state.err -} - -//TODO this is only copied, please fix this -func size_slice_ref_struct_message(p *Properties, base structPointer) (n int) { - ss := structPointer_StructRefSlice(base, p.field, p.stype.Size()) - l := ss.Len() - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - structp := ss.Index(i) - if structPointer_IsNil(structp) { - return // return the size up to this point - } - - // Can the object marshal itself? - if p.isMarshaler { - m := structPointer_Interface(structp, p.stype).(Marshaler) - data, _ := m.Marshal() - n += len(p.tagcode) - n += sizeRawBytes(data) - continue - } - - n0 := size_struct(p.sprop, structp) - n1 := sizeVarint(uint64(n0)) // size of encoded length - n += n0 + n1 - } - return -} - -func (o *Buffer) enc_custom_bytes(p *Properties, base structPointer) error { - i := structPointer_InterfaceRef(base, p.field, p.ctype) - if i == nil { - return ErrNil - } - custom := i.(Marshaler) - data, err := custom.Marshal() - if err != nil { - return err - } - if data == nil { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return nil -} - -func size_custom_bytes(p *Properties, base structPointer) (n int) { - n += len(p.tagcode) - i := structPointer_InterfaceRef(base, p.field, p.ctype) - if i == nil { - return 0 - } - custom := i.(Marshaler) - data, _ := custom.Marshal() - n += sizeRawBytes(data) - return -} - -func (o *Buffer) enc_custom_ref_bytes(p *Properties, base structPointer) error { - custom := structPointer_InterfaceAt(base, p.field, p.ctype).(Marshaler) - data, err := custom.Marshal() - if err != nil { - return err - } - if data == nil { - return ErrNil - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return nil -} - -func size_custom_ref_bytes(p *Properties, base structPointer) (n int) { - n += len(p.tagcode) - i := structPointer_InterfaceAt(base, p.field, p.ctype) - if i == nil { - return 0 - } - custom := i.(Marshaler) - data, _ := custom.Marshal() - n += sizeRawBytes(data) - return -} - -func (o *Buffer) enc_custom_slice_bytes(p *Properties, base structPointer) error { - inter := structPointer_InterfaceRef(base, p.field, p.ctype) - if inter == nil { - return ErrNil - } - slice := reflect.ValueOf(inter) - l := slice.Len() - for i := 0; i < l; i++ { - v := slice.Index(i) - custom := v.Interface().(Marshaler) - data, err := custom.Marshal() - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - } - return nil -} - -func size_custom_slice_bytes(p *Properties, base structPointer) (n int) { - inter := structPointer_InterfaceRef(base, p.field, p.ctype) - if inter == nil { - return 0 - } - slice := reflect.ValueOf(inter) - l := slice.Len() - n += l * len(p.tagcode) - for i := 0; i < l; i++ { - v := slice.Index(i) - custom := v.Interface().(Marshaler) - data, _ := custom.Marshal() - n += sizeRawBytes(data) - } - return -} diff --git a/vendor/github.com/gogo/protobuf/proto/equal.go b/vendor/github.com/gogo/protobuf/proto/equal.go index 2ed1cf596664..d4db5a1c1457 100644 --- a/vendor/github.com/gogo/protobuf/proto/equal.go +++ b/vendor/github.com/gogo/protobuf/proto/equal.go @@ -109,15 +109,6 @@ func equalStruct(v1, v2 reflect.Value) bool { // set/unset mismatch return false } - b1, ok := f1.Interface().(raw) - if ok { - b2 := f2.Interface().(raw) - // RawMessage - if !bytes.Equal(b1.Bytes(), b2.Bytes()) { - return false - } - continue - } f1, f2 = f1.Elem(), f2.Elem() } if !equalAny(f1, f2, sprop.Prop[i]) { @@ -146,11 +137,7 @@ func equalStruct(v1, v2 reflect.Value) bool { u1 := uf.Bytes() u2 := v2.FieldByName("XXX_unrecognized").Bytes() - if !bytes.Equal(u1, u2) { - return false - } - - return true + return bytes.Equal(u1, u2) } // v1 and v2 are known to have the same type. @@ -261,6 +248,15 @@ func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { m1, m2 := e1.value, e2.value + if m1 == nil && m2 == nil { + // Both have only encoded form. + if bytes.Equal(e1.enc, e2.enc) { + continue + } + // The bytes are different, but the extensions might still be + // equal. We need to decode them to compare. + } + if m1 != nil && m2 != nil { // Both are unencoded. if !equalAny(reflect.ValueOf(m1), reflect.ValueOf(m2), nil) { @@ -276,8 +272,12 @@ func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { desc = m[extNum] } if desc == nil { + // If both have only encoded form and the bytes are the same, + // it is handled above. We get here when the bytes are different. + // We don't know how to decode it, so just compare them as byte + // slices. log.Printf("proto: don't know how to compare extension %d of %v", extNum, base) - continue + return false } var err error if m1 == nil { diff --git a/vendor/github.com/gogo/protobuf/proto/extensions.go b/vendor/github.com/gogo/protobuf/proto/extensions.go index 0dfcb538e8f1..341c6f57f521 100644 --- a/vendor/github.com/gogo/protobuf/proto/extensions.go +++ b/vendor/github.com/gogo/protobuf/proto/extensions.go @@ -38,6 +38,7 @@ package proto import ( "errors" "fmt" + "io" "reflect" "strconv" "sync" @@ -69,12 +70,6 @@ type extendableProtoV1 interface { ExtensionMap() map[int32]Extension } -type extensionsBytes interface { - Message - ExtensionRangeArray() []ExtensionRange - GetExtensions() *[]byte -} - // extensionAdapter is a wrapper around extendableProtoV1 that implements extendableProto. type extensionAdapter struct { extendableProtoV1 @@ -97,14 +92,31 @@ func (n notLocker) Unlock() {} // extendable returns the extendableProto interface for the given generated proto message. // If the proto message has the old extension format, it returns a wrapper that implements // the extendableProto interface. -func extendable(p interface{}) (extendableProto, bool) { - if ep, ok := p.(extendableProto); ok { - return ep, ok - } - if ep, ok := p.(extendableProtoV1); ok { - return extensionAdapter{ep}, ok +func extendable(p interface{}) (extendableProto, error) { + switch p := p.(type) { + case extendableProto: + if isNilPtr(p) { + return nil, fmt.Errorf("proto: nil %T is not extendable", p) + } + return p, nil + case extendableProtoV1: + if isNilPtr(p) { + return nil, fmt.Errorf("proto: nil %T is not extendable", p) + } + return extensionAdapter{p}, nil + case extensionsBytes: + return slowExtensionAdapter{p}, nil } - return nil, false + // Don't allocate a specific error containing %T: + // this is the hot path for Clone and MarshalText. + return nil, errNotExtendable +} + +var errNotExtendable = errors.New("proto: not an extendable proto.Message") + +func isNilPtr(x interface{}) bool { + v := reflect.ValueOf(x) + return v.Kind() == reflect.Ptr && v.IsNil() } // XXX_InternalExtensions is an internal representation of proto extensions. @@ -149,16 +161,6 @@ func (e *XXX_InternalExtensions) extensionsRead() (map[int32]Extension, sync.Loc return e.p.extensionMap, &e.p.mu } -type extensionRange interface { - Message - ExtensionRangeArray() []ExtensionRange -} - -var extendableProtoType = reflect.TypeOf((*extendableProto)(nil)).Elem() -var extendableProtoV1Type = reflect.TypeOf((*extendableProtoV1)(nil)).Elem() -var extendableBytesType = reflect.TypeOf((*extensionsBytes)(nil)).Elem() -var extensionRangeType = reflect.TypeOf((*extensionRange)(nil)).Elem() - // ExtensionDesc represents an extension specification. // Used in generated code from the protocol compiler. type ExtensionDesc struct { @@ -198,8 +200,8 @@ func SetRawExtension(base Message, id int32, b []byte) { *ext = append(*ext, b...) return } - epb, ok := extendable(base) - if !ok { + epb, err := extendable(base) + if err != nil { return } extmap := epb.extensionsWrite() @@ -207,7 +209,7 @@ func SetRawExtension(base Message, id int32, b []byte) { } // isExtensionField returns true iff the given field number is in an extension range. -func isExtensionField(pb extensionRange, field int32) bool { +func isExtensionField(pb extendableProto, field int32) bool { for _, er := range pb.ExtensionRangeArray() { if er.Start <= field && field <= er.End { return true @@ -223,8 +225,11 @@ func checkExtensionTypes(pb extendableProto, extension *ExtensionDesc) error { if ea, ok := pbi.(extensionAdapter); ok { pbi = ea.extendableProtoV1 } + if ea, ok := pbi.(slowExtensionAdapter); ok { + pbi = ea.extensionsBytes + } if a, b := reflect.TypeOf(pbi), reflect.TypeOf(extension.ExtendedType); a != b { - return errors.New("proto: bad extended type; " + b.String() + " does not extend " + a.String()) + return fmt.Errorf("proto: bad extended type; %v does not extend %v", b, a) } // Check the range. if !isExtensionField(pb, extension.Field) { @@ -269,80 +274,6 @@ func extensionProperties(ed *ExtensionDesc) *Properties { return prop } -// encode encodes any unmarshaled (unencoded) extensions in e. -func encodeExtensions(e *XXX_InternalExtensions) error { - m, mu := e.extensionsRead() - if m == nil { - return nil // fast path - } - mu.Lock() - defer mu.Unlock() - return encodeExtensionsMap(m) -} - -// encode encodes any unmarshaled (unencoded) extensions in e. -func encodeExtensionsMap(m map[int32]Extension) error { - for k, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - et := reflect.TypeOf(e.desc.ExtensionType) - props := extensionProperties(e.desc) - - p := NewBuffer(nil) - // If e.value has type T, the encoder expects a *struct{ X T }. - // Pass a *T with a zero field and hope it all works out. - x := reflect.New(et) - x.Elem().Set(reflect.ValueOf(e.value)) - if err := props.enc(p, props, toStructPointer(x)); err != nil { - return err - } - e.enc = p.buf - m[k] = e - } - return nil -} - -func extensionsSize(e *XXX_InternalExtensions) (n int) { - m, mu := e.extensionsRead() - if m == nil { - return 0 - } - mu.Lock() - defer mu.Unlock() - return extensionsMapSize(m) -} - -func extensionsMapSize(m map[int32]Extension) (n int) { - for _, e := range m { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - n += len(e.enc) - continue - } - - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - et := reflect.TypeOf(e.desc.ExtensionType) - props := extensionProperties(e.desc) - - // If e.value has type T, the encoder expects a *struct{ X T }. - // Pass a *T with a zero field and hope it all works out. - x := reflect.New(et) - x.Elem().Set(reflect.ValueOf(e.value)) - n += props.size(props, toStructPointer(x)) - } - return -} - // HasExtension returns whether the given extension is present in pb. func HasExtension(pb Message, extension *ExtensionDesc) bool { if epb, doki := pb.(extensionsBytes); doki { @@ -366,8 +297,8 @@ func HasExtension(pb Message, extension *ExtensionDesc) bool { return false } // TODO: Check types, field numbers, etc.? - epb, ok := extendable(pb) - if !ok { + epb, err := extendable(pb) + if err != nil { return false } extmap, mu := epb.extensionsRead() @@ -375,46 +306,26 @@ func HasExtension(pb Message, extension *ExtensionDesc) bool { return false } mu.Lock() - _, ok = extmap[extension.Field] + _, ok := extmap[extension.Field] mu.Unlock() return ok } -func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int { - ext := pb.GetExtensions() - for offset < len(*ext) { - tag, n1 := DecodeVarint((*ext)[offset:]) - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - n2, err := size((*ext)[offset+n1:], wireType) - if err != nil { - panic(err) - } - newOffset := offset + n1 + n2 - if fieldNum == theFieldNum { - *ext = append((*ext)[:offset], (*ext)[newOffset:]...) - return offset - } - offset = newOffset - } - return -1 -} - // ClearExtension removes the given extension from pb. func ClearExtension(pb Message, extension *ExtensionDesc) { clearExtension(pb, extension.Field) } func clearExtension(pb Message, fieldNum int32) { - if epb, doki := pb.(extensionsBytes); doki { + if epb, ok := pb.(extensionsBytes); ok { offset := 0 for offset != -1 { offset = deleteExtension(epb, fieldNum, offset) } return } - epb, ok := extendable(pb) - if !ok { + epb, err := extendable(pb) + if err != nil { return } // TODO: Check types, field numbers, etc.? @@ -422,39 +333,33 @@ func clearExtension(pb Message, fieldNum int32) { delete(extmap, fieldNum) } -// GetExtension parses and returns the given extension of pb. -// If the extension is not present and has no default value it returns ErrMissingExtension. +// GetExtension retrieves a proto2 extended field from pb. +// +// If the descriptor is type complete (i.e., ExtensionDesc.ExtensionType is non-nil), +// then GetExtension parses the encoded field and returns a Go value of the specified type. +// If the field is not present, then the default value is returned (if one is specified), +// otherwise ErrMissingExtension is reported. +// +// If the descriptor is not type complete (i.e., ExtensionDesc.ExtensionType is nil), +// then GetExtension returns the raw encoded bytes of the field extension. func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { if epb, doki := pb.(extensionsBytes); doki { ext := epb.GetExtensions() - o := 0 - for o < len(*ext) { - tag, n := DecodeVarint((*ext)[o:]) - fieldNum := int32(tag >> 3) - wireType := int(tag & 0x7) - l, err := size((*ext)[o+n:], wireType) - if err != nil { - return nil, err - } - if int32(fieldNum) == extension.Field { - v, err := decodeExtension((*ext)[o:o+n+l], extension) - if err != nil { - return nil, err - } - return v, nil - } - o += n + l - } - return defaultExtensionValue(extension) + return decodeExtensionFromBytes(extension, *ext) } - epb, ok := extendable(pb) - if !ok { - return nil, errors.New("proto: not an extendable proto") - } - if err := checkExtensionTypes(epb, extension); err != nil { + + epb, err := extendable(pb) + if err != nil { return nil, err } + if extension.ExtendedType != nil { + // can only check type if this is a complete descriptor + if cerr := checkExtensionTypes(epb, extension); cerr != nil { + return nil, cerr + } + } + emap, mu := epb.extensionsRead() if emap == nil { return defaultExtensionValue(extension) @@ -479,6 +384,11 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { return e.value, nil } + if extension.ExtensionType == nil { + // incomplete descriptor + return e.enc, nil + } + v, err := decodeExtension(e.enc, extension) if err != nil { return nil, err @@ -496,6 +406,11 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { // defaultExtensionValue returns the default value for extension. // If no default for an extension is defined ErrMissingExtension is returned. func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { + if extension.ExtensionType == nil { + // incomplete descriptor, so no default + return nil, ErrMissingExtension + } + t := reflect.TypeOf(extension.ExtensionType) props := extensionProperties(extension) @@ -530,31 +445,28 @@ func defaultExtensionValue(extension *ExtensionDesc) (interface{}, error) { // decodeExtension decodes an extension encoded in b. func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { - o := NewBuffer(b) - t := reflect.TypeOf(extension.ExtensionType) - - props := extensionProperties(extension) + unmarshal := typeUnmarshaler(t, extension.Tag) // t is a pointer to a struct, pointer to basic type or a slice. - // Allocate a "field" to store the pointer/slice itself; the - // pointer/slice will be stored here. We pass - // the address of this field to props.dec. - // This passes a zero field and a *t and lets props.dec - // interpret it as a *struct{ x t }. + // Allocate space to store the pointer/slice. value := reflect.New(t).Elem() + var err error for { - // Discard wire type and field number varint. It isn't needed. - if _, err := o.DecodeVarint(); err != nil { - return nil, err + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF } + b = b[n:] + wire := int(x) & 7 - if err := props.dec(o, props, toStructPointer(value.Addr())); err != nil { + b, err = unmarshal(b, valToPointer(value.Addr()), wire) + if err != nil { return nil, err } - if o.index >= len(o.buf) { + if len(b) == 0 { break } } @@ -564,9 +476,13 @@ func decodeExtension(b []byte, extension *ExtensionDesc) (interface{}, error) { // GetExtensions returns a slice of the extensions present in pb that are also listed in es. // The returned slice has the same length as es; missing extensions will appear as nil elements. func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, err error) { + epb, err := extendable(pb) + if err != nil { + return nil, err + } extensions = make([]interface{}, len(es)) for i, e := range es { - extensions[i], err = GetExtension(pb, e) + extensions[i], err = GetExtension(epb, e) if err == ErrMissingExtension { err = nil } @@ -581,9 +497,9 @@ func GetExtensions(pb Message, es []*ExtensionDesc) (extensions []interface{}, e // For non-registered extensions, ExtensionDescs returns an incomplete descriptor containing // just the Field field, which defines the extension's field number. func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { - epb, ok := extendable(pb) - if !ok { - return nil, fmt.Errorf("proto: %T is not an extendable proto.Message", pb) + epb, err := extendable(pb) + if err != nil { + return nil, err } registeredExtensions := RegisteredExtensions(pb) @@ -610,30 +526,26 @@ func ExtensionDescs(pb Message) ([]*ExtensionDesc, error) { // SetExtension sets the specified extension of pb to the specified value. func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error { - if epb, doki := pb.(extensionsBytes); doki { + if epb, ok := pb.(extensionsBytes); ok { ClearExtension(pb, extension) - ext := epb.GetExtensions() - et := reflect.TypeOf(extension.ExtensionType) - props := extensionProperties(extension) - p := NewBuffer(nil) - x := reflect.New(et) - x.Elem().Set(reflect.ValueOf(value)) - if err := props.enc(p, props, toStructPointer(x)); err != nil { + newb, err := encodeExtension(extension, value) + if err != nil { return err } - *ext = append(*ext, p.buf...) + bb := epb.GetExtensions() + *bb = append(*bb, newb...) return nil } - epb, ok := extendable(pb) - if !ok { - return errors.New("proto: not an extendable proto") + epb, err := extendable(pb) + if err != nil { + return err } if err := checkExtensionTypes(epb, extension); err != nil { return err } 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 @@ -656,8 +568,8 @@ func ClearAllExtensions(pb Message) { *ext = []byte{} return } - epb, ok := extendable(pb) - if !ok { + epb, err := extendable(pb) + if err != nil { return } m := epb.extensionsWrite() diff --git a/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go b/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go index ea6478f009d7..6f1ae120ece5 100644 --- a/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go +++ b/vendor/github.com/gogo/protobuf/proto/extensions_gogo.go @@ -32,12 +32,36 @@ import ( "bytes" "errors" "fmt" + "io" "reflect" "sort" "strings" "sync" ) +type extensionsBytes interface { + Message + ExtensionRangeArray() []ExtensionRange + GetExtensions() *[]byte +} + +type slowExtensionAdapter struct { + extensionsBytes +} + +func (s slowExtensionAdapter) extensionsWrite() map[int32]Extension { + panic("Please report a bug to github.com/gogo/protobuf if you see this message: Writing extensions is not supported for extensions stored in a byte slice field.") +} + +func (s slowExtensionAdapter) extensionsRead() (map[int32]Extension, sync.Locker) { + b := s.GetExtensions() + m, err := BytesToExtensionsMap(*b) + if err != nil { + panic(err) + } + return m, notLocker{} +} + func GetBoolExtension(pb Message, extension *ExtensionDesc, ifnotset bool) bool { if reflect.ValueOf(pb).IsNil() { return ifnotset @@ -56,19 +80,28 @@ func GetBoolExtension(pb Message, extension *ExtensionDesc, ifnotset bool) bool } func (this *Extension) Equal(that *Extension) bool { + if err := this.Encode(); err != nil { + return false + } + if err := that.Encode(); err != nil { + return false + } return bytes.Equal(this.enc, that.enc) } func (this *Extension) Compare(that *Extension) int { + if err := this.Encode(); err != nil { + return 1 + } + if err := that.Encode(); err != nil { + return -1 + } return bytes.Compare(this.enc, that.enc) } func SizeOfInternalExtension(m extendableProto) (n int) { - return SizeOfExtensionMap(m.extensionsWrite()) -} - -func SizeOfExtensionMap(m map[int32]Extension) (n int) { - return extensionsMapSize(m) + info := getMarshalInfo(reflect.TypeOf(m)) + return info.sizeV1Extensions(m.extensionsWrite()) } type sortableMapElem struct { @@ -121,29 +154,48 @@ func EncodeInternalExtension(m extendableProto, data []byte) (n int, err error) return EncodeExtensionMap(m.extensionsWrite(), data) } +func EncodeInternalExtensionBackwards(m extendableProto, data []byte) (n int, err error) { + return EncodeExtensionMapBackwards(m.extensionsWrite(), data) +} + func EncodeExtensionMap(m map[int32]Extension, data []byte) (n int, err error) { - if err := encodeExtensionsMap(m); err != nil { - return 0, err - } - keys := make([]int, 0, len(m)) - for k := range m { - keys = append(keys, int(k)) + o := 0 + for _, e := range m { + if err := e.Encode(); err != nil { + return 0, err + } + n := copy(data[o:], e.enc) + if n != len(e.enc) { + return 0, io.ErrShortBuffer + } + o += n } - sort.Ints(keys) - for _, k := range keys { - n += copy(data[n:], m[int32(k)].enc) + return o, nil +} + +func EncodeExtensionMapBackwards(m map[int32]Extension, data []byte) (n int, err error) { + o := 0 + end := len(data) + for _, e := range m { + if err := e.Encode(); err != nil { + return 0, err + } + n := copy(data[end-len(e.enc):], e.enc) + if n != len(e.enc) { + return 0, io.ErrShortBuffer + } + end -= n + o += n } - return n, nil + return o, nil } func GetRawExtension(m map[int32]Extension, id int32) ([]byte, error) { - if m[id].value == nil || m[id].desc == nil { - return m[id].enc, nil - } - if err := encodeExtensionsMap(m); err != nil { + e := m[id] + if err := e.Encode(); err != nil { return nil, err } - return m[id].enc, nil + return e.enc, nil } func size(buf []byte, wire int) (int, error) { @@ -218,35 +270,58 @@ func AppendExtension(e Message, tag int32, buf []byte) { } } -func encodeExtension(e *Extension) error { - if e.value == nil || e.desc == nil { - // Extension is only in its encoded form. - return nil +func encodeExtension(extension *ExtensionDesc, value interface{}) ([]byte, error) { + u := getMarshalInfo(reflect.TypeOf(extension.ExtendedType)) + ei := u.getExtElemInfo(extension) + v := value + p := toAddrPointer(&v, ei.isptr) + siz := ei.sizer(p, SizeVarint(ei.wiretag)) + buf := make([]byte, 0, siz) + return ei.marshaler(buf, p, ei.wiretag, false) +} + +func decodeExtensionFromBytes(extension *ExtensionDesc, buf []byte) (interface{}, error) { + o := 0 + for o < len(buf) { + tag, n := DecodeVarint((buf)[o:]) + fieldNum := int32(tag >> 3) + wireType := int(tag & 0x7) + if o+n > len(buf) { + return nil, fmt.Errorf("unable to decode extension") + } + l, err := size((buf)[o+n:], wireType) + if err != nil { + return nil, err + } + if int32(fieldNum) == extension.Field { + if o+n+l > len(buf) { + return nil, fmt.Errorf("unable to decode extension") + } + v, err := decodeExtension((buf)[o:o+n+l], extension) + if err != nil { + return nil, err + } + return v, nil + } + o += n + l } - // We don't skip extensions that have an encoded form set, - // because the extension value may have been mutated after - // the last time this function was called. - - et := reflect.TypeOf(e.desc.ExtensionType) - props := extensionProperties(e.desc) - - p := NewBuffer(nil) - // If e.value has type T, the encoder expects a *struct{ X T }. - // Pass a *T with a zero field and hope it all works out. - x := reflect.New(et) - x.Elem().Set(reflect.ValueOf(e.value)) - if err := props.enc(p, props, toStructPointer(x)); err != nil { - return err + return defaultExtensionValue(extension) +} + +func (this *Extension) Encode() error { + if this.enc == nil { + var err error + this.enc, err = encodeExtension(this.desc, this.value) + if err != nil { + return err + } } - e.enc = p.buf return nil } func (this Extension) GoString() string { - if this.enc == nil { - if err := encodeExtension(&this); err != nil { - panic(err) - } + if err := this.Encode(); err != nil { + return fmt.Sprintf("error encoding extension: %v", err) } return fmt.Sprintf("proto.NewExtension(%#v)", this.enc) } @@ -292,3 +367,23 @@ func GetUnsafeExtensionsMap(extendable Message) map[int32]Extension { pb := extendable.(extendableProto) return pb.extensionsWrite() } + +func deleteExtension(pb extensionsBytes, theFieldNum int32, offset int) int { + ext := pb.GetExtensions() + for offset < len(*ext) { + tag, n1 := DecodeVarint((*ext)[offset:]) + fieldNum := int32(tag >> 3) + wireType := int(tag & 0x7) + n2, err := size((*ext)[offset+n1:], wireType) + if err != nil { + panic(err) + } + newOffset := offset + n1 + n2 + if fieldNum == theFieldNum { + *ext = append((*ext)[:offset], (*ext)[newOffset:]...) + return offset + } + offset = newOffset + } + return -1 +} diff --git a/vendor/github.com/gogo/protobuf/proto/lib.go b/vendor/github.com/gogo/protobuf/proto/lib.go index c98d73da49ea..80db1c155b59 100644 --- a/vendor/github.com/gogo/protobuf/proto/lib.go +++ b/vendor/github.com/gogo/protobuf/proto/lib.go @@ -273,32 +273,73 @@ import ( "sync" ) -// Message is implemented by generated protocol buffer messages. -type Message interface { - Reset() - String() string - ProtoMessage() +// RequiredNotSetError is an error type returned by either Marshal or Unmarshal. +// Marshal reports this when a required field is not initialized. +// Unmarshal reports this when a required field is missing from the wire data. +type RequiredNotSetError struct{ field string } + +func (e *RequiredNotSetError) Error() string { + if e.field == "" { + return fmt.Sprintf("proto: required field not set") + } + return fmt.Sprintf("proto: required field %q not set", e.field) } +func (e *RequiredNotSetError) RequiredNotSet() bool { + return true +} + +type invalidUTF8Error struct{ field string } -// 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 +func (e *invalidUTF8Error) Error() string { + if e.field == "" { + return "proto: invalid UTF-8 detected" + } + return fmt.Sprintf("proto: field %q contains invalid UTF-8", e.field) +} +func (e *invalidUTF8Error) InvalidUTF8() bool { + return true } -// Set to true to enable stats collection. -const collectStats = false +// errInvalidUTF8 is a sentinel error to identify fields with invalid UTF-8. +// This error should not be exposed to the external API as such errors should +// be recreated with the field information. +var errInvalidUTF8 = &invalidUTF8Error{} -var stats Stats +// isNonFatal reports whether the error is either a RequiredNotSet error +// or a InvalidUTF8 error. +func isNonFatal(err error) bool { + if re, ok := err.(interface{ RequiredNotSet() bool }); ok && re.RequiredNotSet() { + return true + } + if re, ok := err.(interface{ InvalidUTF8() bool }); ok && re.InvalidUTF8() { + return true + } + return false +} + +type nonFatal struct{ E error } -// GetStats returns a copy of the global Stats structure. -func GetStats() Stats { return stats } +// Merge merges err into nf and reports whether it was successful. +// Otherwise it returns false for any fatal non-nil errors. +func (nf *nonFatal) Merge(err error) (ok bool) { + if err == nil { + return true // not an error + } + if !isNonFatal(err) { + return false // fatal error + } + if nf.E == nil { + nf.E = err // store first instance of non-fatal error + } + return true +} + +// Message is implemented by generated protocol buffer messages. +type Message interface { + Reset() + String() string + ProtoMessage() +} // A Buffer is a buffer manager for marshaling and unmarshaling // protocol buffers. It may be reused between invocations to @@ -309,16 +350,7 @@ type Buffer struct { buf []byte // encode/decode byte stream index int // read point - // pools of basic types to amortize allocation. - bools []bool - uint32s []uint32 - uint64s []uint64 - - // extra pools, only used with pointer_reflect.go - int32s []int32 - int64s []int64 - float32s []float32 - float64s []float64 + deterministic bool } // NewBuffer allocates a new Buffer and initializes its internal data to @@ -343,6 +375,30 @@ func (p *Buffer) SetBuf(s []byte) { // Bytes returns the contents of the Buffer. func (p *Buffer) Bytes() []byte { return p.buf } +// SetDeterministic sets whether to use deterministic serialization. +// +// Deterministic serialization guarantees that for a given binary, equal +// messages will always be serialized to the same bytes. This implies: +// +// - Repeated serialization of a message will return the same bytes. +// - Different processes of the same binary (which may be executing on +// different machines) will serialize equal messages to the same bytes. +// +// Note that the deterministic serialization is NOT canonical across +// languages. It is not guaranteed to remain stable over time. It is unstable +// across different builds with schema changes due to unknown fields. +// Users who need canonical serialization (e.g., persistent storage in a +// canonical form, fingerprinting, etc.) should define their own +// canonicalization specification and implement their own serializer rather +// than relying on this API. +// +// If deterministic serialization is requested, map entries will be sorted +// by keys in lexographical order. This is an implementation detail and +// subject to change. +func (p *Buffer) SetDeterministic(deterministic bool) { + p.deterministic = deterministic +} + /* * Helper routines for simplifying the creation of optional fields of basic type. */ @@ -552,9 +608,11 @@ func SetDefaults(pb Message) { setDefaults(reflect.ValueOf(pb), true, false) } -// v is a pointer to a struct. +// v is a struct. func setDefaults(v reflect.Value, recur, zeros bool) { - v = v.Elem() + if v.Kind() == reflect.Ptr { + v = v.Elem() + } defaultMu.RLock() dm, ok := defaults[v.Type()] @@ -656,8 +714,11 @@ func setDefaults(v reflect.Value, recur, zeros bool) { for _, ni := range dm.nested { f := v.Field(ni) - // f is *T or []*T or map[T]*T + // f is *T or T or []*T or []T switch f.Kind() { + case reflect.Struct: + setDefaults(f, recur, zeros) + case reflect.Ptr: if f.IsNil() { continue @@ -667,7 +728,7 @@ func setDefaults(v reflect.Value, recur, zeros bool) { case reflect.Slice: for i := 0; i < f.Len(); i++ { e := f.Index(i) - if e.IsNil() { + if e.Kind() == reflect.Ptr && e.IsNil() { continue } setDefaults(e, recur, zeros) @@ -739,6 +800,9 @@ func buildDefaultMessage(t reflect.Type) (dm defaultMessage) { func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) { var canHaveDefault bool switch ft.Kind() { + case reflect.Struct: + nestedMessage = true // non-nullable + case reflect.Ptr: if ft.Elem().Kind() == reflect.Struct { nestedMessage = true @@ -748,7 +812,7 @@ func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMes case reflect.Slice: switch ft.Elem().Kind() { - case reflect.Ptr: + case reflect.Ptr, reflect.Struct: nestedMessage = true // repeated message case reflect.Uint8: canHaveDefault = true // bytes field @@ -831,22 +895,12 @@ func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMes return sf, false, nil } +// mapKeys returns a sort.Interface to be used for sorting the map keys. // 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. - func mapKeys(vs []reflect.Value) sort.Interface { - s := mapKeySorter{ - vs: vs, - // default Less function: textual comparison - less: func(a, b reflect.Value) bool { - return fmt.Sprint(a.Interface()) < fmt.Sprint(b.Interface()) - }, - } + s := mapKeySorter{vs: vs} - // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps; - // numeric keys are sorted numerically. + // Type specialization per https://developers.google.com/protocol-buffers/docs/proto#maps. if len(vs) == 0 { return s } @@ -855,6 +909,12 @@ func mapKeys(vs []reflect.Value) sort.Interface { s.less = func(a, b reflect.Value) bool { return a.Int() < b.Int() } case reflect.Uint32, reflect.Uint64: s.less = func(a, b reflect.Value) bool { return a.Uint() < b.Uint() } + case reflect.Bool: + s.less = func(a, b reflect.Value) bool { return !a.Bool() && b.Bool() } // false < true + case reflect.String: + s.less = func(a, b reflect.Value) bool { return a.String() < b.String() } + default: + panic(fmt.Sprintf("unsupported map key type: %v", vs[0].Kind())) } return s @@ -888,10 +948,26 @@ 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 GoGoProtoPackageIsVersion2 = true +const ( + // ProtoPackageIsVersion3 is referenced from generated protocol buffer files + // to assert that that code is compatible with this version of the proto package. + GoGoProtoPackageIsVersion3 = true + + // ProtoPackageIsVersion2 is referenced from generated protocol buffer files + // to assert that that code is compatible with this version of the proto package. + GoGoProtoPackageIsVersion2 = true -// ProtoPackageIsVersion1 is referenced from generated protocol buffer files -// to assert that that code is compatible with this version of the proto package. -const GoGoProtoPackageIsVersion1 = true + // ProtoPackageIsVersion1 is referenced from generated protocol buffer files + // to assert that that code is compatible with this version of the proto package. + GoGoProtoPackageIsVersion1 = true +) + +// InternalMessageInfo is a type used internally by generated .pb.go files. +// This type is not intended to be used by non-generated code. +// This type is not subject to any compatibility guarantee. +type InternalMessageInfo struct { + marshal *marshalInfo + unmarshal *unmarshalInfo + merge *mergeInfo + discard *discardInfo +} diff --git a/vendor/github.com/gogo/protobuf/proto/lib_gogo.go b/vendor/github.com/gogo/protobuf/proto/lib_gogo.go index 4b4f7c909e6b..b3aa39190a13 100644 --- a/vendor/github.com/gogo/protobuf/proto/lib_gogo.go +++ b/vendor/github.com/gogo/protobuf/proto/lib_gogo.go @@ -33,6 +33,14 @@ import ( "strconv" ) +type Sizer interface { + Size() int +} + +type ProtoSizer interface { + ProtoSize() int +} + func MarshalJSONEnum(m map[int32]string, value int32) ([]byte, error) { s, ok := m[value] if !ok { diff --git a/vendor/github.com/gogo/protobuf/proto/message_set.go b/vendor/github.com/gogo/protobuf/proto/message_set.go index fd982decd66e..f48a756761ea 100644 --- a/vendor/github.com/gogo/protobuf/proto/message_set.go +++ b/vendor/github.com/gogo/protobuf/proto/message_set.go @@ -36,12 +36,7 @@ package proto */ import ( - "bytes" - "encoding/json" "errors" - "fmt" - "reflect" - "sort" ) // errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. @@ -94,10 +89,7 @@ func (ms *messageSet) find(pb Message) *_MessageSet_Item { } func (ms *messageSet) Has(pb Message) bool { - if ms.find(pb) != nil { - return true - } - return false + return ms.find(pb) != nil } func (ms *messageSet) Unmarshal(pb Message) error { @@ -147,50 +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) { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - if err := encodeExtensions(exts); err != nil { - return nil, err - } - m, _ = exts.extensionsRead() - case map[int32]Extension: - if err := encodeExtensionsMap(exts); err != nil { - return nil, err - } - m = exts - default: - return nil, errors.New("proto: not an extension map") - } - - // Sort extension IDs to provide a deterministic encoding. - // See also enc_map in encode.go. - ids := make([]int, 0, len(m)) - for id := range m { - ids = append(ids, int(id)) - } - sort.Ints(ids) - - ms := &messageSet{Item: make([]*_MessageSet_Item, 0, len(m))} - for _, id := range ids { - e := m[int32(id)] - // Remove the wire type and field number varint, as well as the length varint. - msg := skipVarint(skipVarint(e.enc)) - - ms.Item = append(ms.Item, &_MessageSet_Item{ - TypeId: Int32(int32(id)), - Message: msg, - }) - } - return Marshal(ms) -} - -// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. -// It is called by generated Unmarshal methods on protocol buffer messages with the message_set_wire_format option. -func UnmarshalMessageSet(buf []byte, exts interface{}) error { +// 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 { var m map[int32]Extension switch exts := exts.(type) { case *XXX_InternalExtensions: @@ -228,84 +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: - m, _ = exts.extensionsRead() - 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] - if i > 0 { - b.WriteByte(',') - } - - msd, ok := messageSetMap[id] - if !ok { - // Unknown type; we can't render it, so skip it. - continue - } - 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/gogo/protobuf/proto/pointer_reflect.go b/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go new file mode 100644 index 000000000000..b6cad90834b3 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/pointer_reflect.go @@ -0,0 +1,357 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2012 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. + +// +build purego appengine js + +// This file contains an implementation of proto field accesses using package reflect. +// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can +// be used on App Engine. + +package proto + +import ( + "reflect" + "sync" +) + +const unsafeAllowed = false + +// A field identifies a field in a struct, accessible from a pointer. +// In this implementation, a field is identified by the sequence of field indices +// passed to reflect's FieldByIndex. +type field []int + +// toField returns a field equivalent to the given reflect field. +func toField(f *reflect.StructField) field { + return f.Index +} + +// invalidField is an invalid field identifier. +var invalidField = field(nil) + +// zeroField is a noop when calling pointer.offset. +var zeroField = field([]int{}) + +// IsValid reports whether the field identifier is valid. +func (f field) IsValid() bool { return f != nil } + +// The pointer type is for the table-driven decoder. +// The implementation here uses a reflect.Value of pointer type to +// create a generic pointer. In pointer_unsafe.go we use unsafe +// instead of reflect to implement the same (but faster) interface. +type pointer struct { + v reflect.Value +} + +// toPointer converts an interface of pointer type to a pointer +// that points to the same target. +func toPointer(i *Message) pointer { + return pointer{v: reflect.ValueOf(*i)} +} + +// toAddrPointer converts an interface to a pointer that points to +// the interface data. +func toAddrPointer(i *interface{}, isptr bool) pointer { + v := reflect.ValueOf(*i) + u := reflect.New(v.Type()) + u.Elem().Set(v) + return pointer{v: u} +} + +// valToPointer converts v to a pointer. v must be of pointer type. +func valToPointer(v reflect.Value) pointer { + return pointer{v: v} +} + +// offset converts from a pointer to a structure to a pointer to +// one of its fields. +func (p pointer) offset(f field) pointer { + return pointer{v: p.v.Elem().FieldByIndex(f).Addr()} +} + +func (p pointer) isNil() bool { + return p.v.IsNil() +} + +// grow updates the slice s in place to make it one element longer. +// s must be addressable. +// Returns the (addressable) new element. +func grow(s reflect.Value) reflect.Value { + n, m := s.Len(), s.Cap() + if n < m { + s.SetLen(n + 1) + } else { + s.Set(reflect.Append(s, reflect.Zero(s.Type().Elem()))) + } + return s.Index(n) +} + +func (p pointer) toInt64() *int64 { + return p.v.Interface().(*int64) +} +func (p pointer) toInt64Ptr() **int64 { + return p.v.Interface().(**int64) +} +func (p pointer) toInt64Slice() *[]int64 { + return p.v.Interface().(*[]int64) +} + +var int32ptr = reflect.TypeOf((*int32)(nil)) + +func (p pointer) toInt32() *int32 { + return p.v.Convert(int32ptr).Interface().(*int32) +} + +// The toInt32Ptr/Slice methods don't work because of enums. +// Instead, we must use set/get methods for the int32ptr/slice case. +/* + func (p pointer) toInt32Ptr() **int32 { + return p.v.Interface().(**int32) +} + func (p pointer) toInt32Slice() *[]int32 { + return p.v.Interface().(*[]int32) +} +*/ +func (p pointer) getInt32Ptr() *int32 { + if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { + // raw int32 type + return p.v.Elem().Interface().(*int32) + } + // an enum + return p.v.Elem().Convert(int32PtrType).Interface().(*int32) +} +func (p pointer) setInt32Ptr(v int32) { + // Allocate value in a *int32. Possibly convert that to a *enum. + // Then assign it to a **int32 or **enum. + // Note: we can convert *int32 to *enum, but we can't convert + // **int32 to **enum! + p.v.Elem().Set(reflect.ValueOf(&v).Convert(p.v.Type().Elem())) +} + +// getInt32Slice copies []int32 from p as a new slice. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) getInt32Slice() []int32 { + if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { + // raw int32 type + return p.v.Elem().Interface().([]int32) + } + // an enum + // Allocate a []int32, then assign []enum's values into it. + // Note: we can't convert []enum to []int32. + slice := p.v.Elem() + s := make([]int32, slice.Len()) + for i := 0; i < slice.Len(); i++ { + s[i] = int32(slice.Index(i).Int()) + } + return s +} + +// setInt32Slice copies []int32 into p as a new slice. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) setInt32Slice(v []int32) { + if p.v.Type().Elem().Elem() == reflect.TypeOf(int32(0)) { + // raw int32 type + p.v.Elem().Set(reflect.ValueOf(v)) + return + } + // an enum + // Allocate a []enum, then assign []int32's values into it. + // Note: we can't convert []enum to []int32. + slice := reflect.MakeSlice(p.v.Type().Elem(), len(v), cap(v)) + for i, x := range v { + slice.Index(i).SetInt(int64(x)) + } + p.v.Elem().Set(slice) +} +func (p pointer) appendInt32Slice(v int32) { + grow(p.v.Elem()).SetInt(int64(v)) +} + +func (p pointer) toUint64() *uint64 { + return p.v.Interface().(*uint64) +} +func (p pointer) toUint64Ptr() **uint64 { + return p.v.Interface().(**uint64) +} +func (p pointer) toUint64Slice() *[]uint64 { + return p.v.Interface().(*[]uint64) +} +func (p pointer) toUint32() *uint32 { + return p.v.Interface().(*uint32) +} +func (p pointer) toUint32Ptr() **uint32 { + return p.v.Interface().(**uint32) +} +func (p pointer) toUint32Slice() *[]uint32 { + return p.v.Interface().(*[]uint32) +} +func (p pointer) toBool() *bool { + return p.v.Interface().(*bool) +} +func (p pointer) toBoolPtr() **bool { + return p.v.Interface().(**bool) +} +func (p pointer) toBoolSlice() *[]bool { + return p.v.Interface().(*[]bool) +} +func (p pointer) toFloat64() *float64 { + return p.v.Interface().(*float64) +} +func (p pointer) toFloat64Ptr() **float64 { + return p.v.Interface().(**float64) +} +func (p pointer) toFloat64Slice() *[]float64 { + return p.v.Interface().(*[]float64) +} +func (p pointer) toFloat32() *float32 { + return p.v.Interface().(*float32) +} +func (p pointer) toFloat32Ptr() **float32 { + return p.v.Interface().(**float32) +} +func (p pointer) toFloat32Slice() *[]float32 { + return p.v.Interface().(*[]float32) +} +func (p pointer) toString() *string { + return p.v.Interface().(*string) +} +func (p pointer) toStringPtr() **string { + return p.v.Interface().(**string) +} +func (p pointer) toStringSlice() *[]string { + return p.v.Interface().(*[]string) +} +func (p pointer) toBytes() *[]byte { + return p.v.Interface().(*[]byte) +} +func (p pointer) toBytesSlice() *[][]byte { + return p.v.Interface().(*[][]byte) +} +func (p pointer) toExtensions() *XXX_InternalExtensions { + return p.v.Interface().(*XXX_InternalExtensions) +} +func (p pointer) toOldExtensions() *map[int32]Extension { + return p.v.Interface().(*map[int32]Extension) +} +func (p pointer) getPointer() pointer { + return pointer{v: p.v.Elem()} +} +func (p pointer) setPointer(q pointer) { + p.v.Elem().Set(q.v) +} +func (p pointer) appendPointer(q pointer) { + grow(p.v.Elem()).Set(q.v) +} + +// getPointerSlice copies []*T from p as a new []pointer. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) getPointerSlice() []pointer { + if p.v.IsNil() { + return nil + } + n := p.v.Elem().Len() + s := make([]pointer, n) + for i := 0; i < n; i++ { + s[i] = pointer{v: p.v.Elem().Index(i)} + } + return s +} + +// setPointerSlice copies []pointer into p as a new []*T. +// This behavior differs from the implementation in pointer_unsafe.go. +func (p pointer) setPointerSlice(v []pointer) { + if v == nil { + p.v.Elem().Set(reflect.New(p.v.Elem().Type()).Elem()) + return + } + s := reflect.MakeSlice(p.v.Elem().Type(), 0, len(v)) + for _, p := range v { + s = reflect.Append(s, p.v) + } + p.v.Elem().Set(s) +} + +// getInterfacePointer returns a pointer that points to the +// interface data of the interface pointed by p. +func (p pointer) getInterfacePointer() pointer { + if p.v.Elem().IsNil() { + return pointer{v: p.v.Elem()} + } + return pointer{v: p.v.Elem().Elem().Elem().Field(0).Addr()} // *interface -> interface -> *struct -> struct +} + +func (p pointer) asPointerTo(t reflect.Type) reflect.Value { + // TODO: check that p.v.Type().Elem() == t? + return p.v +} + +func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p +} +func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v +} +func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p +} +func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v +} +func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p +} +func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v +} +func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { + atomicLock.Lock() + defer atomicLock.Unlock() + return *p +} +func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { + atomicLock.Lock() + defer atomicLock.Unlock() + *p = v +} + +var atomicLock sync.Mutex diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go b/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go new file mode 100644 index 000000000000..7ffd3c29d90c --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/pointer_reflect_gogo.go @@ -0,0 +1,59 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/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. +// +// 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. + +// +build purego appengine js + +// This file contains an implementation of proto field accesses using package reflect. +// It is slower than the code in pointer_unsafe.go but it avoids package unsafe and can +// be used on App Engine. + +package proto + +import ( + "reflect" +) + +// TODO: untested, so probably incorrect. + +func (p pointer) getRef() pointer { + return pointer{v: p.v.Addr()} +} + +func (p pointer) appendRef(v pointer, typ reflect.Type) { + slice := p.getSlice(typ) + elem := v.asPointerTo(typ).Elem() + newSlice := reflect.Append(slice, elem) + slice.Set(newSlice) +} + +func (p pointer) getSlice(typ reflect.Type) reflect.Value { + sliceTyp := reflect.SliceOf(typ) + slice := p.asPointerTo(sliceTyp) + slice = slice.Elem() + return slice +} diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go index 6b5567d47cd3..d55a335d9453 100644 --- a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go +++ b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe.go @@ -29,7 +29,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// +build !appengine,!js +// +build !purego,!appengine,!js // This file contains the implementation of the proto field accesses using package unsafe. @@ -37,38 +37,13 @@ package proto import ( "reflect" + "sync/atomic" "unsafe" ) -// NOTE: These type_Foo functions would more idiomatically be methods, -// but Go does not allow methods on pointer types, and we must preserve -// some pointer type for the garbage collector. We use these -// funcs with clunky names as our poor approximation to methods. -// -// An alternative would be -// type structPointer struct { p unsafe.Pointer } -// but that does not registerize as well. - -// A structPointer is a pointer to a struct. -type structPointer unsafe.Pointer - -// toStructPointer returns a structPointer equivalent to the given reflect value. -func toStructPointer(v reflect.Value) structPointer { - return structPointer(unsafe.Pointer(v.Pointer())) -} - -// IsNil reports whether p is nil. -func structPointer_IsNil(p structPointer) bool { - return p == nil -} - -// Interface returns the struct pointer, assumed to have element type t, -// as an interface value. -func structPointer_Interface(p structPointer, t reflect.Type) interface{} { - return reflect.NewAt(t, unsafe.Pointer(p)).Interface() -} +const unsafeAllowed = true -// A field identifies a field in a struct, accessible from a structPointer. +// A field identifies a field in a struct, accessible from a pointer. // In this implementation, a field is identified by its byte offset from the start of the struct. type field uintptr @@ -80,191 +55,254 @@ func toField(f *reflect.StructField) field { // invalidField is an invalid field identifier. const invalidField = ^field(0) +// zeroField is a noop when calling pointer.offset. +const zeroField = field(0) + // IsValid reports whether the field identifier is valid. func (f field) IsValid() bool { - return f != ^field(0) + return f != invalidField } -// Bytes returns the address of a []byte field in the struct. -func structPointer_Bytes(p structPointer, f field) *[]byte { - return (*[]byte)(unsafe.Pointer(uintptr(p) + uintptr(f))) +// The pointer type below is for the new table-driven encoder/decoder. +// The implementation here uses unsafe.Pointer to create a generic pointer. +// In pointer_reflect.go we use reflect instead of unsafe to implement +// the same (but slower) interface. +type pointer struct { + p unsafe.Pointer } -// BytesSlice returns the address of a [][]byte field in the struct. -func structPointer_BytesSlice(p structPointer, f field) *[][]byte { - return (*[][]byte)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} +// size of pointer +var ptrSize = unsafe.Sizeof(uintptr(0)) -// Bool returns the address of a *bool field in the struct. -func structPointer_Bool(p structPointer, f field) **bool { - return (**bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) +// toPointer converts an interface of pointer type to a pointer +// that points to the same target. +func toPointer(i *Message) pointer { + // Super-tricky - read pointer out of data word of interface value. + // Saves ~25ns over the equivalent: + // return valToPointer(reflect.ValueOf(*i)) + return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} } -// BoolVal returns the address of a bool field in the struct. -func structPointer_BoolVal(p structPointer, f field) *bool { - return (*bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) +// toAddrPointer converts an interface to a pointer that points to +// the interface data. +func toAddrPointer(i *interface{}, isptr bool) 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)} + } + // 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]} } -// BoolSlice returns the address of a []bool field in the struct. -func structPointer_BoolSlice(p structPointer, f field) *[]bool { - return (*[]bool)(unsafe.Pointer(uintptr(p) + uintptr(f))) +// valToPointer converts v to a pointer. v must be of pointer type. +func valToPointer(v reflect.Value) pointer { + return pointer{p: unsafe.Pointer(v.Pointer())} } -// String returns the address of a *string field in the struct. -func structPointer_String(p structPointer, f field) **string { - return (**string)(unsafe.Pointer(uintptr(p) + uintptr(f))) +// offset converts from a pointer to a structure to a pointer to +// one of its fields. +func (p pointer) offset(f field) pointer { + // For safety, we should panic if !f.IsValid, however calling panic causes + // this to no longer be inlineable, which is a serious performance cost. + /* + if !f.IsValid() { + panic("invalid field") + } + */ + return pointer{p: unsafe.Pointer(uintptr(p.p) + uintptr(f))} } -// StringVal returns the address of a string field in the struct. -func structPointer_StringVal(p structPointer, f field) *string { - return (*string)(unsafe.Pointer(uintptr(p) + uintptr(f))) +func (p pointer) isNil() bool { + return p.p == nil } -// StringSlice returns the address of a []string field in the struct. -func structPointer_StringSlice(p structPointer, f field) *[]string { - return (*[]string)(unsafe.Pointer(uintptr(p) + uintptr(f))) +func (p pointer) toInt64() *int64 { + return (*int64)(p.p) } - -// ExtMap returns the address of an extension map field in the struct. -func structPointer_Extensions(p structPointer, f field) *XXX_InternalExtensions { - return (*XXX_InternalExtensions)(unsafe.Pointer(uintptr(p) + uintptr(f))) +func (p pointer) toInt64Ptr() **int64 { + return (**int64)(p.p) } - -func structPointer_ExtMap(p structPointer, f field) *map[int32]Extension { - return (*map[int32]Extension)(unsafe.Pointer(uintptr(p) + uintptr(f))) +func (p pointer) toInt64Slice() *[]int64 { + return (*[]int64)(p.p) } - -// NewAt returns the reflect.Value for a pointer to a field in the struct. -func structPointer_NewAt(p structPointer, f field, typ reflect.Type) reflect.Value { - return reflect.NewAt(typ, unsafe.Pointer(uintptr(p)+uintptr(f))) +func (p pointer) toInt32() *int32 { + return (*int32)(p.p) } -// SetStructPointer writes a *struct field in the struct. -func structPointer_SetStructPointer(p structPointer, f field, q structPointer) { - *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))) = q +// See pointer_reflect.go for why toInt32Ptr/Slice doesn't exist. +/* + func (p pointer) toInt32Ptr() **int32 { + return (**int32)(p.p) + } + func (p pointer) toInt32Slice() *[]int32 { + return (*[]int32)(p.p) + } +*/ +func (p pointer) getInt32Ptr() *int32 { + return *(**int32)(p.p) } - -// GetStructPointer reads a *struct field in the struct. -func structPointer_GetStructPointer(p structPointer, f field) structPointer { - return *(*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f))) +func (p pointer) setInt32Ptr(v int32) { + *(**int32)(p.p) = &v } -// StructPointerSlice the address of a []*struct field in the struct. -func structPointer_StructPointerSlice(p structPointer, f field) *structPointerSlice { - return (*structPointerSlice)(unsafe.Pointer(uintptr(p) + uintptr(f))) +// getInt32Slice loads a []int32 from p. +// The value returned is aliased with the original slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) getInt32Slice() []int32 { + return *(*[]int32)(p.p) } -// A structPointerSlice represents a slice of pointers to structs (themselves submessages or groups). -type structPointerSlice []structPointer - -func (v *structPointerSlice) Len() int { return len(*v) } -func (v *structPointerSlice) Index(i int) structPointer { return (*v)[i] } -func (v *structPointerSlice) Append(p structPointer) { *v = append(*v, p) } - -// A word32 is the address of a "pointer to 32-bit value" field. -type word32 **uint32 - -// IsNil reports whether *v is nil. -func word32_IsNil(p word32) bool { - return *p == nil +// setInt32Slice stores a []int32 to p. +// The value set is aliased with the input slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) setInt32Slice(v []int32) { + *(*[]int32)(p.p) = v } -// Set sets *v to point at a newly allocated word set to x. -func word32_Set(p word32, o *Buffer, x uint32) { - if len(o.uint32s) == 0 { - o.uint32s = make([]uint32, uint32PoolSize) - } - o.uint32s[0] = x - *p = &o.uint32s[0] - o.uint32s = o.uint32s[1:] +// TODO: Can we get rid of appendInt32Slice and use setInt32Slice instead? +func (p pointer) appendInt32Slice(v int32) { + s := (*[]int32)(p.p) + *s = append(*s, v) } -// Get gets the value pointed at by *v. -func word32_Get(p word32) uint32 { - return **p +func (p pointer) toUint64() *uint64 { + return (*uint64)(p.p) } - -// Word32 returns the address of a *int32, *uint32, *float32, or *enum field in the struct. -func structPointer_Word32(p structPointer, f field) word32 { - return word32((**uint32)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +func (p pointer) toUint64Ptr() **uint64 { + return (**uint64)(p.p) } - -// A word32Val is the address of a 32-bit value field. -type word32Val *uint32 - -// Set sets *p to x. -func word32Val_Set(p word32Val, x uint32) { - *p = x +func (p pointer) toUint64Slice() *[]uint64 { + return (*[]uint64)(p.p) } - -// Get gets the value pointed at by p. -func word32Val_Get(p word32Val) uint32 { - return *p +func (p pointer) toUint32() *uint32 { + return (*uint32)(p.p) } - -// Word32Val returns the address of a *int32, *uint32, *float32, or *enum field in the struct. -func structPointer_Word32Val(p structPointer, f field) word32Val { - return word32Val((*uint32)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +func (p pointer) toUint32Ptr() **uint32 { + return (**uint32)(p.p) } - -// A word32Slice is a slice of 32-bit values. -type word32Slice []uint32 - -func (v *word32Slice) Append(x uint32) { *v = append(*v, x) } -func (v *word32Slice) Len() int { return len(*v) } -func (v *word32Slice) Index(i int) uint32 { return (*v)[i] } - -// Word32Slice returns the address of a []int32, []uint32, []float32, or []enum field in the struct. -func structPointer_Word32Slice(p structPointer, f field) *word32Slice { - return (*word32Slice)(unsafe.Pointer(uintptr(p) + uintptr(f))) +func (p pointer) toUint32Slice() *[]uint32 { + return (*[]uint32)(p.p) } - -// word64 is like word32 but for 64-bit values. -type word64 **uint64 - -func word64_Set(p word64, o *Buffer, x uint64) { - if len(o.uint64s) == 0 { - o.uint64s = make([]uint64, uint64PoolSize) - } - o.uint64s[0] = x - *p = &o.uint64s[0] - o.uint64s = o.uint64s[1:] +func (p pointer) toBool() *bool { + return (*bool)(p.p) } - -func word64_IsNil(p word64) bool { - return *p == nil +func (p pointer) toBoolPtr() **bool { + return (**bool)(p.p) } - -func word64_Get(p word64) uint64 { - return **p +func (p pointer) toBoolSlice() *[]bool { + return (*[]bool)(p.p) +} +func (p pointer) toFloat64() *float64 { + return (*float64)(p.p) +} +func (p pointer) toFloat64Ptr() **float64 { + return (**float64)(p.p) +} +func (p pointer) toFloat64Slice() *[]float64 { + return (*[]float64)(p.p) +} +func (p pointer) toFloat32() *float32 { + return (*float32)(p.p) +} +func (p pointer) toFloat32Ptr() **float32 { + return (**float32)(p.p) +} +func (p pointer) toFloat32Slice() *[]float32 { + return (*[]float32)(p.p) +} +func (p pointer) toString() *string { + return (*string)(p.p) +} +func (p pointer) toStringPtr() **string { + return (**string)(p.p) +} +func (p pointer) toStringSlice() *[]string { + return (*[]string)(p.p) +} +func (p pointer) toBytes() *[]byte { + return (*[]byte)(p.p) +} +func (p pointer) toBytesSlice() *[][]byte { + return (*[][]byte)(p.p) +} +func (p pointer) toExtensions() *XXX_InternalExtensions { + return (*XXX_InternalExtensions)(p.p) +} +func (p pointer) toOldExtensions() *map[int32]Extension { + return (*map[int32]Extension)(p.p) } -func structPointer_Word64(p structPointer, f field) word64 { - return word64((**uint64)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +// getPointerSlice loads []*T from p as a []pointer. +// The value returned is aliased with the original slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) getPointerSlice() []pointer { + // Super-tricky - p should point to a []*T where T is a + // message type. We load it as []pointer. + return *(*[]pointer)(p.p) } -// word64Val is like word32Val but for 64-bit values. -type word64Val *uint64 +// setPointerSlice stores []pointer into p as a []*T. +// The value set is aliased with the input slice. +// This behavior differs from the implementation in pointer_reflect.go. +func (p pointer) setPointerSlice(v []pointer) { + // Super-tricky - p should point to a []*T where T is a + // message type. We store it as []pointer. + *(*[]pointer)(p.p) = v +} -func word64Val_Set(p word64Val, o *Buffer, x uint64) { - *p = x +// getPointer loads the pointer at p and returns it. +func (p pointer) getPointer() pointer { + return pointer{p: *(*unsafe.Pointer)(p.p)} } -func word64Val_Get(p word64Val) uint64 { - return *p +// setPointer stores the pointer q at p. +func (p pointer) setPointer(q pointer) { + *(*unsafe.Pointer)(p.p) = q.p } -func structPointer_Word64Val(p structPointer, f field) word64Val { - return word64Val((*uint64)(unsafe.Pointer(uintptr(p) + uintptr(f)))) +// append q to the slice pointed to by p. +func (p pointer) appendPointer(q pointer) { + s := (*[]unsafe.Pointer)(p.p) + *s = append(*s, q.p) } -// word64Slice is like word32Slice but for 64-bit values. -type word64Slice []uint64 +// getInterfacePointer returns a pointer that points to the +// interface data of the interface pointed by p. +func (p pointer) getInterfacePointer() pointer { + // Super-tricky - read pointer out of data word of interface value. + return pointer{p: (*(*[2]unsafe.Pointer)(p.p))[1]} +} -func (v *word64Slice) Append(x uint64) { *v = append(*v, x) } -func (v *word64Slice) Len() int { return len(*v) } -func (v *word64Slice) Index(i int) uint64 { return (*v)[i] } +// asPointerTo returns a reflect.Value that is a pointer to an +// object of type t stored at p. +func (p pointer) asPointerTo(t reflect.Type) reflect.Value { + return reflect.NewAt(t, p.p) +} -func structPointer_Word64Slice(p structPointer, f field) *word64Slice { - return (*word64Slice)(unsafe.Pointer(uintptr(p) + uintptr(f))) +func atomicLoadUnmarshalInfo(p **unmarshalInfo) *unmarshalInfo { + return (*unmarshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreUnmarshalInfo(p **unmarshalInfo, v *unmarshalInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) +} +func atomicLoadMarshalInfo(p **marshalInfo) *marshalInfo { + return (*marshalInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreMarshalInfo(p **marshalInfo, v *marshalInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) +} +func atomicLoadMergeInfo(p **mergeInfo) *mergeInfo { + return (*mergeInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreMergeInfo(p **mergeInfo, v *mergeInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) +} +func atomicLoadDiscardInfo(p **discardInfo) *discardInfo { + return (*discardInfo)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(p)))) +} +func atomicStoreDiscardInfo(p **discardInfo, v *discardInfo) { + atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(p)), unsafe.Pointer(v)) } diff --git a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go index f156a29f0e83..aca8eed02a11 100644 --- a/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go +++ b/vendor/github.com/gogo/protobuf/proto/pointer_unsafe_gogo.go @@ -1,6 +1,6 @@ // Protocol Buffers for Go with Gadgets // -// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// Copyright (c) 2018, The GoGo Authors. All rights reserved. // http://github.com/gogo/protobuf // // Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// +build !appengine,!js +// +build !purego,!appengine,!js // This file contains the implementation of the proto field accesses using package unsafe. @@ -37,92 +37,20 @@ import ( "unsafe" ) -func structPointer_InterfaceAt(p structPointer, f field, t reflect.Type) interface{} { - point := unsafe.Pointer(uintptr(p) + uintptr(f)) - r := reflect.NewAt(t, point) - return r.Interface() +func (p pointer) getRef() pointer { + return pointer{p: (unsafe.Pointer)(&p.p)} } -func structPointer_InterfaceRef(p structPointer, f field, t reflect.Type) interface{} { - point := unsafe.Pointer(uintptr(p) + uintptr(f)) - r := reflect.NewAt(t, point) - if r.Elem().IsNil() { - return nil - } - return r.Elem().Interface() +func (p pointer) appendRef(v pointer, typ reflect.Type) { + slice := p.getSlice(typ) + elem := v.asPointerTo(typ).Elem() + newSlice := reflect.Append(slice, elem) + slice.Set(newSlice) } -func copyUintPtr(oldptr, newptr uintptr, size int) { - oldbytes := make([]byte, 0) - oldslice := (*reflect.SliceHeader)(unsafe.Pointer(&oldbytes)) - oldslice.Data = oldptr - oldslice.Len = size - oldslice.Cap = size - newbytes := make([]byte, 0) - newslice := (*reflect.SliceHeader)(unsafe.Pointer(&newbytes)) - newslice.Data = newptr - newslice.Len = size - newslice.Cap = size - copy(newbytes, oldbytes) -} - -func structPointer_Copy(oldptr structPointer, newptr structPointer, size int) { - copyUintPtr(uintptr(oldptr), uintptr(newptr), size) -} - -func appendStructPointer(base structPointer, f field, typ reflect.Type) structPointer { - size := typ.Elem().Size() - - oldHeader := structPointer_GetSliceHeader(base, f) - oldSlice := reflect.NewAt(typ, unsafe.Pointer(oldHeader)).Elem() - newLen := oldHeader.Len + 1 - newSlice := reflect.MakeSlice(typ, newLen, newLen) - reflect.Copy(newSlice, oldSlice) - bas := toStructPointer(newSlice) - oldHeader.Data = uintptr(bas) - oldHeader.Len = newLen - oldHeader.Cap = newLen - - return structPointer(unsafe.Pointer(uintptr(unsafe.Pointer(bas)) + uintptr(uintptr(newLen-1)*size))) -} - -func structPointer_FieldPointer(p structPointer, f field) structPointer { - return structPointer(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -func structPointer_GetRefStructPointer(p structPointer, f field) structPointer { - return structPointer((*structPointer)(unsafe.Pointer(uintptr(p) + uintptr(f)))) -} - -func structPointer_GetSliceHeader(p structPointer, f field) *reflect.SliceHeader { - return (*reflect.SliceHeader)(unsafe.Pointer(uintptr(p) + uintptr(f))) -} - -func structPointer_Add(p structPointer, size field) structPointer { - return structPointer(unsafe.Pointer(uintptr(p) + uintptr(size))) -} - -func structPointer_Len(p structPointer, f field) int { - return len(*(*[]interface{})(unsafe.Pointer(structPointer_GetRefStructPointer(p, f)))) -} - -func structPointer_StructRefSlice(p structPointer, f field, size uintptr) *structRefSlice { - return &structRefSlice{p: p, f: f, size: size} -} - -// A structRefSlice represents a slice of structs (themselves submessages or groups). -type structRefSlice struct { - p structPointer - f field - size uintptr -} - -func (v *structRefSlice) Len() int { - return structPointer_Len(v.p, v.f) -} - -func (v *structRefSlice) Index(i int) structPointer { - ss := structPointer_GetStructPointer(v.p, v.f) - ss1 := structPointer_GetRefStructPointer(ss, 0) - return structPointer_Add(ss1, field(uintptr(i)*v.size)) +func (p pointer) getSlice(typ reflect.Type) reflect.Value { + sliceTyp := reflect.SliceOf(typ) + slice := p.asPointerTo(sliceTyp) + slice = slice.Elem() + return slice } diff --git a/vendor/github.com/gogo/protobuf/proto/properties.go b/vendor/github.com/gogo/protobuf/proto/properties.go index 2a69e8862d56..28da1475fb39 100644 --- a/vendor/github.com/gogo/protobuf/proto/properties.go +++ b/vendor/github.com/gogo/protobuf/proto/properties.go @@ -43,7 +43,6 @@ package proto import ( "fmt" "log" - "os" "reflect" "sort" "strconv" @@ -63,42 +62,6 @@ const ( WireFixed32 = 5 ) -const startSize = 10 // initial slice/string sizes - -// Encoders are defined in encode.go -// An encoder outputs the full representation of a field, including its -// tag and encoder type. -type encoder func(p *Buffer, prop *Properties, base structPointer) error - -// A valueEncoder encodes a single integer in a particular encoding. -type valueEncoder func(o *Buffer, x uint64) error - -// Sizers are defined in encode.go -// A sizer returns the encoded size of a field, including its tag and encoder -// type. -type sizer func(prop *Properties, base structPointer) int - -// A valueSizer returns the encoded size of a single integer in a particular -// encoding. -type valueSizer func(x uint64) int - -// Decoders are defined in decode.go -// A decoder creates a value from its wire representation. -// Unrecognized subelements are saved in unrec. -type decoder func(p *Buffer, prop *Properties, base structPointer) error - -// A valueDecoder decodes a single integer in a particular encoding. -type valueDecoder func(o *Buffer) (x uint64, err error) - -// A oneofMarshaler does the marshaling for all oneof fields in a message. -type oneofMarshaler func(Message, *Buffer) error - -// A oneofUnmarshaler does the unmarshaling for a oneof field in a message. -type oneofUnmarshaler func(Message, int, int, *Buffer) (bool, error) - -// A oneofSizer does the sizing for all oneof fields in a message. -type oneofSizer func(Message) int - // tagMap is an optimization over map[int]int for typical protocol buffer // use-cases. Encoded protocol buffers are often in tag order with small tag // numbers. @@ -145,13 +108,6 @@ type StructProperties struct { decoderTags tagMap // map from proto tag to struct field number decoderOrigNames map[string]int // map from original name to struct field number order []int // list of struct field numbers in tag order - unrecField field // field id of the XXX_unrecognized []byte field - extendable bool // is this an extendable proto - - oneofMarshaler oneofMarshaler - oneofUnmarshaler oneofUnmarshaler - oneofSizer oneofSizer - stype reflect.Type // OneofTypes contains information about the oneof fields in this message. // It is keyed by the original name of a field. @@ -187,7 +143,7 @@ type Properties struct { Repeated bool Packed bool // relevant for repeated primitives only Enum string // set for enum types only - proto3 bool // whether this is known to be a proto3 field; set for []byte only + proto3 bool // whether this is known to be a proto3 field oneof bool // whether this is a oneof field Default string // default value @@ -196,37 +152,21 @@ type Properties struct { CastType string StdTime bool StdDuration bool + WktPointer bool + + stype reflect.Type // set for struct types only + ctype reflect.Type // set for custom types only + sprop *StructProperties // set for struct types only - enc encoder - valEnc valueEncoder // set for bool and numeric types only - field field - tagcode []byte // encoding of EncodeVarint((Tag<<3)|WireType) - tagbuf [8]byte - stype reflect.Type // set for struct types only - sstype reflect.Type // set for slices of structs types only - ctype reflect.Type // set for custom types only - sprop *StructProperties // set for struct types only - isMarshaler bool - isUnmarshaler bool - - mtype reflect.Type // set for map types only - mkeyprop *Properties // set for map types only - mvalprop *Properties // set for map types only - - size sizer - valSize valueSizer // set for bool and numeric types only - - dec decoder - valDec valueDecoder // set for bool and numeric types only - - // If this is a packable field, this will be the decoder for the packed version of the field. - packedDec decoder + mtype reflect.Type // set for map types only + MapKeyProp *Properties // set for map types only + MapValProp *Properties // set for map types only } // String formats the properties in the protobuf struct field tag style. func (p *Properties) String() string { s := p.Wire - s = "," + s += "," s += strconv.Itoa(p.Tag) if p.Required { s += ",req" @@ -264,7 +204,7 @@ func (p *Properties) Parse(s string) { // "bytes,49,opt,name=foo,def=hello!" fields := strings.Split(s, ",") // breaks def=, but handled below. if len(fields) < 2 { - fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s) + log.Printf("proto: tag has too few fields: %q", s) return } @@ -272,34 +212,19 @@ func (p *Properties) Parse(s string) { switch p.Wire { case "varint": p.WireType = WireVarint - p.valEnc = (*Buffer).EncodeVarint - p.valDec = (*Buffer).DecodeVarint - p.valSize = sizeVarint case "fixed32": p.WireType = WireFixed32 - p.valEnc = (*Buffer).EncodeFixed32 - p.valDec = (*Buffer).DecodeFixed32 - p.valSize = sizeFixed32 case "fixed64": p.WireType = WireFixed64 - p.valEnc = (*Buffer).EncodeFixed64 - p.valDec = (*Buffer).DecodeFixed64 - p.valSize = sizeFixed64 case "zigzag32": p.WireType = WireVarint - p.valEnc = (*Buffer).EncodeZigzag32 - p.valDec = (*Buffer).DecodeZigzag32 - p.valSize = sizeZigzag32 case "zigzag64": p.WireType = WireVarint - p.valEnc = (*Buffer).EncodeZigzag64 - p.valDec = (*Buffer).DecodeZigzag64 - p.valSize = sizeZigzag64 case "bytes", "group": p.WireType = WireBytes // no numeric converter for non-numeric types default: - fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s) + log.Printf("proto: tag has unknown wire type: %q", s) return } @@ -309,6 +234,7 @@ func (p *Properties) Parse(s string) { return } +outer: for i := 2; i < len(fields); i++ { f := fields[i] switch { @@ -336,7 +262,7 @@ func (p *Properties) Parse(s string) { if i+1 < len(fields) { // Commas aren't escaped, and def is always last. p.Default += "," + strings.Join(fields[i+1:], ",") - break + break outer } case strings.HasPrefix(f, "embedded="): p.OrigName = strings.Split(f, "=")[1] @@ -348,301 +274,58 @@ func (p *Properties) Parse(s string) { p.StdTime = true case f == "stdduration": p.StdDuration = true + case f == "wktptr": + p.WktPointer = true } } } -func logNoSliceEnc(t1, t2 reflect.Type) { - fmt.Fprintf(os.Stderr, "proto: no slice oenc for %T = []%T\n", t1, t2) -} - var protoMessageType = reflect.TypeOf((*Message)(nil)).Elem() -// Initialize the fields for encoding and decoding. -func (p *Properties) setEncAndDec(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { - p.enc = nil - p.dec = nil - p.size = nil +// setFieldProps initializes the field properties for submessages and maps. +func (p *Properties) setFieldProps(typ reflect.Type, f *reflect.StructField, lockGetProp bool) { isMap := typ.Kind() == reflect.Map if len(p.CustomType) > 0 && !isMap { - p.setCustomEncAndDec(typ) + p.ctype = typ p.setTag(lockGetProp) return } if p.StdTime && !isMap { - p.setTimeEncAndDec(typ) p.setTag(lockGetProp) return } if p.StdDuration && !isMap { - p.setDurationEncAndDec(typ) + p.setTag(lockGetProp) + return + } + if p.WktPointer && !isMap { p.setTag(lockGetProp) return } switch t1 := typ; t1.Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no coders for %v\n", t1) - - // proto3 scalar types - - case reflect.Bool: - if p.proto3 { - p.enc = (*Buffer).enc_proto3_bool - p.dec = (*Buffer).dec_proto3_bool - p.size = size_proto3_bool - } else { - p.enc = (*Buffer).enc_ref_bool - p.dec = (*Buffer).dec_proto3_bool - p.size = size_ref_bool - } - case reflect.Int32: - if p.proto3 { - p.enc = (*Buffer).enc_proto3_int32 - p.dec = (*Buffer).dec_proto3_int32 - p.size = size_proto3_int32 - } else { - p.enc = (*Buffer).enc_ref_int32 - p.dec = (*Buffer).dec_proto3_int32 - p.size = size_ref_int32 - } - case reflect.Uint32: - if p.proto3 { - p.enc = (*Buffer).enc_proto3_uint32 - p.dec = (*Buffer).dec_proto3_int32 // can reuse - p.size = size_proto3_uint32 - } else { - p.enc = (*Buffer).enc_ref_uint32 - p.dec = (*Buffer).dec_proto3_int32 // can reuse - p.size = size_ref_uint32 - } - case reflect.Int64, reflect.Uint64: - if p.proto3 { - p.enc = (*Buffer).enc_proto3_int64 - p.dec = (*Buffer).dec_proto3_int64 - p.size = size_proto3_int64 - } else { - p.enc = (*Buffer).enc_ref_int64 - p.dec = (*Buffer).dec_proto3_int64 - p.size = size_ref_int64 - } - case reflect.Float32: - if p.proto3 { - p.enc = (*Buffer).enc_proto3_uint32 // can just treat them as bits - p.dec = (*Buffer).dec_proto3_int32 - p.size = size_proto3_uint32 - } else { - p.enc = (*Buffer).enc_ref_uint32 // can just treat them as bits - p.dec = (*Buffer).dec_proto3_int32 - p.size = size_ref_uint32 - } - case reflect.Float64: - if p.proto3 { - p.enc = (*Buffer).enc_proto3_int64 // can just treat them as bits - p.dec = (*Buffer).dec_proto3_int64 - p.size = size_proto3_int64 - } else { - p.enc = (*Buffer).enc_ref_int64 // can just treat them as bits - p.dec = (*Buffer).dec_proto3_int64 - p.size = size_ref_int64 - } - case reflect.String: - if p.proto3 { - p.enc = (*Buffer).enc_proto3_string - p.dec = (*Buffer).dec_proto3_string - p.size = size_proto3_string - } else { - p.enc = (*Buffer).enc_ref_string - p.dec = (*Buffer).dec_proto3_string - p.size = size_ref_string - } case reflect.Struct: p.stype = typ - p.isMarshaler = isMarshaler(typ) - p.isUnmarshaler = isUnmarshaler(typ) - if p.Wire == "bytes" { - p.enc = (*Buffer).enc_ref_struct_message - p.dec = (*Buffer).dec_ref_struct_message - p.size = size_ref_struct_message - } else { - fmt.Fprintf(os.Stderr, "proto: no coders for struct %T\n", typ) - } - case reflect.Ptr: - switch t2 := t1.Elem(); t2.Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no encoder function for %v -> %v\n", t1, t2) - break - case reflect.Bool: - p.enc = (*Buffer).enc_bool - p.dec = (*Buffer).dec_bool - p.size = size_bool - case reflect.Int32: - p.enc = (*Buffer).enc_int32 - p.dec = (*Buffer).dec_int32 - p.size = size_int32 - case reflect.Uint32: - p.enc = (*Buffer).enc_uint32 - p.dec = (*Buffer).dec_int32 // can reuse - p.size = size_uint32 - case reflect.Int64, reflect.Uint64: - p.enc = (*Buffer).enc_int64 - p.dec = (*Buffer).dec_int64 - p.size = size_int64 - case reflect.Float32: - p.enc = (*Buffer).enc_uint32 // can just treat them as bits - p.dec = (*Buffer).dec_int32 - p.size = size_uint32 - case reflect.Float64: - p.enc = (*Buffer).enc_int64 // can just treat them as bits - p.dec = (*Buffer).dec_int64 - p.size = size_int64 - case reflect.String: - p.enc = (*Buffer).enc_string - p.dec = (*Buffer).dec_string - p.size = size_string - case reflect.Struct: + if t1.Elem().Kind() == reflect.Struct { p.stype = t1.Elem() - p.isMarshaler = isMarshaler(t1) - p.isUnmarshaler = isUnmarshaler(t1) - if p.Wire == "bytes" { - p.enc = (*Buffer).enc_struct_message - p.dec = (*Buffer).dec_struct_message - p.size = size_struct_message - } else { - p.enc = (*Buffer).enc_struct_group - p.dec = (*Buffer).dec_struct_group - p.size = size_struct_group - } } - case reflect.Slice: switch t2 := t1.Elem(); t2.Kind() { - default: - logNoSliceEnc(t1, t2) - break - case reflect.Bool: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_bool - p.size = size_slice_packed_bool - } else { - p.enc = (*Buffer).enc_slice_bool - p.size = size_slice_bool - } - p.dec = (*Buffer).dec_slice_bool - p.packedDec = (*Buffer).dec_slice_packed_bool - case reflect.Int32: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_int32 - p.size = size_slice_packed_int32 - } else { - p.enc = (*Buffer).enc_slice_int32 - p.size = size_slice_int32 - } - p.dec = (*Buffer).dec_slice_int32 - p.packedDec = (*Buffer).dec_slice_packed_int32 - case reflect.Uint32: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_uint32 - p.size = size_slice_packed_uint32 - } else { - p.enc = (*Buffer).enc_slice_uint32 - p.size = size_slice_uint32 - } - p.dec = (*Buffer).dec_slice_int32 - p.packedDec = (*Buffer).dec_slice_packed_int32 - case reflect.Int64, reflect.Uint64: - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_int64 - p.size = size_slice_packed_int64 - } else { - p.enc = (*Buffer).enc_slice_int64 - p.size = size_slice_int64 - } - p.dec = (*Buffer).dec_slice_int64 - p.packedDec = (*Buffer).dec_slice_packed_int64 - case reflect.Uint8: - p.dec = (*Buffer).dec_slice_byte - if p.proto3 { - p.enc = (*Buffer).enc_proto3_slice_byte - p.size = size_proto3_slice_byte - } else { - p.enc = (*Buffer).enc_slice_byte - p.size = size_slice_byte - } - case reflect.Float32, reflect.Float64: - switch t2.Bits() { - case 32: - // can just treat them as bits - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_uint32 - p.size = size_slice_packed_uint32 - } else { - p.enc = (*Buffer).enc_slice_uint32 - p.size = size_slice_uint32 - } - p.dec = (*Buffer).dec_slice_int32 - p.packedDec = (*Buffer).dec_slice_packed_int32 - case 64: - // can just treat them as bits - if p.Packed { - p.enc = (*Buffer).enc_slice_packed_int64 - p.size = size_slice_packed_int64 - } else { - p.enc = (*Buffer).enc_slice_int64 - p.size = size_slice_int64 - } - p.dec = (*Buffer).dec_slice_int64 - p.packedDec = (*Buffer).dec_slice_packed_int64 - default: - logNoSliceEnc(t1, t2) - break - } - case reflect.String: - p.enc = (*Buffer).enc_slice_string - p.dec = (*Buffer).dec_slice_string - p.size = size_slice_string case reflect.Ptr: switch t3 := t2.Elem(); t3.Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no ptr oenc for %T -> %T -> %T\n", t1, t2, t3) - break case reflect.Struct: - p.stype = t2.Elem() - p.isMarshaler = isMarshaler(t2) - p.isUnmarshaler = isUnmarshaler(t2) - if p.Wire == "bytes" { - p.enc = (*Buffer).enc_slice_struct_message - p.dec = (*Buffer).dec_slice_struct_message - p.size = size_slice_struct_message - } else { - p.enc = (*Buffer).enc_slice_struct_group - p.dec = (*Buffer).dec_slice_struct_group - p.size = size_slice_struct_group - } - } - case reflect.Slice: - switch t2.Elem().Kind() { - default: - fmt.Fprintf(os.Stderr, "proto: no slice elem oenc for %T -> %T -> %T\n", t1, t2, t2.Elem()) - break - case reflect.Uint8: - p.enc = (*Buffer).enc_slice_slice_byte - p.dec = (*Buffer).dec_slice_slice_byte - p.size = size_slice_slice_byte + p.stype = t3 } case reflect.Struct: - p.setSliceOfNonPointerStructs(t1) + p.stype = t2 } case reflect.Map: - p.enc = (*Buffer).enc_new_map - p.dec = (*Buffer).dec_new_map - p.size = size_new_map p.mtype = t1 - p.mkeyprop = &Properties{} - p.mkeyprop.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp) - p.mvalprop = &Properties{} + p.MapKeyProp = &Properties{} + p.MapKeyProp.init(reflect.PtrTo(p.mtype.Key()), "Key", f.Tag.Get("protobuf_key"), nil, lockGetProp) + p.MapValProp = &Properties{} vtype := p.mtype.Elem() if vtype.Kind() != reflect.Ptr && vtype.Kind() != reflect.Slice { // The value type is not a message (*T) or bytes ([]byte), @@ -650,29 +333,16 @@ func (p *Properties) setEncAndDec(typ reflect.Type, f *reflect.StructField, lock vtype = reflect.PtrTo(vtype) } - p.mvalprop.CustomType = p.CustomType - p.mvalprop.StdDuration = p.StdDuration - p.mvalprop.StdTime = p.StdTime - p.mvalprop.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp) + p.MapValProp.CustomType = p.CustomType + p.MapValProp.StdDuration = p.StdDuration + p.MapValProp.StdTime = p.StdTime + p.MapValProp.WktPointer = p.WktPointer + p.MapValProp.init(vtype, "Value", f.Tag.Get("protobuf_val"), nil, lockGetProp) } p.setTag(lockGetProp) } func (p *Properties) setTag(lockGetProp bool) { - // precalculate tag code - wire := p.WireType - if p.Packed { - wire = WireBytes - } - x := uint32(p.Tag)<<3 | uint32(wire) - i := 0 - for i = 0; x > 127; i++ { - p.tagbuf[i] = 0x80 | uint8(x&0x7F) - x >>= 7 - } - p.tagbuf[i] = uint8(x) - p.tagcode = p.tagbuf[0 : i+1] - if p.stype != nil { if lockGetProp { p.sprop = GetProperties(p.stype) @@ -683,20 +353,9 @@ func (p *Properties) setTag(lockGetProp bool) { } var ( - marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() - unmarshalerType = reflect.TypeOf((*Unmarshaler)(nil)).Elem() + marshalerType = reflect.TypeOf((*Marshaler)(nil)).Elem() ) -// isMarshaler reports whether type t implements Marshaler. -func isMarshaler(t reflect.Type) bool { - return t.Implements(marshalerType) -} - -// isUnmarshaler reports whether type t implements Unmarshaler. -func isUnmarshaler(t reflect.Type) bool { - return t.Implements(unmarshalerType) -} - // Init populates the properties from a protocol buffer struct tag. func (p *Properties) Init(typ reflect.Type, name, tag string, f *reflect.StructField) { p.init(typ, name, tag, f, true) @@ -706,14 +365,11 @@ func (p *Properties) init(typ reflect.Type, name, tag string, f *reflect.StructF // "bytes,49,opt,def=hello!" p.Name = name p.OrigName = name - if f != nil { - p.field = toField(f) - } if tag == "" { return } p.Parse(tag) - p.setEncAndDec(typ, f, lockGetProp) + p.setFieldProps(typ, f, lockGetProp) } var ( @@ -734,9 +390,6 @@ func GetProperties(t reflect.Type) *StructProperties { sprop, ok := propertiesMap[t] propertiesMu.RUnlock() if ok { - if collectStats { - stats.Chit++ - } return sprop } @@ -746,27 +399,26 @@ 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. propertiesMap[t] = prop // build properties - prop.extendable = reflect.PtrTo(t).Implements(extendableProtoType) || - reflect.PtrTo(t).Implements(extendableProtoV1Type) || - reflect.PtrTo(t).Implements(extendableBytesType) - prop.unrecField = invalidField prop.Prop = make([]*Properties, t.NumField()) prop.order = make([]int, t.NumField()) @@ -777,23 +429,6 @@ func getPropertiesLocked(t reflect.Type) *StructProperties { name := f.Name p.init(f.Type, name, f.Tag.Get("protobuf"), &f, false) - if f.Name == "XXX_InternalExtensions" { // special case - p.enc = (*Buffer).enc_exts - p.dec = nil // not needed - p.size = size_exts - } else if f.Name == "XXX_extensions" { // special case - if len(f.Tag.Get("protobuf")) > 0 { - p.enc = (*Buffer).enc_ext_slice_byte - p.dec = nil // not needed - p.size = size_ext_slice_byte - } else { - p.enc = (*Buffer).enc_map - p.dec = nil // not needed - p.size = size_map - } - } else if f.Name == "XXX_unrecognized" { // special case - prop.unrecField = toField(&f) - } oneof := f.Tag.Get("protobuf_oneof") // special case if oneof != "" { isOneofMessage = true @@ -809,46 +444,45 @@ func getPropertiesLocked(t reflect.Type) *StructProperties { } print("\n") } - if p.enc == nil && !strings.HasPrefix(f.Name, "XXX_") && oneof == "" { - fmt.Fprintln(os.Stderr, "proto: no encoder for", f.Name, f.Type.String(), "[GetProperties]") - } } // 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{}) - } - if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); isOneofMessage && ok { + if isOneofMessage { var oots []interface{} - prop.oneofMarshaler, prop.oneofUnmarshaler, prop.oneofSizer, oots = om.XXX_OneofFuncs() - prop.stype = t - - // Interpret oneof metadata. - prop.OneofTypes = make(map[string]*OneofProperties) - for _, oot := range oots { - oop := &OneofProperties{ - Type: reflect.ValueOf(oot).Type(), // *T - Prop: new(Properties), - } - sft := oop.Type.Elem().Field(0) - oop.Prop.Name = sft.Name - oop.Prop.Parse(sft.Tag.Get("protobuf")) - // There will be exactly one interface field that - // this new value is assignable to. - for i := 0; i < t.NumField(); i++ { - f := t.Field(i) - if f.Type.Kind() != reflect.Interface { - continue + switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { + case oneofFuncsIface: + _, _, _, oots = m.XXX_OneofFuncs() + case oneofWrappersIface: + oots = m.XXX_OneofWrappers() + } + if len(oots) > 0 { + // Interpret oneof metadata. + prop.OneofTypes = make(map[string]*OneofProperties) + for _, oot := range oots { + oop := &OneofProperties{ + Type: reflect.ValueOf(oot).Type(), // *T + Prop: new(Properties), } - if !oop.Type.AssignableTo(f.Type) { - continue + sft := oop.Type.Elem().Field(0) + oop.Prop.Name = sft.Name + oop.Prop.Parse(sft.Tag.Get("protobuf")) + // There will be exactly one interface field that + // this new value is assignable to. + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) + if f.Type.Kind() != reflect.Interface { + continue + } + if !oop.Type.AssignableTo(f.Type) { + continue + } + oop.Field = i + break } - oop.Field = i - break + prop.OneofTypes[oop.Prop.OrigName] = oop } - prop.OneofTypes[oop.Prop.OrigName] = oop } } @@ -873,30 +507,6 @@ func getPropertiesLocked(t reflect.Type) *StructProperties { return prop } -// Return the Properties object for the x[0]'th field of the structure. -func propByIndex(t reflect.Type, x []int) *Properties { - if len(x) != 1 { - fmt.Fprintf(os.Stderr, "proto: field index dimension %d (not 1) for type %s\n", len(x), t) - return nil - } - prop := GetProperties(t) - return prop.Prop[x[0]] -} - -// Get the address and type of a pointer to a struct from an interface. -func getbase(pb Message) (t reflect.Type, b structPointer, err error) { - if pb == nil { - err = ErrNil - return - } - // get the reflect type of the pointer to the struct. - t = reflect.TypeOf(pb) - // get the address of the struct. - value := reflect.ValueOf(pb) - b = toStructPointer(value) - return -} - // A global registry of enum types. // The generated code will register the generated maps by calling RegisterEnum. @@ -925,20 +535,42 @@ func EnumValueMap(enumType string) map[string]int32 { // A registry of all linked message types. // The string is a fully-qualified proto name ("pkg.Message"). var ( - protoTypes = make(map[string]reflect.Type) - revProtoTypes = make(map[reflect.Type]string) + protoTypedNils = make(map[string]Message) // a map from proto names to typed nil pointers + protoMapTypes = make(map[string]reflect.Type) // a map from proto names to map types + revProtoTypes = make(map[reflect.Type]string) ) // RegisterType is called from generated code and maps from the fully qualified // proto name to the type (pointer to struct) of the protocol buffer. func RegisterType(x Message, name string) { - if _, ok := protoTypes[name]; ok { + if _, ok := protoTypedNils[name]; ok { // TODO: Some day, make this a panic. log.Printf("proto: duplicate proto type registered: %s", name) return } t := reflect.TypeOf(x) - protoTypes[name] = t + if v := reflect.ValueOf(x); v.Kind() == reflect.Ptr && v.Pointer() == 0 { + // Generated code always calls RegisterType with nil x. + // This check is just for extra safety. + protoTypedNils[name] = x + } else { + protoTypedNils[name] = reflect.Zero(t).Interface().(Message) + } + revProtoTypes[t] = name +} + +// RegisterMapType is called from generated code and maps from the fully qualified +// proto name to the native map type of the proto map definition. +func RegisterMapType(x interface{}, name string) { + if reflect.TypeOf(x).Kind() != reflect.Map { + panic(fmt.Sprintf("RegisterMapType(%T, %q); want map", x, name)) + } + if _, ok := protoMapTypes[name]; ok { + log.Printf("proto: duplicate proto type registered: %s", name) + return + } + t := reflect.TypeOf(x) + protoMapTypes[name] = t revProtoTypes[t] = name } @@ -954,7 +586,14 @@ func MessageName(x Message) string { } // MessageType returns the message type (pointer to struct) for a named message. -func MessageType(name string) reflect.Type { return protoTypes[name] } +// The type is not guaranteed to implement proto.Message if the name refers to a +// map entry. +func MessageType(name string) reflect.Type { + if t, ok := protoTypedNils[name]; ok { + return reflect.TypeOf(t) + } + return protoMapTypes[name] +} // A registry of all linked proto files. var ( diff --git a/vendor/github.com/gogo/protobuf/proto/properties_gogo.go b/vendor/github.com/gogo/protobuf/proto/properties_gogo.go index b6b7176c5656..40ea3dd935c2 100644 --- a/vendor/github.com/gogo/protobuf/proto/properties_gogo.go +++ b/vendor/github.com/gogo/protobuf/proto/properties_gogo.go @@ -1,6 +1,6 @@ // Protocol Buffers for Go with Gadgets // -// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// Copyright (c) 2018, The GoGo Authors. All rights reserved. // http://github.com/gogo/protobuf // // Redistribution and use in source and binary forms, with or without @@ -29,83 +29,8 @@ package proto import ( - "fmt" - "os" "reflect" ) -func (p *Properties) setCustomEncAndDec(typ reflect.Type) { - p.ctype = typ - if p.Repeated { - p.enc = (*Buffer).enc_custom_slice_bytes - p.dec = (*Buffer).dec_custom_slice_bytes - p.size = size_custom_slice_bytes - } else if typ.Kind() == reflect.Ptr { - p.enc = (*Buffer).enc_custom_bytes - p.dec = (*Buffer).dec_custom_bytes - p.size = size_custom_bytes - } else { - p.enc = (*Buffer).enc_custom_ref_bytes - p.dec = (*Buffer).dec_custom_ref_bytes - p.size = size_custom_ref_bytes - } -} - -func (p *Properties) setDurationEncAndDec(typ reflect.Type) { - if p.Repeated { - if typ.Elem().Kind() == reflect.Ptr { - p.enc = (*Buffer).enc_slice_duration - p.dec = (*Buffer).dec_slice_duration - p.size = size_slice_duration - } else { - p.enc = (*Buffer).enc_slice_ref_duration - p.dec = (*Buffer).dec_slice_ref_duration - p.size = size_slice_ref_duration - } - } else if typ.Kind() == reflect.Ptr { - p.enc = (*Buffer).enc_duration - p.dec = (*Buffer).dec_duration - p.size = size_duration - } else { - p.enc = (*Buffer).enc_ref_duration - p.dec = (*Buffer).dec_ref_duration - p.size = size_ref_duration - } -} - -func (p *Properties) setTimeEncAndDec(typ reflect.Type) { - if p.Repeated { - if typ.Elem().Kind() == reflect.Ptr { - p.enc = (*Buffer).enc_slice_time - p.dec = (*Buffer).dec_slice_time - p.size = size_slice_time - } else { - p.enc = (*Buffer).enc_slice_ref_time - p.dec = (*Buffer).dec_slice_ref_time - p.size = size_slice_ref_time - } - } else if typ.Kind() == reflect.Ptr { - p.enc = (*Buffer).enc_time - p.dec = (*Buffer).dec_time - p.size = size_time - } else { - p.enc = (*Buffer).enc_ref_time - p.dec = (*Buffer).dec_ref_time - p.size = size_ref_time - } - -} - -func (p *Properties) setSliceOfNonPointerStructs(typ reflect.Type) { - t2 := typ.Elem() - p.sstype = typ - p.stype = t2 - p.isMarshaler = isMarshaler(t2) - p.isUnmarshaler = isUnmarshaler(t2) - p.enc = (*Buffer).enc_slice_ref_struct_message - p.dec = (*Buffer).dec_slice_ref_struct_message - p.size = size_slice_ref_struct_message - if p.Wire != "bytes" { - fmt.Fprintf(os.Stderr, "proto: no ptr oenc for %T -> %T \n", typ, t2) - } -} +var sizerType = reflect.TypeOf((*Sizer)(nil)).Elem() +var protosizerType = reflect.TypeOf((*ProtoSizer)(nil)).Elem() diff --git a/vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/table_marshal.go b/vendor/github.com/gogo/protobuf/proto/table_marshal.go similarity index 90% rename from vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/table_marshal.go rename to vendor/github.com/gogo/protobuf/proto/table_marshal.go index 5cb11fa955e4..f8babdefab94 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/table_marshal.go +++ b/vendor/github.com/gogo/protobuf/proto/table_marshal.go @@ -65,6 +65,11 @@ type marshalInfo struct { hasmarshaler bool // has custom marshaler sync.RWMutex // protect extElems map, also for initialization extElems map[int32]*marshalElemInfo // info of extension elements + + hassizer bool // has custom sizer + hasprotosizer bool // has custom protosizer + + bytesExtensions field // offset of XXX_extensions where the field type is []byte } // marshalFieldInfo is the information used for marshaling a field of a message. @@ -87,12 +92,13 @@ 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 ( marshalInfoMap = map[reflect.Type]*marshalInfo{} marshalInfoLock sync.Mutex + + uint8SliceType = reflect.TypeOf(([]uint8)(nil)).Kind() ) // getMarshalInfo returns the information to marshal a given type of message. @@ -169,6 +175,17 @@ func (u *marshalInfo) size(ptr pointer) int { // If the message can marshal itself, let it do it, for compatibility. // NOTE: This is not efficient. if u.hasmarshaler { + // Uses the message's Size method if available + if u.hassizer { + s := ptr.asPointerTo(u.typ).Interface().(Sizer) + return s.Size() + } + // Uses the message's ProtoSize method if available + if u.hasprotosizer { + s := ptr.asPointerTo(u.typ).Interface().(ProtoSizer) + return s.ProtoSize() + } + m := ptr.asPointerTo(u.typ).Interface().(Marshaler) b, _ := m.Marshal() return len(b) @@ -194,10 +211,15 @@ func (u *marshalInfo) size(ptr pointer) int { m := *ptr.offset(u.v1extensions).toOldExtensions() n += u.sizeV1Extensions(m) } + if u.bytesExtensions.IsValid() { + s := *ptr.offset(u.bytesExtensions).toBytes() + n += len(s) + } if u.unrecognized.IsValid() { s := *ptr.offset(u.unrecognized).toBytes() n += len(s) } + // cache the result for use in marshal if u.sizecache.IsValid() { atomic.StoreInt32(ptr.offset(u.sizecache).toInt32(), int32(n)) @@ -252,9 +274,13 @@ func (u *marshalInfo) marshal(b []byte, ptr pointer, deterministic bool) ([]byte return b, err } } + if u.bytesExtensions.IsValid() { + s := *ptr.offset(u.bytesExtensions).toBytes() + b = append(b, s...) + } for _, f := range u.fields { if f.required { - if ptr.offset(f.field).getPointer().isNil() { + if f.isPointer && ptr.offset(f.field).getPointer().isNil() { // Required field is not set. // We record the error but keep going, to give a complete marshaling. if errLater == nil { @@ -309,8 +335,16 @@ func (u *marshalInfo) computeMarshalInfo() { u.unrecognized = invalidField u.extensions = invalidField u.v1extensions = invalidField + u.bytesExtensions = invalidField u.sizecache = invalidField + isOneofMessage := false + if reflect.PtrTo(t).Implements(sizerType) { + u.hassizer = true + } + if reflect.PtrTo(t).Implements(protosizerType) { + u.hasprotosizer = true + } // If the message can marshal itself, let it do it, for compatibility. // NOTE: This is not efficient. if reflect.PtrTo(t).Implements(marshalerType) { @@ -319,20 +353,14 @@ func (u *marshalInfo) computeMarshalInfo() { return } - // get oneof implementers - var oneofImplementers []interface{} - switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { - case oneofFuncsIface: - _, _, _, oneofImplementers = m.XXX_OneofFuncs() - case oneofWrappersIface: - oneofImplementers = m.XXX_OneofWrappers() - } - n := t.NumField() // deal with XXX fields first for i := 0; i < t.NumField(); i++ { f := t.Field(i) + if f.Tag.Get("protobuf_oneof") != "" { + isOneofMessage = true + } if !strings.HasPrefix(f.Name, "XXX_") { continue } @@ -345,7 +373,11 @@ func (u *marshalInfo) computeMarshalInfo() { u.extensions = toField(&f) u.messageset = f.Tag.Get("protobuf_messageset") == "1" case "XXX_extensions": - u.v1extensions = toField(&f) + if f.Type.Kind() == reflect.Map { + u.v1extensions = toField(&f) + } else { + u.bytesExtensions = toField(&f) + } case "XXX_NoUnkeyedLiteral": // nothing to do default: @@ -354,6 +386,18 @@ func (u *marshalInfo) computeMarshalInfo() { n-- } + // get oneof implementers + var oneofImplementers []interface{} + // gogo: isOneofMessage is needed for embedded oneof messages, without a marshaler and unmarshaler + if isOneofMessage { + switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { + case oneofFuncsIface: + _, _, _, oneofImplementers = m.XXX_OneofFuncs() + case oneofWrappersIface: + oneofImplementers = m.XXX_OneofWrappers() + } + } + // normal fields fields := make([]marshalFieldInfo, n) // batch allocation u.fields = make([]*marshalFieldInfo, 0, n) @@ -411,22 +455,13 @@ 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 - } + sizr, marshalr := typeMarshaler(t, tags, false, false) e = &marshalElemInfo{ wiretag: uint64(tag)<<3 | wt, tagsize: SizeVarint(uint64(tag) << 3), - sizer: sizer, - marshaler: marshaler, + sizer: sizr, + marshaler: marshalr, isptr: t.Kind() == reflect.Ptr, - deref: deref, } // update cache @@ -479,12 +514,12 @@ func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofI panic("tag is not an integer") } wt := wiretype(tags[0]) - sizer, marshaler := typeMarshaler(sf.Type, tags, false, true) // oneof should not omit any zero value + sizr, marshalr := typeMarshaler(sf.Type, tags, false, true) // oneof should not omit any zero value fi.oneofElems[t.Elem()] = &marshalElemInfo{ wiretag: uint64(tag)<<3 | wt, tagsize: SizeVarint(uint64(tag) << 3), - sizer: sizer, - marshaler: marshaler, + sizer: sizr, + marshaler: marshalr, } } } @@ -548,6 +583,10 @@ func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, ma packed := false proto3 := false + ctype := false + isTime := false + isDuration := false + isWktPointer := false validateUTF8 := true for i := 2; i < len(tags); i++ { if tags[i] == "packed" { @@ -556,8 +595,169 @@ func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, ma if tags[i] == "proto3" { proto3 = true } + if strings.HasPrefix(tags[i], "customtype=") { + ctype = true + } + if tags[i] == "stdtime" { + isTime = true + } + if tags[i] == "stdduration" { + isDuration = true + } + if tags[i] == "wktptr" { + isWktPointer = true + } } validateUTF8 = validateUTF8 && proto3 + if !proto3 && !pointer && !slice { + nozero = false + } + + if ctype { + if reflect.PtrTo(t).Implements(customType) { + if slice { + return makeMessageRefSliceMarshaler(getMarshalInfo(t)) + } + if pointer { + return makeCustomPtrMarshaler(getMarshalInfo(t)) + } + return makeCustomMarshaler(getMarshalInfo(t)) + } else { + panic(fmt.Sprintf("custom type: type: %v, does not implement the proto.custom interface", t)) + } + } + + if isTime { + if pointer { + if slice { + return makeTimePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeTimePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeTimeSliceMarshaler(getMarshalInfo(t)) + } + return makeTimeMarshaler(getMarshalInfo(t)) + } + + if isDuration { + if pointer { + if slice { + return makeDurationPtrSliceMarshaler(getMarshalInfo(t)) + } + return makeDurationPtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeDurationSliceMarshaler(getMarshalInfo(t)) + } + return makeDurationMarshaler(getMarshalInfo(t)) + } + + if isWktPointer { + switch t.Kind() { + case reflect.Float64: + if pointer { + if slice { + return makeStdDoubleValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdDoubleValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdDoubleValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdDoubleValueMarshaler(getMarshalInfo(t)) + case reflect.Float32: + if pointer { + if slice { + return makeStdFloatValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdFloatValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdFloatValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdFloatValueMarshaler(getMarshalInfo(t)) + case reflect.Int64: + if pointer { + if slice { + return makeStdInt64ValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdInt64ValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdInt64ValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdInt64ValueMarshaler(getMarshalInfo(t)) + case reflect.Uint64: + if pointer { + if slice { + return makeStdUInt64ValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdUInt64ValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdUInt64ValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdUInt64ValueMarshaler(getMarshalInfo(t)) + case reflect.Int32: + if pointer { + if slice { + return makeStdInt32ValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdInt32ValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdInt32ValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdInt32ValueMarshaler(getMarshalInfo(t)) + case reflect.Uint32: + if pointer { + if slice { + return makeStdUInt32ValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdUInt32ValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdUInt32ValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdUInt32ValueMarshaler(getMarshalInfo(t)) + case reflect.Bool: + if pointer { + if slice { + return makeStdBoolValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdBoolValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdBoolValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdBoolValueMarshaler(getMarshalInfo(t)) + case reflect.String: + if pointer { + if slice { + return makeStdStringValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdStringValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdStringValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdStringValueMarshaler(getMarshalInfo(t)) + case uint8SliceType: + if pointer { + if slice { + return makeStdBytesValuePtrSliceMarshaler(getMarshalInfo(t)) + } + return makeStdBytesValuePtrMarshaler(getMarshalInfo(t)) + } + if slice { + return makeStdBytesValueSliceMarshaler(getMarshalInfo(t)) + } + return makeStdBytesValueMarshaler(getMarshalInfo(t)) + default: + panic(fmt.Sprintf("unknown wktpointer type %#v", t)) + } + } switch t.Kind() { case reflect.Bool: @@ -799,10 +999,17 @@ func typeMarshaler(t reflect.Type, tags []string, nozero, oneof bool) (sizer, ma } return makeGroupMarshaler(getMarshalInfo(t)) case "bytes": - if slice { - return makeMessageSliceMarshaler(getMarshalInfo(t)) + if pointer { + if slice { + return makeMessageSliceMarshaler(getMarshalInfo(t)) + } + return makeMessageMarshaler(getMarshalInfo(t)) + } else { + if slice { + return makeMessageRefSliceMarshaler(getMarshalInfo(t)) + } + return makeMessageRefMarshaler(getMarshalInfo(t)) } - return makeMessageMarshaler(getMarshalInfo(t)) } } panic(fmt.Sprintf("unknown or mismatched type: type: %v, wire type: %v", t, encoding)) @@ -2281,8 +2488,26 @@ func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { t := f.Type keyType := t.Key() valType := t.Elem() + tags := strings.Split(f.Tag.Get("protobuf"), ",") keyTags := strings.Split(f.Tag.Get("protobuf_key"), ",") valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") + stdOptions := false + for _, t := range tags { + if strings.HasPrefix(t, "customtype=") { + valTags = append(valTags, t) + } + if t == "stdtime" { + valTags = append(valTags, t) + stdOptions = true + } + if t == "stdduration" { + valTags = append(valTags, t) + stdOptions = true + } + if t == "wktptr" { + valTags = append(valTags, t) + } + } keySizer, keyMarshaler := typeMarshaler(keyType, keyTags, false, false) // don't omit zero value in map valSizer, valMarshaler := typeMarshaler(valType, valTags, false, false) // don't omit zero value in map keyWireTag := 1<<3 | wiretype(keyTags[0]) @@ -2301,7 +2526,7 @@ func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { // If value is not message type, we don't have size cache, // but it cannot be nested either. Just use valSizer. valCachedSizer := valSizer - if valIsPtr && valType.Elem().Kind() == reflect.Struct { + if valIsPtr && !stdOptions && valType.Elem().Kind() == reflect.Struct { u := getMarshalInfo(valType.Elem()) valCachedSizer = func(ptr pointer, tagsize int) int { // Same as message sizer, but use cache. @@ -2319,8 +2544,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, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr, false) // pointer to value + kaddr := toAddrPointer(&ki, false) // pointer to key + vaddr := toAddrPointer(&vi, valIsPtr) // 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 } @@ -2338,8 +2563,8 @@ func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { for _, k := range keys { ki := k.Interface() vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr, false) // pointer to value + kaddr := toAddrPointer(&ki, false) // pointer to key + vaddr := toAddrPointer(&vi, valIsPtr) // 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)) @@ -2408,7 +2633,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, ei.deref) + p := toAddrPointer(&v, ei.isptr) n += ei.sizer(p, ei.tagsize) } mu.Unlock() @@ -2443,7 +2668,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr, ei.deref) + p := toAddrPointer(&v, ei.isptr) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) if !nerr.Merge(err) { return b, err @@ -2474,7 +2699,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr, ei.deref) + p := toAddrPointer(&v, ei.isptr) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) if !nerr.Merge(err) { return b, err @@ -2519,7 +2744,7 @@ func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr, ei.deref) + p := toAddrPointer(&v, ei.isptr) n += ei.sizer(p, 1) // message, tag = 3 (size=1) } mu.Unlock() @@ -2562,7 +2787,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr, ei.deref) + p := toAddrPointer(&v, ei.isptr) b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) if !nerr.Merge(err) { return b, err @@ -2600,7 +2825,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr, ei.deref) + p := toAddrPointer(&v, ei.isptr) b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) b = append(b, 1<<3|WireEndGroup) if !nerr.Merge(err) { @@ -2630,7 +2855,7 @@ func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr, ei.deref) + p := toAddrPointer(&v, ei.isptr) n += ei.sizer(p, ei.tagsize) } return n @@ -2665,7 +2890,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, ei.deref) + p := toAddrPointer(&v, ei.isptr) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) if !nerr.Merge(err) { return b, err @@ -2736,16 +2961,24 @@ func Marshal(pb Message) ([]byte, error) { // a Buffer for most applications. func (p *Buffer) Marshal(pb Message) error { var err error + if p.deterministic { + if _, ok := pb.(Marshaler); ok { + return fmt.Errorf("proto: deterministic not supported by the Marshal method of %T", pb) + } + } if m, ok := pb.(newMarshaler); ok { siz := m.XXX_Size() p.grow(siz) // make sure buf has enough capacity - p.buf, err = m.XXX_Marshal(p.buf, p.deterministic) + pp := p.buf[len(p.buf) : len(p.buf) : len(p.buf)+siz] + pp, err = m.XXX_Marshal(pp, p.deterministic) + p.buf = append(p.buf, pp...) return err } if m, ok := pb.(Marshaler); ok { // If the message can marshal itself, let it do it, for compatibility. // NOTE: This is not efficient. - b, err := m.Marshal() + var b []byte + b, err = m.Marshal() p.buf = append(p.buf, b...) return err } diff --git a/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go b/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go new file mode 100644 index 000000000000..997f57c1e102 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/table_marshal_gogo.go @@ -0,0 +1,388 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/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. +// +// 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 ( + "reflect" + "time" +) + +// makeMessageRefMarshaler differs a bit from makeMessageMarshaler +// It marshal a message T instead of a *T +func makeMessageRefMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + siz := u.size(ptr) + return siz + SizeVarint(uint64(siz)) + tagsize + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + b = appendVarint(b, wiretag) + siz := u.cachedsize(ptr) + b = appendVarint(b, uint64(siz)) + return u.marshal(b, ptr, deterministic) + } +} + +// makeMessageRefSliceMarshaler differs quite a lot from makeMessageSliceMarshaler +// It marshals a slice of messages []T instead of []*T +func makeMessageRefSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + e := elem.Interface() + v := toAddrPointer(&e, false) + siz := u.size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + var err, errreq error + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + e := elem.Interface() + v := toAddrPointer(&e, false) + b = appendVarint(b, wiretag) + siz := u.size(v) + b = appendVarint(b, uint64(siz)) + b, err = u.marshal(b, v, deterministic) + + if err != nil { + if _, ok := err.(*RequiredNotSetError); ok { + // Required field in submessage is not set. + // We record the error but keep going, to give a complete marshaling. + if errreq == nil { + errreq = err + } + continue + } + if err == ErrNil { + err = errRepeatedHasNil + } + return b, err + } + } + + return b, errreq + } +} + +func makeCustomPtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + m := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(custom) + siz := m.Size() + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + m := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(custom) + siz := m.Size() + buf, err := m.Marshal() + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + return b, nil + } +} + +func makeCustomMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + m := ptr.asPointerTo(u.typ).Interface().(custom) + siz := m.Size() + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + m := ptr.asPointerTo(u.typ).Interface().(custom) + siz := m.Size() + buf, err := m.Marshal() + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + return b, nil + } +} + +func makeTimeMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return 0 + } + siz := Size(ts) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return nil, err + } + buf, err := Marshal(ts) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeTimePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return 0 + } + siz := Size(ts) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return nil, err + } + buf, err := Marshal(ts) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeTimeSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(time.Time) + ts, err := timestampProto(t) + if err != nil { + return 0 + } + siz := Size(ts) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(time.Time) + ts, err := timestampProto(t) + if err != nil { + return nil, err + } + siz := Size(ts) + buf, err := Marshal(ts) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeTimePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return 0 + } + siz := Size(ts) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*time.Time) + ts, err := timestampProto(*t) + if err != nil { + return nil, err + } + siz := Size(ts) + buf, err := Marshal(ts) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeDurationMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + d := ptr.asPointerTo(u.typ).Interface().(*time.Duration) + dur := durationProto(*d) + siz := Size(dur) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + d := ptr.asPointerTo(u.typ).Interface().(*time.Duration) + dur := durationProto(*d) + buf, err := Marshal(dur) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeDurationPtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + d := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Duration) + dur := durationProto(*d) + siz := Size(dur) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + d := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*time.Duration) + dur := durationProto(*d) + buf, err := Marshal(dur) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeDurationSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + d := elem.Interface().(time.Duration) + dur := durationProto(d) + siz := Size(dur) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + d := elem.Interface().(time.Duration) + dur := durationProto(d) + siz := Size(dur) + buf, err := Marshal(dur) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeDurationPtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + d := elem.Interface().(*time.Duration) + dur := durationProto(*d) + siz := Size(dur) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + d := elem.Interface().(*time.Duration) + dur := durationProto(*d) + siz := Size(dur) + buf, err := Marshal(dur) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/table_merge.go b/vendor/github.com/gogo/protobuf/proto/table_merge.go similarity index 94% rename from vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/table_merge.go rename to vendor/github.com/gogo/protobuf/proto/table_merge.go index 5525def6a5da..60dcf70d1e6c 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/table_merge.go +++ b/vendor/github.com/gogo/protobuf/proto/table_merge.go @@ -530,10 +530,32 @@ func (mi *mergeInfo) computeMergeInfo() { } case reflect.Struct: switch { + case isSlice && !isPointer: // E.g. []pb.T + mergeInfo := getMergeInfo(tf) + zero := reflect.Zero(tf) + mfi.merge = func(dst, src pointer) { + // TODO: Make this faster? + dstsp := dst.asPointerTo(f.Type) + dsts := dstsp.Elem() + srcs := src.asPointerTo(f.Type).Elem() + for i := 0; i < srcs.Len(); i++ { + dsts = reflect.Append(dsts, zero) + srcElement := srcs.Index(i).Addr() + dstElement := dsts.Index(dsts.Len() - 1).Addr() + mergeInfo.merge(valToPointer(dstElement), valToPointer(srcElement)) + } + if dsts.IsNil() { + dsts = reflect.MakeSlice(f.Type, 0, 0) + } + dstsp.Elem().Set(dsts) + } case !isPointer: - panic(fmt.Sprintf("message field %s without pointer", tf)) + mergeInfo := getMergeInfo(tf) + mfi.merge = func(dst, src pointer) { + mergeInfo.merge(dst, src) + } case isSlice: // E.g., []*pb.T - mi := getMergeInfo(tf) + mergeInfo := getMergeInfo(tf) mfi.merge = func(dst, src pointer) { sps := src.getPointerSlice() if sps != nil { @@ -542,7 +564,7 @@ func (mi *mergeInfo) computeMergeInfo() { var dp pointer if !sp.isNil() { dp = valToPointer(reflect.New(tf)) - mi.merge(dp, sp) + mergeInfo.merge(dp, sp) } dps = append(dps, dp) } @@ -553,7 +575,7 @@ func (mi *mergeInfo) computeMergeInfo() { } } default: // E.g., *pb.T - mi := getMergeInfo(tf) + mergeInfo := getMergeInfo(tf) mfi.merge = func(dst, src pointer) { sp := src.getPointer() if !sp.isNil() { @@ -562,7 +584,7 @@ func (mi *mergeInfo) computeMergeInfo() { dp = valToPointer(reflect.New(tf)) dst.setPointer(dp) } - mi.merge(dp, sp) + mergeInfo.merge(dp, sp) } } } diff --git a/vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/table_unmarshal.go b/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go similarity index 86% rename from vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/table_unmarshal.go rename to vendor/github.com/gogo/protobuf/proto/table_unmarshal.go index acee2fc52964..937229386a27 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/linode/vendor/github.com/golang/protobuf/proto/table_unmarshal.go +++ b/vendor/github.com/gogo/protobuf/proto/table_unmarshal.go @@ -80,6 +80,8 @@ type unmarshalInfo struct { oldExtensions field // offset of old-form extensions field (of type map[int]Extension) extensionRanges []ExtensionRange // if non-nil, implies extensions field is valid isMessageSet bool // if true, implies extensions field is valid + + bytesExtensions field // offset of XXX_extensions with type []byte } // An unmarshaler takes a stream of bytes and a pointer to a field of a message. @@ -232,10 +234,13 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { z = &e.enc break } + if u.bytesExtensions.IsValid() { + z = m.offset(u.bytesExtensions).toBytes() + break + } panic("no extensions field available") } } - // Use wire type to skip data. var err error b0 := b @@ -278,6 +283,7 @@ func (u *unmarshalInfo) computeUnmarshalInfo() { u.unrecognized = invalidField u.extensions = invalidField u.oldExtensions = invalidField + u.bytesExtensions = invalidField // List of the generated type and offset for each oneof field. type oneofField struct { @@ -309,11 +315,14 @@ func (u *unmarshalInfo) computeUnmarshalInfo() { } if f.Name == "XXX_extensions" { // An older form of the extensions field. - if f.Type != reflect.TypeOf((map[int32]Extension)(nil)) { - panic("bad type for XXX_extensions field: " + f.Type.Name()) + if f.Type == reflect.TypeOf((map[int32]Extension)(nil)) { + u.oldExtensions = toField(&f) + continue + } else if f.Type == reflect.TypeOf(([]byte)(nil)) { + u.bytesExtensions = toField(&f) + continue } - u.oldExtensions = toField(&f) - continue + panic("bad type for XXX_extensions field: " + f.Type.Name()) } if f.Name == "XXX_NoUnkeyedLiteral" || f.Name == "XXX_sizecache" { continue @@ -362,50 +371,53 @@ func (u *unmarshalInfo) computeUnmarshalInfo() { } // Find any types associated with oneof fields. - 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 + // gogo: len(oneofFields) > 0 is needed for embedded oneof messages, without a marshaler and unmarshaler + if len(oneofFields) > 0 { + 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) + // 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") if fn.IsValid() { - if !u.extensions.IsValid() && !u.oldExtensions.IsValid() { + if !u.extensions.IsValid() && !u.oldExtensions.IsValid() && !u.bytesExtensions.IsValid() { panic("a message with extensions, but no extensions field in " + t.Name()) } u.extensionRanges = fn.Call(nil)[0].Interface().([]ExtensionRange) @@ -459,6 +471,10 @@ func typeUnmarshaler(t reflect.Type, tags string) unmarshaler { tagArray := strings.Split(tags, ",") encoding := tagArray[0] name := "unknown" + ctype := false + isTime := false + isDuration := false + isWktPointer := false proto3 := false validateUTF8 := true for _, tag := range tagArray[3:] { @@ -468,6 +484,18 @@ func typeUnmarshaler(t reflect.Type, tags string) unmarshaler { if tag == "proto3" { proto3 = true } + if strings.HasPrefix(tag, "customtype=") { + ctype = true + } + if tag == "stdtime" { + isTime = true + } + if tag == "stdduration" { + isDuration = true + } + if tag == "wktptr" { + isWktPointer = true + } } validateUTF8 = validateUTF8 && proto3 @@ -483,6 +511,152 @@ func typeUnmarshaler(t reflect.Type, tags string) unmarshaler { t = t.Elem() } + if ctype { + if reflect.PtrTo(t).Implements(customType) { + if slice { + return makeUnmarshalCustomSlice(getUnmarshalInfo(t), name) + } + if pointer { + return makeUnmarshalCustomPtr(getUnmarshalInfo(t), name) + } + return makeUnmarshalCustom(getUnmarshalInfo(t), name) + } else { + panic(fmt.Sprintf("custom type: type: %v, does not implement the proto.custom interface", t)) + } + } + + if isTime { + if pointer { + if slice { + return makeUnmarshalTimePtrSlice(getUnmarshalInfo(t), name) + } + return makeUnmarshalTimePtr(getUnmarshalInfo(t), name) + } + if slice { + return makeUnmarshalTimeSlice(getUnmarshalInfo(t), name) + } + return makeUnmarshalTime(getUnmarshalInfo(t), name) + } + + if isDuration { + if pointer { + if slice { + return makeUnmarshalDurationPtrSlice(getUnmarshalInfo(t), name) + } + return makeUnmarshalDurationPtr(getUnmarshalInfo(t), name) + } + if slice { + return makeUnmarshalDurationSlice(getUnmarshalInfo(t), name) + } + return makeUnmarshalDuration(getUnmarshalInfo(t), name) + } + + if isWktPointer { + switch t.Kind() { + case reflect.Float64: + if pointer { + if slice { + return makeStdDoubleValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdDoubleValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdDoubleValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdDoubleValueUnmarshaler(getUnmarshalInfo(t), name) + case reflect.Float32: + if pointer { + if slice { + return makeStdFloatValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdFloatValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdFloatValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdFloatValueUnmarshaler(getUnmarshalInfo(t), name) + case reflect.Int64: + if pointer { + if slice { + return makeStdInt64ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdInt64ValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdInt64ValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdInt64ValueUnmarshaler(getUnmarshalInfo(t), name) + case reflect.Uint64: + if pointer { + if slice { + return makeStdUInt64ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdUInt64ValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdUInt64ValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdUInt64ValueUnmarshaler(getUnmarshalInfo(t), name) + case reflect.Int32: + if pointer { + if slice { + return makeStdInt32ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdInt32ValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdInt32ValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdInt32ValueUnmarshaler(getUnmarshalInfo(t), name) + case reflect.Uint32: + if pointer { + if slice { + return makeStdUInt32ValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdUInt32ValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdUInt32ValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdUInt32ValueUnmarshaler(getUnmarshalInfo(t), name) + case reflect.Bool: + if pointer { + if slice { + return makeStdBoolValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdBoolValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdBoolValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdBoolValueUnmarshaler(getUnmarshalInfo(t), name) + case reflect.String: + if pointer { + if slice { + return makeStdStringValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdStringValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdStringValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdStringValueUnmarshaler(getUnmarshalInfo(t), name) + case uint8SliceType: + if pointer { + if slice { + return makeStdBytesValuePtrSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdBytesValuePtrUnmarshaler(getUnmarshalInfo(t), name) + } + if slice { + return makeStdBytesValueSliceUnmarshaler(getUnmarshalInfo(t), name) + } + return makeStdBytesValueUnmarshaler(getUnmarshalInfo(t), name) + default: + panic(fmt.Sprintf("unknown wktpointer type %#v", t)) + } + } + // We'll never have both pointer and slice for basic types. if pointer && slice && t.Kind() != reflect.Struct { panic("both pointer and slice for basic type in " + t.Name()) @@ -636,7 +810,13 @@ func typeUnmarshaler(t reflect.Type, tags string) unmarshaler { case reflect.Struct: // message or group field if !pointer { - panic(fmt.Sprintf("message/group field %s:%s without pointer", t, encoding)) + switch encoding { + case "bytes": + if slice { + return makeUnmarshalMessageSlice(getUnmarshalInfo(t), name) + } + return makeUnmarshalMessage(getUnmarshalInfo(t), name) + } } switch encoding { case "bytes": @@ -1735,8 +1915,24 @@ func makeUnmarshalMap(f *reflect.StructField) unmarshaler { t := f.Type kt := t.Key() vt := t.Elem() + tagArray := strings.Split(f.Tag.Get("protobuf"), ",") + valTags := strings.Split(f.Tag.Get("protobuf_val"), ",") + for _, t := range tagArray { + if strings.HasPrefix(t, "customtype=") { + valTags = append(valTags, t) + } + if t == "stdtime" { + valTags = append(valTags, t) + } + if t == "stdduration" { + valTags = append(valTags, t) + } + if t == "wktptr" { + valTags = append(valTags, t) + } + } unmarshalKey := typeUnmarshaler(kt, f.Tag.Get("protobuf_key")) - unmarshalVal := typeUnmarshaler(vt, f.Tag.Get("protobuf_val")) + unmarshalVal := typeUnmarshaler(vt, strings.Join(valTags, ",")) return func(b []byte, f pointer, w int) ([]byte, error) { // The map entry is a submessage. Figure out how big it is. if w != WireBytes { diff --git a/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go b/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go new file mode 100644 index 000000000000..00d6c7ad9376 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/table_unmarshal_gogo.go @@ -0,0 +1,385 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/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. +// +// 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 ( + "io" + "reflect" +) + +func makeUnmarshalMessage(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + // First read the message field to see if something is there. + // The semantics of multiple submessages are weird. Instead of + // the last one winning (as it is for all other fields), multiple + // submessages are merged. + v := f // gogo: changed from v := f.getPointer() + if v.isNil() { + v = valToPointer(reflect.New(sub.typ)) + f.setPointer(v) + } + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + return b[x:], err + } +} + +func makeUnmarshalMessageSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + v := valToPointer(reflect.New(sub.typ)) + err := sub.unmarshal(v, b[:x]) + if err != nil { + if r, ok := err.(*RequiredNotSetError); ok { + r.field = name + "." + r.field + } else { + return nil, err + } + } + f.appendRef(v, sub.typ) // gogo: changed from f.appendPointer(v) + return b[x:], err + } +} + +func makeUnmarshalCustomPtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.New(sub.typ)) + m := s.Interface().(custom) + if err := m.Unmarshal(b[:x]); err != nil { + return nil, err + } + return b[x:], nil + } +} + +func makeUnmarshalCustomSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := reflect.New(sub.typ) + c := m.Interface().(custom) + if err := c.Unmarshal(b[:x]); err != nil { + return nil, err + } + v := valToPointer(m) + f.appendRef(v, sub.typ) + return b[x:], nil + } +} + +func makeUnmarshalCustom(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + + m := f.asPointerTo(sub.typ).Interface().(custom) + if err := m.Unmarshal(b[:x]); err != nil { + return nil, err + } + return b[x:], nil + } +} + +func makeUnmarshalTime(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := ×tamp{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + t, err := timestampFromProto(m) + if err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(t)) + return b[x:], nil + } +} + +func makeUnmarshalTimePtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := ×tamp{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + t, err := timestampFromProto(m) + if err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&t)) + return b[x:], nil + } +} + +func makeUnmarshalTimePtrSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := ×tamp{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + t, err := timestampFromProto(m) + if err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&t)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeUnmarshalTimeSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := ×tamp{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + t, err := timestampFromProto(m) + if err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(t)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeUnmarshalDurationPtr(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &duration{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + d, err := durationFromProto(m) + if err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&d)) + return b[x:], nil + } +} + +func makeUnmarshalDuration(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &duration{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + d, err := durationFromProto(m) + if err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(d)) + return b[x:], nil + } +} + +func makeUnmarshalDurationPtrSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &duration{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + d, err := durationFromProto(m) + if err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&d)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeUnmarshalDurationSlice(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &duration{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + d, err := durationFromProto(m) + if err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(d)) + slice.Set(newSlice) + return b[x:], nil + } +} diff --git a/vendor/github.com/gogo/protobuf/proto/text.go b/vendor/github.com/gogo/protobuf/proto/text.go index f609d1d453b0..87416afe9550 100644 --- a/vendor/github.com/gogo/protobuf/proto/text.go +++ b/vendor/github.com/gogo/protobuf/proto/text.go @@ -57,7 +57,6 @@ import ( var ( newline = []byte("\n") spaces = []byte(" ") - gtNewline = []byte(">\n") endBraceNewline = []byte("}\n") backslashN = []byte{'\\', 'n'} backslashR = []byte{'\\', 'r'} @@ -177,11 +176,6 @@ func writeName(w *textWriter, props *Properties) error { return nil } -// raw is the interface satisfied by RawMessage. -type raw interface { - Bytes() []byte -} - func requiresQuotes(u string) bool { // When type URL contains any characters except [0-9A-Za-z./\-]*, it must be quoted. for _, ch := range u { @@ -276,6 +270,10 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { props := sprops.Prop[i] name := st.Field(i).Name + if name == "XXX_NoUnkeyedLiteral" { + continue + } + if strings.HasPrefix(name, "XXX_") { // There are two XXX_ fields: // XXX_unrecognized []byte @@ -366,7 +364,7 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { return err } } - if err := tm.writeAny(w, key, props.mkeyprop); err != nil { + if err := tm.writeAny(w, key, props.MapKeyProp); err != nil { return err } if err := w.WriteByte('\n'); err != nil { @@ -383,7 +381,7 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { return err } } - if err := tm.writeAny(w, val, props.mvalprop); err != nil { + if err := tm.writeAny(w, val, props.MapValProp); err != nil { return err } if err := w.WriteByte('\n'); err != nil { @@ -447,12 +445,6 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { return err } } - if b, ok := fv.Interface().(raw); ok { - if err := writeRaw(w, b.Bytes()); err != nil { - return err - } - continue - } if len(props.Enum) > 0 { if err := tm.writeEnum(w, fv, props); err != nil { @@ -475,7 +467,7 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { pv = reflect.New(sv.Type()) pv.Elem().Set(sv) } - if pv.Type().Implements(extensionRangeType) { + if _, err := extendable(pv.Interface()); err == nil { if err := tm.writeExtensions(w, pv); err != nil { return err } @@ -484,26 +476,7 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error { return nil } -// writeRaw writes an uninterpreted raw message. -func writeRaw(w *textWriter, b []byte) error { - if err := w.WriteByte('<'); err != nil { - return err - } - if !w.compact { - if err := w.WriteByte('\n'); err != nil { - return err - } - } - w.indent() - if err := writeUnknownStruct(w, b); err != nil { - return err - } - w.unindent() - if err := w.WriteByte('>'); err != nil { - return err - } - return nil -} +var textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem() // writeAny writes an arbitrary field. func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error { @@ -605,16 +578,34 @@ func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Propert } } w.indent() - if etm, ok := v.Interface().(encoding.TextMarshaler); ok { - text, err := etm.MarshalText() + if v.CanAddr() { + // Calling v.Interface on a struct causes the reflect package to + // copy the entire struct. This is racy with the new Marshaler + // since we atomically update the XXX_sizecache. + // + // Thus, we retrieve a pointer to the struct if possible to avoid + // a race since v.Interface on the pointer doesn't copy the struct. + // + // If v is not addressable, then we are not worried about a race + // since it implies that the binary Marshaler cannot possibly be + // mutating this value. + v = v.Addr() + } + if v.Type().Implements(textMarshalerType) { + text, err := v.Interface().(encoding.TextMarshaler).MarshalText() if err != nil { return err } if _, err = w.Write(text); err != nil { return err } - } else if err := tm.writeStruct(w, v); err != nil { - return err + } else { + if v.Kind() == reflect.Ptr { + v = v.Elem() + } + if err := tm.writeStruct(w, v); err != nil { + return err + } } w.unindent() if err := w.WriteByte(ket); err != nil { diff --git a/vendor/github.com/gogo/protobuf/proto/text_parser.go b/vendor/github.com/gogo/protobuf/proto/text_parser.go index f1276729a354..1ce0be2fa9be 100644 --- a/vendor/github.com/gogo/protobuf/proto/text_parser.go +++ b/vendor/github.com/gogo/protobuf/proto/text_parser.go @@ -212,7 +212,6 @@ func (p *textParser) advance() { var ( errBadUTF8 = errors.New("proto: bad UTF-8") - errBadHex = errors.New("proto: bad hexadecimal") ) func unquoteC(s string, quote rune) (string, error) { @@ -283,60 +282,47 @@ func unescape(s string) (ch string, tail string, err error) { return "?", s, nil // trigraph workaround case '\'', '"', '\\': return string(r), s, nil - case '0', '1', '2', '3', '4', '5', '6', '7', 'x', 'X': + case '0', '1', '2', '3', '4', '5', '6', '7': if len(s) < 2 { return "", "", fmt.Errorf(`\%c requires 2 following digits`, r) } - base := 8 - ss := s[:2] + ss := string(r) + s[:2] s = s[2:] - if r == 'x' || r == 'X' { - base = 16 - } else { - ss = string(r) + ss - } - i, err := strconv.ParseUint(ss, base, 8) + i, err := strconv.ParseUint(ss, 8, 8) if err != nil { - return "", "", err + return "", "", fmt.Errorf(`\%s contains non-octal digits`, ss) } return string([]byte{byte(i)}), s, nil - case 'u', 'U': - n := 4 - if r == 'U' { + case 'x', 'X', 'u', 'U': + var n int + switch r { + case 'x', 'X': + n = 2 + case 'u': + n = 4 + case 'U': n = 8 } if len(s) < n { - return "", "", fmt.Errorf(`\%c requires %d digits`, r, n) - } - - bs := make([]byte, n/2) - for i := 0; i < n; i += 2 { - a, ok1 := unhex(s[i]) - b, ok2 := unhex(s[i+1]) - if !ok1 || !ok2 { - return "", "", errBadHex - } - bs[i/2] = a<<4 | b + return "", "", fmt.Errorf(`\%c requires %d following digits`, r, n) } + ss := s[:n] s = s[n:] - return string(bs), s, nil + i, err := strconv.ParseUint(ss, 16, 64) + if err != nil { + return "", "", fmt.Errorf(`\%c%s contains non-hexadecimal digits`, r, ss) + } + if r == 'x' || r == 'X' { + return string([]byte{byte(i)}), s, nil + } + if i > utf8.MaxRune { + return "", "", fmt.Errorf(`\%c%s is not a valid Unicode code point`, r, ss) + } + return string(i), s, nil } return "", "", fmt.Errorf(`unknown escape \%c`, r) } -// Adapted from src/pkg/strconv/quote.go. -func unhex(b byte) (v byte, ok bool) { - switch { - case '0' <= b && b <= '9': - return b - '0', true - case 'a' <= b && b <= 'f': - return b - 'a' + 10, true - case 'A' <= b && b <= 'F': - return b - 'A' + 10, true - } - return 0, false -} - // Back off the parser by one token. Can only be done between calls to next(). // It makes the next advance() a no-op. func (p *textParser) back() { p.backed = true } @@ -650,17 +636,17 @@ func (p *textParser) readStruct(sv reflect.Value, terminator string) error { if err := p.consumeToken(":"); err != nil { return err } - if err := p.readAny(key, props.mkeyprop); err != nil { + if err := p.readAny(key, props.MapKeyProp); err != nil { return err } if err := p.consumeOptionalSeparator(); err != nil { return err } case "value": - if err := p.checkForColon(props.mvalprop, dst.Type().Elem()); err != nil { + if err := p.checkForColon(props.MapValProp, dst.Type().Elem()); err != nil { return err } - if err := p.readAny(val, props.mvalprop); err != nil { + if err := p.readAny(val, props.MapValProp); err != nil { return err } if err := p.consumeOptionalSeparator(); err != nil { @@ -734,6 +720,9 @@ func (p *textParser) consumeExtName() (string, error) { if tok.err != nil { return "", p.errorf("unrecognized type_url or extension name: %s", tok.err) } + if p.done && tok.value != "]" { + return "", p.errorf("unclosed type_url or extension name") + } } return strings.Join(parts, ""), nil } @@ -934,6 +923,16 @@ func (p *textParser) readAny(v reflect.Value, props *Properties) error { fv.SetFloat(f) return nil } + case reflect.Int8: + if x, err := strconv.ParseInt(tok.value, 0, 8); err == nil { + fv.SetInt(x) + return nil + } + case reflect.Int16: + if x, err := strconv.ParseInt(tok.value, 0, 16); err == nil { + fv.SetInt(x) + return nil + } case reflect.Int32: if x, err := strconv.ParseInt(tok.value, 0, 32); err == nil { fv.SetInt(x) @@ -981,9 +980,19 @@ func (p *textParser) readAny(v reflect.Value, props *Properties) error { } // TODO: Handle nested messages which implement encoding.TextUnmarshaler. return p.readStruct(fv, terminator) + case reflect.Uint8: + if x, err := strconv.ParseUint(tok.value, 0, 8); err == nil { + fv.SetUint(x) + return nil + } + case reflect.Uint16: + if x, err := strconv.ParseUint(tok.value, 0, 16); err == nil { + fv.SetUint(x) + return nil + } case reflect.Uint32: if x, err := strconv.ParseUint(tok.value, 0, 32); err == nil { - fv.SetUint(x) + fv.SetUint(uint64(x)) return nil } case reflect.Uint64: @@ -1001,13 +1010,9 @@ func (p *textParser) readAny(v reflect.Value, props *Properties) error { // UnmarshalText returns *RequiredNotSetError. func UnmarshalText(s string, pb Message) error { if um, ok := pb.(encoding.TextUnmarshaler); ok { - err := um.UnmarshalText([]byte(s)) - return err + return um.UnmarshalText([]byte(s)) } pb.Reset() v := reflect.ValueOf(pb) - if pe := newTextParser(s).readStruct(v.Elem(), ""); pe != nil { - return pe - } - return nil + return newTextParser(s).readStruct(v.Elem(), "") } diff --git a/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go b/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go index d42764743606..38439fa99013 100644 --- a/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go +++ b/vendor/github.com/gogo/protobuf/proto/timestamp_gogo.go @@ -47,183 +47,3 @@ func (*timestamp) String() string { return "timestamp" } func init() { RegisterType((*timestamp)(nil), "gogo.protobuf.proto.timestamp") } - -func (o *Buffer) decTimestamp() (time.Time, error) { - b, err := o.DecodeRawBytes(true) - if err != nil { - return time.Time{}, err - } - tproto := ×tamp{} - if err := Unmarshal(b, tproto); err != nil { - return time.Time{}, err - } - return timestampFromProto(tproto) -} - -func (o *Buffer) dec_time(p *Properties, base structPointer) error { - t, err := o.decTimestamp() - if err != nil { - return err - } - setPtrCustomType(base, p.field, &t) - return nil -} - -func (o *Buffer) dec_ref_time(p *Properties, base structPointer) error { - t, err := o.decTimestamp() - if err != nil { - return err - } - setCustomType(base, p.field, &t) - return nil -} - -func (o *Buffer) dec_slice_time(p *Properties, base structPointer) error { - t, err := o.decTimestamp() - if err != nil { - return err - } - newBas := appendStructPointer(base, p.field, reflect.SliceOf(reflect.PtrTo(timeType))) - var zero field - setPtrCustomType(newBas, zero, &t) - return nil -} - -func (o *Buffer) dec_slice_ref_time(p *Properties, base structPointer) error { - t, err := o.decTimestamp() - if err != nil { - return err - } - newBas := appendStructPointer(base, p.field, reflect.SliceOf(timeType)) - var zero field - setCustomType(newBas, zero, &t) - return nil -} - -func size_time(p *Properties, base structPointer) (n int) { - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return 0 - } - tim := structPointer_Interface(structp, timeType).(*time.Time) - t, err := timestampProto(*tim) - if err != nil { - return 0 - } - size := Size(t) - return size + sizeVarint(uint64(size)) + len(p.tagcode) -} - -func (o *Buffer) enc_time(p *Properties, base structPointer) error { - structp := structPointer_GetStructPointer(base, p.field) - if structPointer_IsNil(structp) { - return ErrNil - } - tim := structPointer_Interface(structp, timeType).(*time.Time) - t, err := timestampProto(*tim) - if err != nil { - return err - } - data, err := Marshal(t) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return nil -} - -func size_ref_time(p *Properties, base structPointer) (n int) { - tim := structPointer_InterfaceAt(base, p.field, timeType).(*time.Time) - t, err := timestampProto(*tim) - if err != nil { - return 0 - } - size := Size(t) - return size + sizeVarint(uint64(size)) + len(p.tagcode) -} - -func (o *Buffer) enc_ref_time(p *Properties, base structPointer) error { - tim := structPointer_InterfaceAt(base, p.field, timeType).(*time.Time) - t, err := timestampProto(*tim) - if err != nil { - return err - } - data, err := Marshal(t) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - return nil -} - -func size_slice_time(p *Properties, base structPointer) (n int) { - ptims := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(reflect.PtrTo(timeType))).(*[]*time.Time) - tims := *ptims - for i := 0; i < len(tims); i++ { - if tims[i] == nil { - return 0 - } - tproto, err := timestampProto(*tims[i]) - if err != nil { - return 0 - } - size := Size(tproto) - n += len(p.tagcode) + size + sizeVarint(uint64(size)) - } - return n -} - -func (o *Buffer) enc_slice_time(p *Properties, base structPointer) error { - ptims := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(reflect.PtrTo(timeType))).(*[]*time.Time) - tims := *ptims - for i := 0; i < len(tims); i++ { - if tims[i] == nil { - return errRepeatedHasNil - } - tproto, err := timestampProto(*tims[i]) - if err != nil { - return err - } - data, err := Marshal(tproto) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - } - return nil -} - -func size_slice_ref_time(p *Properties, base structPointer) (n int) { - ptims := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(timeType)).(*[]time.Time) - tims := *ptims - for i := 0; i < len(tims); i++ { - tproto, err := timestampProto(tims[i]) - if err != nil { - return 0 - } - size := Size(tproto) - n += len(p.tagcode) + size + sizeVarint(uint64(size)) - } - return n -} - -func (o *Buffer) enc_slice_ref_time(p *Properties, base structPointer) error { - ptims := structPointer_InterfaceAt(base, p.field, reflect.SliceOf(timeType)).(*[]time.Time) - tims := *ptims - for i := 0; i < len(tims); i++ { - tproto, err := timestampProto(tims[i]) - if err != nil { - return err - } - data, err := Marshal(tproto) - if err != nil { - return err - } - o.buf = append(o.buf, p.tagcode...) - o.EncodeRawBytes(data) - } - return nil -} diff --git a/vendor/github.com/gogo/protobuf/proto/wrappers.go b/vendor/github.com/gogo/protobuf/proto/wrappers.go new file mode 100644 index 000000000000..b175d1b64234 --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/wrappers.go @@ -0,0 +1,1888 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/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. +// +// 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 ( + "io" + "reflect" +) + +func makeStdDoubleValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*float64) + v := &float64Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*float64) + v := &float64Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdDoubleValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float64) + v := &float64Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float64) + v := &float64Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdDoubleValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(float64) + v := &float64Value{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(float64) + v := &float64Value{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdDoubleValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*float64) + v := &float64Value{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*float64) + v := &float64Value{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdDoubleValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdDoubleValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdDoubleValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdDoubleValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdFloatValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*float32) + v := &float32Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*float32) + v := &float32Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdFloatValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float32) + v := &float32Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*float32) + v := &float32Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdFloatValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(float32) + v := &float32Value{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(float32) + v := &float32Value{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdFloatValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*float32) + v := &float32Value{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*float32) + v := &float32Value{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdFloatValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdFloatValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdFloatValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdFloatValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &float32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdInt64ValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*int64) + v := &int64Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*int64) + v := &int64Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdInt64ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int64) + v := &int64Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int64) + v := &int64Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdInt64ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(int64) + v := &int64Value{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(int64) + v := &int64Value{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdInt64ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*int64) + v := &int64Value{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*int64) + v := &int64Value{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdInt64ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdInt64ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdInt64ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdInt64ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdUInt64ValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*uint64) + v := &uint64Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*uint64) + v := &uint64Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdUInt64ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint64) + v := &uint64Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint64) + v := &uint64Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdUInt64ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(uint64) + v := &uint64Value{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(uint64) + v := &uint64Value{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdUInt64ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*uint64) + v := &uint64Value{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*uint64) + v := &uint64Value{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdUInt64ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdUInt64ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdUInt64ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdUInt64ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint64Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdInt32ValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*int32) + v := &int32Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*int32) + v := &int32Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdInt32ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int32) + v := &int32Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*int32) + v := &int32Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdInt32ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(int32) + v := &int32Value{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(int32) + v := &int32Value{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdInt32ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*int32) + v := &int32Value{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*int32) + v := &int32Value{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdInt32ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdInt32ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdInt32ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdInt32ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &int32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdUInt32ValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*uint32) + v := &uint32Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*uint32) + v := &uint32Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdUInt32ValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint32) + v := &uint32Value{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*uint32) + v := &uint32Value{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdUInt32ValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(uint32) + v := &uint32Value{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(uint32) + v := &uint32Value{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdUInt32ValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*uint32) + v := &uint32Value{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*uint32) + v := &uint32Value{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdUInt32ValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdUInt32ValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdUInt32ValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdUInt32ValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &uint32Value{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdBoolValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*bool) + v := &boolValue{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*bool) + v := &boolValue{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdBoolValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*bool) + v := &boolValue{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*bool) + v := &boolValue{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdBoolValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(bool) + v := &boolValue{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(bool) + v := &boolValue{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdBoolValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*bool) + v := &boolValue{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*bool) + v := &boolValue{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdBoolValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &boolValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdBoolValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &boolValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdBoolValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &boolValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdBoolValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &boolValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdStringValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*string) + v := &stringValue{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*string) + v := &stringValue{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdStringValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*string) + v := &stringValue{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*string) + v := &stringValue{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdStringValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(string) + v := &stringValue{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(string) + v := &stringValue{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdStringValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*string) + v := &stringValue{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*string) + v := &stringValue{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdStringValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &stringValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdStringValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &stringValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdStringValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &stringValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdStringValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &stringValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdBytesValueMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + t := ptr.asPointerTo(u.typ).Interface().(*[]byte) + v := &bytesValue{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + t := ptr.asPointerTo(u.typ).Interface().(*[]byte) + v := &bytesValue{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdBytesValuePtrMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + if ptr.isNil() { + return 0 + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*[]byte) + v := &bytesValue{*t} + siz := Size(v) + return tagsize + SizeVarint(uint64(siz)) + siz + }, func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + if ptr.isNil() { + return b, nil + } + t := ptr.asPointerTo(reflect.PtrTo(u.typ)).Elem().Interface().(*[]byte) + v := &bytesValue{*t} + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(len(buf))) + b = append(b, buf...) + return b, nil + } +} + +func makeStdBytesValueSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(u.typ) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().([]byte) + v := &bytesValue{t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(u.typ) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().([]byte) + v := &bytesValue{t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdBytesValuePtrSliceMarshaler(u *marshalInfo) (sizer, marshaler) { + return func(ptr pointer, tagsize int) int { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + n := 0 + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*[]byte) + v := &bytesValue{*t} + siz := Size(v) + n += siz + SizeVarint(uint64(siz)) + tagsize + } + return n + }, + func(b []byte, ptr pointer, wiretag uint64, deterministic bool) ([]byte, error) { + s := ptr.getSlice(reflect.PtrTo(u.typ)) + for i := 0; i < s.Len(); i++ { + elem := s.Index(i) + t := elem.Interface().(*[]byte) + v := &bytesValue{*t} + siz := Size(v) + buf, err := Marshal(v) + if err != nil { + return nil, err + } + b = appendVarint(b, wiretag) + b = appendVarint(b, uint64(siz)) + b = append(b, buf...) + } + + return b, nil + } +} + +func makeStdBytesValueUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &bytesValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(sub.typ).Elem() + s.Set(reflect.ValueOf(m.Value)) + return b[x:], nil + } +} + +func makeStdBytesValuePtrUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &bytesValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + s := f.asPointerTo(reflect.PtrTo(sub.typ)).Elem() + s.Set(reflect.ValueOf(&m.Value)) + return b[x:], nil + } +} + +func makeStdBytesValuePtrSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &bytesValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(reflect.PtrTo(sub.typ)) + newSlice := reflect.Append(slice, reflect.ValueOf(&m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} + +func makeStdBytesValueSliceUnmarshaler(sub *unmarshalInfo, name string) unmarshaler { + return func(b []byte, f pointer, w int) ([]byte, error) { + if w != WireBytes { + return nil, errInternalBadWireType + } + x, n := decodeVarint(b) + if n == 0 { + return nil, io.ErrUnexpectedEOF + } + b = b[n:] + if x > uint64(len(b)) { + return nil, io.ErrUnexpectedEOF + } + m := &bytesValue{} + if err := Unmarshal(b[:x], m); err != nil { + return nil, err + } + slice := f.getSlice(sub.typ) + newSlice := reflect.Append(slice, reflect.ValueOf(m.Value)) + slice.Set(newSlice) + return b[x:], nil + } +} diff --git a/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go b/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go new file mode 100644 index 000000000000..c1cf7bf85e9a --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/wrappers_gogo.go @@ -0,0 +1,113 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2018, The GoGo Authors. All rights reserved. +// http://github.com/gogo/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. +// +// 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 + +type float64Value struct { + Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *float64Value) Reset() { *m = float64Value{} } +func (*float64Value) ProtoMessage() {} +func (*float64Value) String() string { return "float64" } + +type float32Value struct { + Value float32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *float32Value) Reset() { *m = float32Value{} } +func (*float32Value) ProtoMessage() {} +func (*float32Value) String() string { return "float32" } + +type int64Value struct { + Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *int64Value) Reset() { *m = int64Value{} } +func (*int64Value) ProtoMessage() {} +func (*int64Value) String() string { return "int64" } + +type uint64Value struct { + Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *uint64Value) Reset() { *m = uint64Value{} } +func (*uint64Value) ProtoMessage() {} +func (*uint64Value) String() string { return "uint64" } + +type int32Value struct { + Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *int32Value) Reset() { *m = int32Value{} } +func (*int32Value) ProtoMessage() {} +func (*int32Value) String() string { return "int32" } + +type uint32Value struct { + Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *uint32Value) Reset() { *m = uint32Value{} } +func (*uint32Value) ProtoMessage() {} +func (*uint32Value) String() string { return "uint32" } + +type boolValue struct { + Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *boolValue) Reset() { *m = boolValue{} } +func (*boolValue) ProtoMessage() {} +func (*boolValue) String() string { return "bool" } + +type stringValue struct { + Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *stringValue) Reset() { *m = stringValue{} } +func (*stringValue) ProtoMessage() {} +func (*stringValue) String() string { return "string" } + +type bytesValue struct { + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` +} + +func (m *bytesValue) Reset() { *m = bytesValue{} } +func (*bytesValue) ProtoMessage() {} +func (*bytesValue) String() string { return "[]byte" } + +func init() { + RegisterType((*float64Value)(nil), "gogo.protobuf.proto.DoubleValue") + RegisterType((*float32Value)(nil), "gogo.protobuf.proto.FloatValue") + RegisterType((*int64Value)(nil), "gogo.protobuf.proto.Int64Value") + RegisterType((*uint64Value)(nil), "gogo.protobuf.proto.UInt64Value") + RegisterType((*int32Value)(nil), "gogo.protobuf.proto.Int32Value") + RegisterType((*uint32Value)(nil), "gogo.protobuf.proto.UInt32Value") + RegisterType((*boolValue)(nil), "gogo.protobuf.proto.BoolValue") + RegisterType((*stringValue)(nil), "gogo.protobuf.proto.StringValue") + RegisterType((*bytesValue)(nil), "gogo.protobuf.proto.BytesValue") +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2/AUTHORS b/vendor/github.com/golang/protobuf/AUTHORS similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2/AUTHORS rename to vendor/github.com/golang/protobuf/AUTHORS diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2/CONTRIBUTORS b/vendor/github.com/golang/protobuf/CONTRIBUTORS similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/golang.org/x/oauth2/CONTRIBUTORS rename to vendor/github.com/golang/protobuf/CONTRIBUTORS 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 000000000000..f0d66befbb8e --- /dev/null +++ b/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go @@ -0,0 +1,1290 @@ +// 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) +const maxSecondsInDuration = 315576000000 + +// 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 +} + +var ( + wktType = reflect.TypeOf((*wkt)(nil)).Elem() + messageType = reflect.TypeOf((*proto.Message)(nil)).Elem() +) + +// 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 m.Indent != "" { + b, err = json.MarshalIndent(js, indent, m.Indent) + } else { + b, err = json.Marshal(js) + } + if 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": + s, ns := s.Field(0).Int(), s.Field(1).Int() + if s < -maxSecondsInDuration || s > maxSecondsInDuration { + return fmt.Errorf("seconds out of range %v", s) + } + 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") + } + // Generated output always contains 0, 3, 6, or 9 fractional digits, + // depending on required precision, followed by the suffix "s". + f := "%d.%09d" + if ns < 0 { + ns = -ns + if s == 0 { + f = "-%d.%09d" + } + } + x := fmt.Sprintf(f, 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 v.Type().Implements(wktType) { + wkt := v.Interface().(wkt) + 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 v.Type().Implements(messageType) { + return checkRequiredFields(v.Interface().(proto.Message)) + } + return nil +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/doc.go b/vendor/github.com/golang/protobuf/protoc-gen-go/doc.go new file mode 100644 index 000000000000..0d6055d610e3 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/doc.go @@ -0,0 +1,51 @@ +// 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. + +/* + A plugin for the Google protocol buffer compiler to generate Go code. + Run it by building this program and putting it in your path with the name + protoc-gen-go + That word 'go' at the end becomes part of the option string set for the + protocol compiler, so once the protocol compiler (protoc) is installed + you can run + protoc --go_out=output_directory input_directory/file.proto + to generate Go bindings for the protocol defined by file.proto. + With that input, the output will be written to + output_directory/file.pb.go + + The generated code is documented in the package comment for + the library. + + See the README and documentation for protocol buffers to learn more: + https://developers.google.com/protocol-buffers/ + +*/ +package documentation 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 000000000000..63b8ca0eed47 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go @@ -0,0 +1,2808 @@ +// 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 marshaling, unmarshaling 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.P(g.Pkg["proto"], ".RegisterFile(", strconv.Quote(*file.Name), ", ", v, ")") + g.P("}") + 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 000000000000..39968eb9f92f --- /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 corresponding 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/grpc/grpc.go b/vendor/github.com/golang/protobuf/protoc-gen-go/grpc/grpc.go new file mode 100644 index 000000000000..957c3f2a63fb --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/grpc/grpc.go @@ -0,0 +1,545 @@ +// 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 grpc outputs gRPC service descriptions in Go code. +// It runs as a plugin for the Go protocol buffer compiler plugin. +// It is linked in to protoc-gen-go. +package grpc + +import ( + "fmt" + "strconv" + "strings" + + pb "github.com/golang/protobuf/protoc-gen-go/descriptor" + "github.com/golang/protobuf/protoc-gen-go/generator" +) + +// generatedCodeVersion indicates a version of the generated code. +// It is incremented whenever an incompatibility between the generated code and +// the grpc package is introduced; the generated code references +// a constant, grpc.SupportPackageIsVersionN (where N is generatedCodeVersion). +const generatedCodeVersion = 6 + +// Paths for packages used by code generated in this file, +// relative to the import_prefix of the generator.Generator. +const ( + contextPkgPath = "context" + grpcPkgPath = "google.golang.org/grpc" + codePkgPath = "google.golang.org/grpc/codes" + statusPkgPath = "google.golang.org/grpc/status" +) + +func init() { + generator.RegisterPlugin(new(grpc)) +} + +// grpc is an implementation of the Go protocol buffer compiler's +// plugin architecture. It generates bindings for gRPC support. +type grpc struct { + gen *generator.Generator +} + +// Name returns the name of this plugin, "grpc". +func (g *grpc) Name() string { + return "grpc" +} + +// The names for packages imported in the generated code. +// They may vary from the final path component of the import path +// if the name is used by other packages. +var ( + contextPkg string + grpcPkg string +) + +// Init initializes the plugin. +func (g *grpc) Init(gen *generator.Generator) { + g.gen = gen +} + +// Given a type name defined in a .proto, return its object. +// Also record that we're using it, to guarantee the associated import. +func (g *grpc) objectNamed(name string) generator.Object { + g.gen.RecordTypeUse(name) + return g.gen.ObjectNamed(name) +} + +// Given a type name defined in a .proto, return its name as we will print it. +func (g *grpc) typeName(str string) string { + return g.gen.TypeName(g.objectNamed(str)) +} + +// P forwards to g.gen.P. +func (g *grpc) P(args ...interface{}) { g.gen.P(args...) } + +// Generate generates code for the services in the given file. +func (g *grpc) Generate(file *generator.FileDescriptor) { + if len(file.FileDescriptorProto.Service) == 0 { + return + } + + contextPkg = string(g.gen.AddImport(contextPkgPath)) + grpcPkg = string(g.gen.AddImport(grpcPkgPath)) + + g.P("// Reference imports to suppress errors if they are not otherwise used.") + g.P("var _ ", contextPkg, ".Context") + g.P("var _ ", grpcPkg, ".ClientConnInterface") + g.P() + + // Assert version compatibility. + g.P("// This is a compile-time assertion to ensure that this generated file") + g.P("// is compatible with the grpc package it is being compiled against.") + g.P("const _ = ", grpcPkg, ".SupportPackageIsVersion", generatedCodeVersion) + g.P() + + for i, service := range file.FileDescriptorProto.Service { + g.generateService(file, service, i) + } +} + +// GenerateImports generates the import declaration for this file. +func (g *grpc) GenerateImports(file *generator.FileDescriptor) { +} + +// reservedClientName records whether a client name is reserved on the client side. +var reservedClientName = map[string]bool{ + // TODO: do we need any in gRPC? +} + +func unexport(s string) string { return strings.ToLower(s[:1]) + s[1:] } + +// deprecationComment is the standard comment added to deprecated +// messages, fields, enums, and enum values. +var deprecationComment = "// Deprecated: Do not use." + +// generateService generates all the code for the named service. +func (g *grpc) generateService(file *generator.FileDescriptor, service *pb.ServiceDescriptorProto, index int) { + path := fmt.Sprintf("6,%d", index) // 6 means service. + + origServName := service.GetName() + fullServName := origServName + if pkg := file.GetPackage(); pkg != "" { + fullServName = pkg + "." + fullServName + } + servName := generator.CamelCase(origServName) + deprecated := service.GetOptions().GetDeprecated() + + g.P() + g.P(fmt.Sprintf(`// %sClient is the client API for %s service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.`, servName, servName)) + + // Client interface. + if deprecated { + g.P("//") + g.P(deprecationComment) + } + g.P("type ", servName, "Client interface {") + for i, method := range service.Method { + g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service. + if method.GetOptions().GetDeprecated() { + g.P("//") + g.P(deprecationComment) + } + g.P(g.generateClientSignature(servName, method)) + } + g.P("}") + g.P() + + // Client structure. + g.P("type ", unexport(servName), "Client struct {") + g.P("cc ", grpcPkg, ".ClientConnInterface") + g.P("}") + g.P() + + // NewClient factory. + if deprecated { + g.P(deprecationComment) + } + g.P("func New", servName, "Client (cc ", grpcPkg, ".ClientConnInterface) ", servName, "Client {") + g.P("return &", unexport(servName), "Client{cc}") + g.P("}") + g.P() + + var methodIndex, streamIndex int + serviceDescVar := "_" + servName + "_serviceDesc" + // Client method implementations. + for _, method := range service.Method { + var descExpr string + if !method.GetServerStreaming() && !method.GetClientStreaming() { + // Unary RPC method + descExpr = fmt.Sprintf("&%s.Methods[%d]", serviceDescVar, methodIndex) + methodIndex++ + } else { + // Streaming RPC method + descExpr = fmt.Sprintf("&%s.Streams[%d]", serviceDescVar, streamIndex) + streamIndex++ + } + g.generateClientMethod(servName, fullServName, serviceDescVar, method, descExpr) + } + + // Server interface. + serverType := servName + "Server" + g.P("// ", serverType, " is the server API for ", servName, " service.") + if deprecated { + g.P("//") + g.P(deprecationComment) + } + g.P("type ", serverType, " interface {") + for i, method := range service.Method { + g.gen.PrintComments(fmt.Sprintf("%s,2,%d", path, i)) // 2 means method in a service. + if method.GetOptions().GetDeprecated() { + g.P("//") + g.P(deprecationComment) + } + g.P(g.generateServerSignature(servName, method)) + } + g.P("}") + g.P() + + // Server Unimplemented struct for forward compatibility. + if deprecated { + g.P(deprecationComment) + } + g.generateUnimplementedServer(servName, service) + + // Server registration. + if deprecated { + g.P(deprecationComment) + } + g.P("func Register", servName, "Server(s *", grpcPkg, ".Server, srv ", serverType, ") {") + g.P("s.RegisterService(&", serviceDescVar, `, srv)`) + g.P("}") + g.P() + + // Server handler implementations. + var handlerNames []string + for _, method := range service.Method { + hname := g.generateServerMethod(servName, fullServName, method) + handlerNames = append(handlerNames, hname) + } + + // Service descriptor. + g.P("var ", serviceDescVar, " = ", grpcPkg, ".ServiceDesc {") + g.P("ServiceName: ", strconv.Quote(fullServName), ",") + g.P("HandlerType: (*", serverType, ")(nil),") + g.P("Methods: []", grpcPkg, ".MethodDesc{") + for i, method := range service.Method { + if method.GetServerStreaming() || method.GetClientStreaming() { + continue + } + g.P("{") + g.P("MethodName: ", strconv.Quote(method.GetName()), ",") + g.P("Handler: ", handlerNames[i], ",") + g.P("},") + } + g.P("},") + g.P("Streams: []", grpcPkg, ".StreamDesc{") + for i, method := range service.Method { + if !method.GetServerStreaming() && !method.GetClientStreaming() { + continue + } + g.P("{") + g.P("StreamName: ", strconv.Quote(method.GetName()), ",") + g.P("Handler: ", handlerNames[i], ",") + if method.GetServerStreaming() { + g.P("ServerStreams: true,") + } + if method.GetClientStreaming() { + g.P("ClientStreams: true,") + } + g.P("},") + } + g.P("},") + g.P("Metadata: \"", file.GetName(), "\",") + g.P("}") + g.P() +} + +// generateUnimplementedServer creates the unimplemented server struct +func (g *grpc) generateUnimplementedServer(servName string, service *pb.ServiceDescriptorProto) { + serverType := servName + "Server" + g.P("// Unimplemented", serverType, " can be embedded to have forward compatible implementations.") + g.P("type Unimplemented", serverType, " struct {") + g.P("}") + g.P() + // UnimplementedServer's concrete methods + for _, method := range service.Method { + g.generateServerMethodConcrete(servName, method) + } + g.P() +} + +// generateServerMethodConcrete returns unimplemented methods which ensure forward compatibility +func (g *grpc) generateServerMethodConcrete(servName string, method *pb.MethodDescriptorProto) { + header := g.generateServerSignatureWithParamNames(servName, method) + g.P("func (*Unimplemented", servName, "Server) ", header, " {") + var nilArg string + if !method.GetServerStreaming() && !method.GetClientStreaming() { + nilArg = "nil, " + } + methName := generator.CamelCase(method.GetName()) + statusPkg := string(g.gen.AddImport(statusPkgPath)) + codePkg := string(g.gen.AddImport(codePkgPath)) + g.P("return ", nilArg, statusPkg, `.Errorf(`, codePkg, `.Unimplemented, "method `, methName, ` not implemented")`) + g.P("}") +} + +// generateClientSignature returns the client-side signature for a method. +func (g *grpc) generateClientSignature(servName string, method *pb.MethodDescriptorProto) string { + origMethName := method.GetName() + methName := generator.CamelCase(origMethName) + if reservedClientName[methName] { + methName += "_" + } + reqArg := ", in *" + g.typeName(method.GetInputType()) + if method.GetClientStreaming() { + reqArg = "" + } + respName := "*" + g.typeName(method.GetOutputType()) + if method.GetServerStreaming() || method.GetClientStreaming() { + respName = servName + "_" + generator.CamelCase(origMethName) + "Client" + } + return fmt.Sprintf("%s(ctx %s.Context%s, opts ...%s.CallOption) (%s, error)", methName, contextPkg, reqArg, grpcPkg, respName) +} + +func (g *grpc) generateClientMethod(servName, fullServName, serviceDescVar string, method *pb.MethodDescriptorProto, descExpr string) { + sname := fmt.Sprintf("/%s/%s", fullServName, method.GetName()) + methName := generator.CamelCase(method.GetName()) + inType := g.typeName(method.GetInputType()) + outType := g.typeName(method.GetOutputType()) + + if method.GetOptions().GetDeprecated() { + g.P(deprecationComment) + } + g.P("func (c *", unexport(servName), "Client) ", g.generateClientSignature(servName, method), "{") + if !method.GetServerStreaming() && !method.GetClientStreaming() { + g.P("out := new(", outType, ")") + // TODO: Pass descExpr to Invoke. + g.P(`err := c.cc.Invoke(ctx, "`, sname, `", in, out, opts...)`) + g.P("if err != nil { return nil, err }") + g.P("return out, nil") + g.P("}") + g.P() + return + } + streamType := unexport(servName) + methName + "Client" + g.P("stream, err := c.cc.NewStream(ctx, ", descExpr, `, "`, sname, `", opts...)`) + g.P("if err != nil { return nil, err }") + g.P("x := &", streamType, "{stream}") + if !method.GetClientStreaming() { + g.P("if err := x.ClientStream.SendMsg(in); err != nil { return nil, err }") + g.P("if err := x.ClientStream.CloseSend(); err != nil { return nil, err }") + } + g.P("return x, nil") + g.P("}") + g.P() + + genSend := method.GetClientStreaming() + genRecv := method.GetServerStreaming() + genCloseAndRecv := !method.GetServerStreaming() + + // Stream auxiliary types and methods. + g.P("type ", servName, "_", methName, "Client interface {") + if genSend { + g.P("Send(*", inType, ") error") + } + if genRecv { + g.P("Recv() (*", outType, ", error)") + } + if genCloseAndRecv { + g.P("CloseAndRecv() (*", outType, ", error)") + } + g.P(grpcPkg, ".ClientStream") + g.P("}") + g.P() + + g.P("type ", streamType, " struct {") + g.P(grpcPkg, ".ClientStream") + g.P("}") + g.P() + + if genSend { + g.P("func (x *", streamType, ") Send(m *", inType, ") error {") + g.P("return x.ClientStream.SendMsg(m)") + g.P("}") + g.P() + } + if genRecv { + g.P("func (x *", streamType, ") Recv() (*", outType, ", error) {") + g.P("m := new(", outType, ")") + g.P("if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }") + g.P("return m, nil") + g.P("}") + g.P() + } + if genCloseAndRecv { + g.P("func (x *", streamType, ") CloseAndRecv() (*", outType, ", error) {") + g.P("if err := x.ClientStream.CloseSend(); err != nil { return nil, err }") + g.P("m := new(", outType, ")") + g.P("if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err }") + g.P("return m, nil") + g.P("}") + g.P() + } +} + +// generateServerSignatureWithParamNames returns the server-side signature for a method with parameter names. +func (g *grpc) generateServerSignatureWithParamNames(servName string, method *pb.MethodDescriptorProto) string { + origMethName := method.GetName() + methName := generator.CamelCase(origMethName) + if reservedClientName[methName] { + methName += "_" + } + + var reqArgs []string + ret := "error" + if !method.GetServerStreaming() && !method.GetClientStreaming() { + reqArgs = append(reqArgs, "ctx "+contextPkg+".Context") + ret = "(*" + g.typeName(method.GetOutputType()) + ", error)" + } + if !method.GetClientStreaming() { + reqArgs = append(reqArgs, "req *"+g.typeName(method.GetInputType())) + } + if method.GetServerStreaming() || method.GetClientStreaming() { + reqArgs = append(reqArgs, "srv "+servName+"_"+generator.CamelCase(origMethName)+"Server") + } + + return methName + "(" + strings.Join(reqArgs, ", ") + ") " + ret +} + +// generateServerSignature returns the server-side signature for a method. +func (g *grpc) generateServerSignature(servName string, method *pb.MethodDescriptorProto) string { + origMethName := method.GetName() + methName := generator.CamelCase(origMethName) + if reservedClientName[methName] { + methName += "_" + } + + var reqArgs []string + ret := "error" + if !method.GetServerStreaming() && !method.GetClientStreaming() { + reqArgs = append(reqArgs, contextPkg+".Context") + ret = "(*" + g.typeName(method.GetOutputType()) + ", error)" + } + if !method.GetClientStreaming() { + reqArgs = append(reqArgs, "*"+g.typeName(method.GetInputType())) + } + if method.GetServerStreaming() || method.GetClientStreaming() { + reqArgs = append(reqArgs, servName+"_"+generator.CamelCase(origMethName)+"Server") + } + + return methName + "(" + strings.Join(reqArgs, ", ") + ") " + ret +} + +func (g *grpc) generateServerMethod(servName, fullServName string, method *pb.MethodDescriptorProto) string { + methName := generator.CamelCase(method.GetName()) + hname := fmt.Sprintf("_%s_%s_Handler", servName, methName) + inType := g.typeName(method.GetInputType()) + outType := g.typeName(method.GetOutputType()) + + if !method.GetServerStreaming() && !method.GetClientStreaming() { + g.P("func ", hname, "(srv interface{}, ctx ", contextPkg, ".Context, dec func(interface{}) error, interceptor ", grpcPkg, ".UnaryServerInterceptor) (interface{}, error) {") + g.P("in := new(", inType, ")") + g.P("if err := dec(in); err != nil { return nil, err }") + g.P("if interceptor == nil { return srv.(", servName, "Server).", methName, "(ctx, in) }") + g.P("info := &", grpcPkg, ".UnaryServerInfo{") + g.P("Server: srv,") + g.P("FullMethod: ", strconv.Quote(fmt.Sprintf("/%s/%s", fullServName, methName)), ",") + g.P("}") + g.P("handler := func(ctx ", contextPkg, ".Context, req interface{}) (interface{}, error) {") + g.P("return srv.(", servName, "Server).", methName, "(ctx, req.(*", inType, "))") + g.P("}") + g.P("return interceptor(ctx, in, info, handler)") + g.P("}") + g.P() + return hname + } + streamType := unexport(servName) + methName + "Server" + g.P("func ", hname, "(srv interface{}, stream ", grpcPkg, ".ServerStream) error {") + if !method.GetClientStreaming() { + g.P("m := new(", inType, ")") + g.P("if err := stream.RecvMsg(m); err != nil { return err }") + g.P("return srv.(", servName, "Server).", methName, "(m, &", streamType, "{stream})") + } else { + g.P("return srv.(", servName, "Server).", methName, "(&", streamType, "{stream})") + } + g.P("}") + g.P() + + genSend := method.GetServerStreaming() + genSendAndClose := !method.GetServerStreaming() + genRecv := method.GetClientStreaming() + + // Stream auxiliary types and methods. + g.P("type ", servName, "_", methName, "Server interface {") + if genSend { + g.P("Send(*", outType, ") error") + } + if genSendAndClose { + g.P("SendAndClose(*", outType, ") error") + } + if genRecv { + g.P("Recv() (*", inType, ", error)") + } + g.P(grpcPkg, ".ServerStream") + g.P("}") + g.P() + + g.P("type ", streamType, " struct {") + g.P(grpcPkg, ".ServerStream") + g.P("}") + g.P() + + if genSend { + g.P("func (x *", streamType, ") Send(m *", outType, ") error {") + g.P("return x.ServerStream.SendMsg(m)") + g.P("}") + g.P() + } + if genSendAndClose { + g.P("func (x *", streamType, ") SendAndClose(m *", outType, ") error {") + g.P("return x.ServerStream.SendMsg(m)") + g.P("}") + g.P() + } + if genRecv { + g.P("func (x *", streamType, ") Recv() (*", inType, ", error) {") + g.P("m := new(", inType, ")") + g.P("if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err }") + g.P("return m, nil") + g.P("}") + g.P() + } + + return hname +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/link_grpc.go b/vendor/github.com/golang/protobuf/protoc-gen-go/link_grpc.go new file mode 100644 index 000000000000..532a550050ee --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/link_grpc.go @@ -0,0 +1,34 @@ +// 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 main + +import _ "github.com/golang/protobuf/protoc-gen-go/grpc" diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/main.go b/vendor/github.com/golang/protobuf/protoc-gen-go/main.go new file mode 100644 index 000000000000..8e2486de0b2e --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/main.go @@ -0,0 +1,98 @@ +// 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. + +// protoc-gen-go is a plugin for the Google protocol buffer compiler to generate +// Go code. Run it by building this program and putting it in your path with +// the name +// protoc-gen-go +// That word 'go' at the end becomes part of the option string set for the +// protocol compiler, so once the protocol compiler (protoc) is installed +// you can run +// protoc --go_out=output_directory input_directory/file.proto +// to generate Go bindings for the protocol defined by file.proto. +// With that input, the output will be written to +// output_directory/file.pb.go +// +// The generated code is documented in the package comment for +// the library. +// +// See the README and documentation for protocol buffers to learn more: +// https://developers.google.com/protocol-buffers/ +package main + +import ( + "io/ioutil" + "os" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/protoc-gen-go/generator" +) + +func main() { + // Begin by allocating a generator. The request and response structures are stored there + // so we can do error handling easily - the response structure contains the field to + // report failure. + g := generator.New() + + data, err := ioutil.ReadAll(os.Stdin) + if err != nil { + g.Error(err, "reading input") + } + + if err := proto.Unmarshal(data, g.Request); err != nil { + g.Error(err, "parsing input proto") + } + + if len(g.Request.FileToGenerate) == 0 { + g.Fail("no files to generate") + } + + g.CommandLineParameters(g.Request.GetParameter()) + + // Create a wrapped version of the Descriptors and EnumDescriptors that + // point to the file that defines them. + g.WrapTypes() + + g.SetPackageNames() + g.BuildTypeNameMap() + + g.GenerateAllFiles() + + // Send back the results. + data, err = proto.Marshal(g.Response) + if err != nil { + g.Error(err, "failed to marshal output proto") + } + _, err = os.Stdout.Write(data) + if err != nil { + g.Error(err, "failed to write output proto") + } +} 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 000000000000..61bfc10e02e7 --- /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/protoc-gen-go/plugin/plugin.pb.golden b/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.golden new file mode 100644 index 000000000000..8953d0ff827e --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.golden @@ -0,0 +1,83 @@ +// Code generated by protoc-gen-go. +// source: google/protobuf/compiler/plugin.proto +// DO NOT EDIT! + +package google_protobuf_compiler + +import proto "github.com/golang/protobuf/proto" +import "math" +import google_protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor" + +// Reference proto and math imports to suppress error if they are not otherwise used. +var _ = proto.GetString +var _ = math.Inf + +type CodeGeneratorRequest struct { + FileToGenerate []string `protobuf:"bytes,1,rep,name=file_to_generate" json:"file_to_generate,omitempty"` + Parameter *string `protobuf:"bytes,2,opt,name=parameter" json:"parameter,omitempty"` + ProtoFile []*google_protobuf.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file" json:"proto_file,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (this *CodeGeneratorRequest) Reset() { *this = CodeGeneratorRequest{} } +func (this *CodeGeneratorRequest) String() string { return proto.CompactTextString(this) } +func (*CodeGeneratorRequest) ProtoMessage() {} + +func (this *CodeGeneratorRequest) GetParameter() string { + if this != nil && this.Parameter != nil { + return *this.Parameter + } + return "" +} + +type CodeGeneratorResponse struct { + Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` + File []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (this *CodeGeneratorResponse) Reset() { *this = CodeGeneratorResponse{} } +func (this *CodeGeneratorResponse) String() string { return proto.CompactTextString(this) } +func (*CodeGeneratorResponse) ProtoMessage() {} + +func (this *CodeGeneratorResponse) GetError() string { + if this != nil && this.Error != nil { + return *this.Error + } + return "" +} + +type CodeGeneratorResponse_File struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + InsertionPoint *string `protobuf:"bytes,2,opt,name=insertion_point" json:"insertion_point,omitempty"` + Content *string `protobuf:"bytes,15,opt,name=content" json:"content,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (this *CodeGeneratorResponse_File) Reset() { *this = CodeGeneratorResponse_File{} } +func (this *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(this) } +func (*CodeGeneratorResponse_File) ProtoMessage() {} + +func (this *CodeGeneratorResponse_File) GetName() string { + if this != nil && this.Name != nil { + return *this.Name + } + return "" +} + +func (this *CodeGeneratorResponse_File) GetInsertionPoint() string { + if this != nil && this.InsertionPoint != nil { + return *this.InsertionPoint + } + return "" +} + +func (this *CodeGeneratorResponse_File) GetContent() string { + if this != nil && this.Content != nil { + return *this.Content + } + return "" +} + +func init() { +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.proto b/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.proto new file mode 100644 index 000000000000..5b5574529ed4 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.proto @@ -0,0 +1,167 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// 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. + +// Author: kenton@google.com (Kenton Varda) +// +// WARNING: The plugin interface is currently EXPERIMENTAL and is subject to +// change. +// +// protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is +// just a program that reads a CodeGeneratorRequest from stdin and writes a +// CodeGeneratorResponse to stdout. +// +// Plugins written using C++ can use google/protobuf/compiler/plugin.h instead +// of dealing with the raw protocol defined here. +// +// A plugin executable needs only to be placed somewhere in the path. The +// plugin should be named "protoc-gen-$NAME", and will then be used when the +// flag "--${NAME}_out" is passed to protoc. + +syntax = "proto2"; +package google.protobuf.compiler; +option java_package = "com.google.protobuf.compiler"; +option java_outer_classname = "PluginProtos"; + +option go_package = "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go"; + +import "google/protobuf/descriptor.proto"; + +// The version number of protocol compiler. +message Version { + optional int32 major = 1; + optional int32 minor = 2; + optional int32 patch = 3; + // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should + // be empty for mainline stable releases. + optional string suffix = 4; +} + +// An encoded CodeGeneratorRequest is written to the plugin's stdin. +message CodeGeneratorRequest { + // 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. + repeated string file_to_generate = 1; + + // The generator parameter passed on the command-line. + optional string parameter = 2; + + // 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. + repeated FileDescriptorProto proto_file = 15; + + // The version number of protocol compiler. + optional Version compiler_version = 3; + +} + +// The plugin writes an encoded CodeGeneratorResponse to stdout. +message CodeGeneratorResponse { + // 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. + optional string error = 1; + + // Represents a single generated file. + message File { + // 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. + optional string name = 1; + + // 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. + optional string insertion_point = 2; + + // The file contents. + optional string content = 15; + } + repeated File file = 15; +} 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 000000000000..d82d6176b514 --- /dev/null +++ b/vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go @@ -0,0 +1,338 @@ +// 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/struct/struct.proto b/vendor/github.com/golang/protobuf/ptypes/struct/struct.proto new file mode 100644 index 000000000000..ed990e31d959 --- /dev/null +++ b/vendor/github.com/golang/protobuf/ptypes/struct/struct.proto @@ -0,0 +1,95 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// 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. + +syntax = "proto3"; + +package google.protobuf; + +option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option cc_enable_arenas = true; +option go_package = "github.com/golang/protobuf/ptypes/struct;structpb"; +option java_package = "com.google.protobuf"; +option java_outer_classname = "StructProto"; +option java_multiple_files = true; +option objc_class_prefix = "GPB"; + +// `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. +message Struct { + // Unordered map of dynamically typed values. + map fields = 1; +} + +// `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. +message Value { + // The kind of value. + oneof kind { + // Represents a null value. + NullValue null_value = 1; + // Represents a double value. + double number_value = 2; + // Represents a string value. + string string_value = 3; + // Represents a boolean value. + bool bool_value = 4; + // Represents a structured value. + Struct struct_value = 5; + // Represents a repeated `Value`. + ListValue list_value = 6; + } +} + +// `NullValue` is a singleton enumeration to represent the null value for the +// `Value` type union. +// +// The JSON representation for `NullValue` is JSON `null`. +enum NullValue { + // Null value. + NULL_VALUE = 0; +} + +// `ListValue` is a wrapper around a repeated field of values. +// +// The JSON representation for `ListValue` is JSON array. +message ListValue { + // Repeated field of dynamically typed values. + repeated Value values = 1; +} diff --git a/vendor/github.com/golang/snappy/.gitignore b/vendor/github.com/golang/snappy/.gitignore new file mode 100644 index 000000000000..042091d9b3b0 --- /dev/null +++ b/vendor/github.com/golang/snappy/.gitignore @@ -0,0 +1,16 @@ +cmd/snappytool/snappytool +testdata/bench + +# These explicitly listed benchmark data files are for an obsolete version of +# snappy_test.go. +testdata/alice29.txt +testdata/asyoulik.txt +testdata/fireworks.jpeg +testdata/geo.protodata +testdata/html +testdata/html_x_4 +testdata/kppkn.gtb +testdata/lcet10.txt +testdata/paper-100k.pdf +testdata/plrabn12.txt +testdata/urls.10K diff --git a/vendor/github.com/golang/snappy/encode.go b/vendor/github.com/golang/snappy/encode.go index 874968906090..8d393e904bb3 100644 --- a/vendor/github.com/golang/snappy/encode.go +++ b/vendor/github.com/golang/snappy/encode.go @@ -138,7 +138,7 @@ func NewBufferedWriter(w io.Writer) *Writer { } } -// Writer is an io.Writer than can write Snappy-compressed bytes. +// Writer is an io.Writer that can write Snappy-compressed bytes. type Writer struct { w io.Writer err error diff --git a/vendor/github.com/golang/snappy/encode_amd64.go b/vendor/github.com/golang/snappy/encode_amd64.go index 2a56fb504c71..150d91bc8be5 100644 --- a/vendor/github.com/golang/snappy/encode_amd64.go +++ b/vendor/github.com/golang/snappy/encode_amd64.go @@ -26,4 +26,4 @@ func extendMatch(src []byte, i, j int) int // encodeBlock has the same semantics as in encode_other.go. // //go:noescape -func encodeBlock(dst, src []byte) (d int) \ No newline at end of file +func encodeBlock(dst, src []byte) (d int) diff --git a/vendor/github.com/golang/snappy/go.mod b/vendor/github.com/golang/snappy/go.mod new file mode 100644 index 000000000000..f6406bb2c76d --- /dev/null +++ b/vendor/github.com/golang/snappy/go.mod @@ -0,0 +1 @@ +module github.com/golang/snappy diff --git a/vendor/github.com/golang/snappy/snappy.go b/vendor/github.com/golang/snappy/snappy.go index 0cf5e379c47f..ece692ea4610 100644 --- a/vendor/github.com/golang/snappy/snappy.go +++ b/vendor/github.com/golang/snappy/snappy.go @@ -2,10 +2,21 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package snappy implements the snappy block-based compression format. -// It aims for very high speeds and reasonable compression. +// Package snappy implements the Snappy compression format. It aims for very +// high speeds and reasonable compression. // -// The C++ snappy implementation is at https://github.com/google/snappy +// There are actually two Snappy formats: block and stream. They are related, +// but different: trying to decompress block-compressed data as a Snappy stream +// will fail, and vice versa. The block format is the Decode and Encode +// functions and the stream format is the Reader and Writer types. +// +// The block format, the more common case, is used when the complete size (the +// number of bytes) of the original data is known upfront, at the time +// compression starts. The stream format, also known as the framing format, is +// for when that isn't always true. +// +// The canonical, C++ implementation is at https://github.com/google/snappy and +// it only implements the block format. package snappy // import "github.com/golang/snappy" import ( diff --git a/vendor/github.com/google/btree/.travis.yml b/vendor/github.com/google/btree/.travis.yml new file mode 100644 index 000000000000..4f2ee4d97338 --- /dev/null +++ b/vendor/github.com/google/btree/.travis.yml @@ -0,0 +1 @@ +language: go diff --git a/vendor/github.com/google/go-cmp/cmp/cmpopts/equate.go b/vendor/github.com/google/go-cmp/cmp/cmpopts/equate.go index cc39492cf389..e102849b0bf5 100644 --- a/vendor/github.com/google/go-cmp/cmp/cmpopts/equate.go +++ b/vendor/github.com/google/go-cmp/cmp/cmpopts/equate.go @@ -8,8 +8,10 @@ package cmpopts import ( "math" "reflect" + "time" "github.com/google/go-cmp/cmp" + "golang.org/x/xerrors" ) func equateAlways(_, _ interface{}) bool { return true } @@ -17,7 +19,7 @@ func equateAlways(_, _ interface{}) bool { return true } // EquateEmpty returns a Comparer option that determines all maps and slices // with a length of zero to be equal, regardless of whether they are nil. // -// EquateEmpty can be used in conjuction with SortSlices and SortMaps. +// EquateEmpty can be used in conjunction with SortSlices and SortMaps. func EquateEmpty() cmp.Option { return cmp.FilterValues(isEmpty, cmp.Comparer(equateAlways)) } @@ -42,7 +44,7 @@ func isEmpty(x, y interface{}) bool { // The mathematical expression used is equivalent to: // |x-y| ≤ max(fraction*min(|x|, |y|), margin) // -// EquateApprox can be used in conjuction with EquateNaNs. +// EquateApprox can be used in conjunction with EquateNaNs. func EquateApprox(fraction, margin float64) cmp.Option { if margin < 0 || fraction < 0 || math.IsNaN(margin) || math.IsNaN(fraction) { panic("margin or fraction must be a non-negative number") @@ -73,7 +75,7 @@ func (a approximator) compareF32(x, y float32) bool { // EquateNaNs returns a Comparer option that determines float32 and float64 // NaN values to be equal. // -// EquateNaNs can be used in conjuction with EquateApprox. +// EquateNaNs can be used in conjunction with EquateApprox. func EquateNaNs() cmp.Option { return cmp.Options{ cmp.FilterValues(areNaNsF64s, cmp.Comparer(equateAlways)), @@ -87,3 +89,68 @@ func areNaNsF64s(x, y float64) bool { func areNaNsF32s(x, y float32) bool { return areNaNsF64s(float64(x), float64(y)) } + +// EquateApproxTime returns a Comparer option that determines two non-zero +// time.Time values to be equal if they are within some margin of one another. +// If both times have a monotonic clock reading, then the monotonic time +// difference will be used. The margin must be non-negative. +func EquateApproxTime(margin time.Duration) cmp.Option { + if margin < 0 { + panic("margin must be a non-negative number") + } + a := timeApproximator{margin} + return cmp.FilterValues(areNonZeroTimes, cmp.Comparer(a.compare)) +} + +func areNonZeroTimes(x, y time.Time) bool { + return !x.IsZero() && !y.IsZero() +} + +type timeApproximator struct { + margin time.Duration +} + +func (a timeApproximator) compare(x, y time.Time) bool { + // Avoid subtracting times to avoid overflow when the + // difference is larger than the largest representible duration. + if x.After(y) { + // Ensure x is always before y + x, y = y, x + } + // We're within the margin if x+margin >= y. + // Note: time.Time doesn't have AfterOrEqual method hence the negation. + return !x.Add(a.margin).Before(y) +} + +// AnyError is an error that matches any non-nil error. +var AnyError anyError + +type anyError struct{} + +func (anyError) Error() string { return "any error" } +func (anyError) Is(err error) bool { return err != nil } + +// EquateErrors returns a Comparer option that determines errors to be equal +// if errors.Is reports them to match. The AnyError error can be used to +// match any non-nil error. +func EquateErrors() cmp.Option { + return cmp.FilterValues(areConcreteErrors, cmp.Comparer(compareErrors)) +} + +// areConcreteErrors reports whether x and y are types that implement error. +// The input types are deliberately of the interface{} type rather than the +// error type so that we can handle situations where the current type is an +// interface{}, but the underlying concrete types both happen to implement +// the error interface. +func areConcreteErrors(x, y interface{}) bool { + _, ok1 := x.(error) + _, ok2 := y.(error) + return ok1 && ok2 +} + +func compareErrors(x, y interface{}) bool { + xe := x.(error) + ye := y.(error) + // TODO: Use errors.Is when go1.13 is the minimally supported version of Go. + return xerrors.Is(xe, ye) || xerrors.Is(ye, xe) +} diff --git a/vendor/github.com/google/go-cmp/cmp/cmpopts/ignore.go b/vendor/github.com/google/go-cmp/cmp/cmpopts/ignore.go index 016891da3269..ff8e785d4e88 100644 --- a/vendor/github.com/google/go-cmp/cmp/cmpopts/ignore.go +++ b/vendor/github.com/google/go-cmp/cmp/cmpopts/ignore.go @@ -11,6 +11,7 @@ import ( "unicode/utf8" "github.com/google/go-cmp/cmp" + "github.com/google/go-cmp/cmp/internal/function" ) // IgnoreFields returns an Option that ignores exported fields of the @@ -50,7 +51,7 @@ func (tf typeFilter) filter(p cmp.Path) bool { if len(p) < 1 { return false } - t := p[len(p)-1].Type() + t := p.Last().Type() for _, ti := range tf { if t.AssignableTo(ti) { return true @@ -95,7 +96,7 @@ func (tf ifaceFilter) filter(p cmp.Path) bool { if len(p) < 1 { return false } - t := p[len(p)-1].Type() + t := p.Last().Type() for _, ti := range tf { if t.AssignableTo(ti) { return true @@ -112,6 +113,10 @@ func (tf ifaceFilter) filter(p cmp.Path) bool { // In particular, unexported fields within the struct's exported fields // of struct types, including anonymous fields, will not be ignored unless the // type of the field itself is also passed to IgnoreUnexported. +// +// Avoid ignoring unexported fields of a type which you do not control (i.e. a +// type from another repository), as changes to the implementation of such types +// may change how the comparison behaves. Prefer a custom Comparer instead. func IgnoreUnexported(typs ...interface{}) cmp.Option { ux := newUnexportedFilter(typs...) return cmp.FilterPath(ux.filter, cmp.Ignore()) @@ -131,14 +136,11 @@ func newUnexportedFilter(typs ...interface{}) unexportedFilter { return ux } func (xf unexportedFilter) filter(p cmp.Path) bool { - if len(p) < 2 { - return false - } - sf, ok := p[len(p)-1].(cmp.StructField) + sf, ok := p.Index(-1).(cmp.StructField) if !ok { return false } - return xf.m[p[len(p)-2].Type()] && !isExported(sf.Name()) + return xf.m[p.Index(-2).Type()] && !isExported(sf.Name()) } // isExported reports whether the identifier is exported. @@ -146,3 +148,60 @@ func isExported(id string) bool { r, _ := utf8.DecodeRuneInString(id) return unicode.IsUpper(r) } + +// IgnoreSliceElements returns an Option that ignores elements of []V. +// The discard function must be of the form "func(T) bool" which is used to +// ignore slice elements of type V, where V is assignable to T. +// Elements are ignored if the function reports true. +func IgnoreSliceElements(discardFunc interface{}) cmp.Option { + vf := reflect.ValueOf(discardFunc) + if !function.IsType(vf.Type(), function.ValuePredicate) || vf.IsNil() { + panic(fmt.Sprintf("invalid discard function: %T", discardFunc)) + } + return cmp.FilterPath(func(p cmp.Path) bool { + si, ok := p.Index(-1).(cmp.SliceIndex) + if !ok { + return false + } + if !si.Type().AssignableTo(vf.Type().In(0)) { + return false + } + vx, vy := si.Values() + if vx.IsValid() && vf.Call([]reflect.Value{vx})[0].Bool() { + return true + } + if vy.IsValid() && vf.Call([]reflect.Value{vy})[0].Bool() { + return true + } + return false + }, cmp.Ignore()) +} + +// IgnoreMapEntries returns an Option that ignores entries of map[K]V. +// The discard function must be of the form "func(T, R) bool" which is used to +// ignore map entries of type K and V, where K and V are assignable to T and R. +// Entries are ignored if the function reports true. +func IgnoreMapEntries(discardFunc interface{}) cmp.Option { + vf := reflect.ValueOf(discardFunc) + if !function.IsType(vf.Type(), function.KeyValuePredicate) || vf.IsNil() { + panic(fmt.Sprintf("invalid discard function: %T", discardFunc)) + } + return cmp.FilterPath(func(p cmp.Path) bool { + mi, ok := p.Index(-1).(cmp.MapIndex) + if !ok { + return false + } + if !mi.Key().Type().AssignableTo(vf.Type().In(0)) || !mi.Type().AssignableTo(vf.Type().In(1)) { + return false + } + k := mi.Key() + vx, vy := mi.Values() + if vx.IsValid() && vf.Call([]reflect.Value{k, vx})[0].Bool() { + return true + } + if vy.IsValid() && vf.Call([]reflect.Value{k, vy})[0].Bool() { + return true + } + return false + }, cmp.Ignore()) +} diff --git a/vendor/github.com/google/go-cmp/cmp/cmpopts/sort.go b/vendor/github.com/google/go-cmp/cmp/cmpopts/sort.go index a566d240bb53..3a4804621e93 100644 --- a/vendor/github.com/google/go-cmp/cmp/cmpopts/sort.go +++ b/vendor/github.com/google/go-cmp/cmp/cmpopts/sort.go @@ -7,6 +7,7 @@ package cmpopts import ( "fmt" "reflect" + "sort" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/internal/function" @@ -24,14 +25,14 @@ import ( // The less function does not have to be "total". That is, if !less(x, y) and // !less(y, x) for two elements x and y, their relative order is maintained. // -// SortSlices can be used in conjuction with EquateEmpty. -func SortSlices(less interface{}) cmp.Option { - vf := reflect.ValueOf(less) +// SortSlices can be used in conjunction with EquateEmpty. +func SortSlices(lessFunc interface{}) cmp.Option { + vf := reflect.ValueOf(lessFunc) if !function.IsType(vf.Type(), function.Less) || vf.IsNil() { - panic(fmt.Sprintf("invalid less function: %T", less)) + panic(fmt.Sprintf("invalid less function: %T", lessFunc)) } ss := sliceSorter{vf.Type().In(0), vf} - return cmp.FilterValues(ss.filter, cmp.Transformer("Sort", ss.sort)) + return cmp.FilterValues(ss.filter, cmp.Transformer("cmpopts.SortSlices", ss.sort)) } type sliceSorter struct { @@ -48,8 +49,8 @@ func (ss sliceSorter) filter(x, y interface{}) bool { } // Check whether the slices are already sorted to avoid an infinite // recursion cycle applying the same transform to itself. - ok1 := sliceIsSorted(x, func(i, j int) bool { return ss.less(vx, i, j) }) - ok2 := sliceIsSorted(y, func(i, j int) bool { return ss.less(vy, i, j) }) + ok1 := sort.SliceIsSorted(x, func(i, j int) bool { return ss.less(vx, i, j) }) + ok2 := sort.SliceIsSorted(y, func(i, j int) bool { return ss.less(vy, i, j) }) return !ok1 || !ok2 } func (ss sliceSorter) sort(x interface{}) interface{} { @@ -58,7 +59,7 @@ func (ss sliceSorter) sort(x interface{}) interface{} { for i := 0; i < src.Len(); i++ { dst.Index(i).Set(src.Index(i)) } - sortSliceStable(dst.Interface(), func(i, j int) bool { return ss.less(dst, i, j) }) + sort.SliceStable(dst.Interface(), func(i, j int) bool { return ss.less(dst, i, j) }) ss.checkSort(dst) return dst.Interface() } @@ -95,14 +96,14 @@ func (ss sliceSorter) less(v reflect.Value, i, j int) bool { // • Transitive: if !less(x, y) and !less(y, z), then !less(x, z) // • Total: if x != y, then either less(x, y) or less(y, x) // -// SortMaps can be used in conjuction with EquateEmpty. -func SortMaps(less interface{}) cmp.Option { - vf := reflect.ValueOf(less) +// SortMaps can be used in conjunction with EquateEmpty. +func SortMaps(lessFunc interface{}) cmp.Option { + vf := reflect.ValueOf(lessFunc) if !function.IsType(vf.Type(), function.Less) || vf.IsNil() { - panic(fmt.Sprintf("invalid less function: %T", less)) + panic(fmt.Sprintf("invalid less function: %T", lessFunc)) } ms := mapSorter{vf.Type().In(0), vf} - return cmp.FilterValues(ms.filter, cmp.Transformer("Sort", ms.sort)) + return cmp.FilterValues(ms.filter, cmp.Transformer("cmpopts.SortMaps", ms.sort)) } type mapSorter struct { @@ -118,7 +119,10 @@ func (ms mapSorter) filter(x, y interface{}) bool { } func (ms mapSorter) sort(x interface{}) interface{} { src := reflect.ValueOf(x) - outType := mapEntryType(src.Type()) + outType := reflect.StructOf([]reflect.StructField{ + {Name: "K", Type: src.Type().Key()}, + {Name: "V", Type: src.Type().Elem()}, + }) dst := reflect.MakeSlice(reflect.SliceOf(outType), src.Len(), src.Len()) for i, k := range src.MapKeys() { v := reflect.New(outType).Elem() @@ -126,7 +130,7 @@ func (ms mapSorter) sort(x interface{}) interface{} { v.Field(1).Set(src.MapIndex(k)) dst.Index(i).Set(v) } - sortSlice(dst.Interface(), func(i, j int) bool { return ms.less(dst, i, j) }) + sort.Slice(dst.Interface(), func(i, j int) bool { return ms.less(dst, i, j) }) ms.checkSort(dst) return dst.Interface() } @@ -139,8 +143,5 @@ func (ms mapSorter) checkSort(v reflect.Value) { } func (ms mapSorter) less(v reflect.Value, i, j int) bool { vx, vy := v.Index(i).Field(0), v.Index(j).Field(0) - if !hasReflectStructOf { - vx, vy = vx.Elem(), vy.Elem() - } return ms.fnc.Call([]reflect.Value{vx, vy})[0].Bool() } diff --git a/vendor/github.com/google/go-cmp/cmp/cmpopts/sort_go17.go b/vendor/github.com/google/go-cmp/cmp/cmpopts/sort_go17.go deleted file mode 100644 index 839b88ca4020..000000000000 --- a/vendor/github.com/google/go-cmp/cmp/cmpopts/sort_go17.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE.md file. - -// +build !go1.8 - -package cmpopts - -import ( - "reflect" - "sort" -) - -const hasReflectStructOf = false - -func mapEntryType(reflect.Type) reflect.Type { - return reflect.TypeOf(struct{ K, V interface{} }{}) -} - -func sliceIsSorted(slice interface{}, less func(i, j int) bool) bool { - return sort.IsSorted(reflectSliceSorter{reflect.ValueOf(slice), less}) -} -func sortSlice(slice interface{}, less func(i, j int) bool) { - sort.Sort(reflectSliceSorter{reflect.ValueOf(slice), less}) -} -func sortSliceStable(slice interface{}, less func(i, j int) bool) { - sort.Stable(reflectSliceSorter{reflect.ValueOf(slice), less}) -} - -type reflectSliceSorter struct { - slice reflect.Value - less func(i, j int) bool -} - -func (ss reflectSliceSorter) Len() int { - return ss.slice.Len() -} -func (ss reflectSliceSorter) Less(i, j int) bool { - return ss.less(i, j) -} -func (ss reflectSliceSorter) Swap(i, j int) { - vi := ss.slice.Index(i).Interface() - vj := ss.slice.Index(j).Interface() - ss.slice.Index(i).Set(reflect.ValueOf(vj)) - ss.slice.Index(j).Set(reflect.ValueOf(vi)) -} diff --git a/vendor/github.com/google/go-cmp/cmp/cmpopts/sort_go18.go b/vendor/github.com/google/go-cmp/cmp/cmpopts/sort_go18.go deleted file mode 100644 index 8a59c0d38fdd..000000000000 --- a/vendor/github.com/google/go-cmp/cmp/cmpopts/sort_go18.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE.md file. - -// +build go1.8 - -package cmpopts - -import ( - "reflect" - "sort" -) - -const hasReflectStructOf = true - -func mapEntryType(t reflect.Type) reflect.Type { - return reflect.StructOf([]reflect.StructField{ - {Name: "K", Type: t.Key()}, - {Name: "V", Type: t.Elem()}, - }) -} - -func sliceIsSorted(slice interface{}, less func(i, j int) bool) bool { - return sort.SliceIsSorted(slice, less) -} -func sortSlice(slice interface{}, less func(i, j int) bool) { - sort.Slice(slice, less) -} -func sortSliceStable(slice interface{}, less func(i, j int) bool) { - sort.SliceStable(slice, less) -} diff --git a/vendor/github.com/google/go-cmp/cmp/cmpopts/xform.go b/vendor/github.com/google/go-cmp/cmp/cmpopts/xform.go new file mode 100644 index 000000000000..9d651553d78a --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/cmpopts/xform.go @@ -0,0 +1,35 @@ +// Copyright 2018, 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.md file. + +package cmpopts + +import ( + "github.com/google/go-cmp/cmp" +) + +type xformFilter struct{ xform cmp.Option } + +func (xf xformFilter) filter(p cmp.Path) bool { + for _, ps := range p { + if t, ok := ps.(cmp.Transform); ok && t.Option() == xf.xform { + return false + } + } + return true +} + +// AcyclicTransformer returns a Transformer with a filter applied that ensures +// that the transformer cannot be recursively applied upon its own output. +// +// An example use case is a transformer that splits a string by lines: +// AcyclicTransformer("SplitLines", func(s string) []string{ +// return strings.Split(s, "\n") +// }) +// +// Had this been an unfiltered Transformer instead, this would result in an +// infinite cycle converting a string to []string to [][]string and so on. +func AcyclicTransformer(name string, xformFunc interface{}) cmp.Option { + xf := xformFilter{cmp.Transformer(name, xformFunc)} + return cmp.FilterPath(xf.filter, xf.xform) +} diff --git a/vendor/github.com/google/go-cmp/cmp/compare.go b/vendor/github.com/google/go-cmp/cmp/compare.go index 5527f0149761..c9a63ceda5e6 100644 --- a/vendor/github.com/google/go-cmp/cmp/compare.go +++ b/vendor/github.com/google/go-cmp/cmp/compare.go @@ -22,33 +22,24 @@ // equality is determined by recursively comparing the primitive kinds on both // values, much like reflect.DeepEqual. Unlike reflect.DeepEqual, unexported // fields are not compared by default; they result in panics unless suppressed -// by using an Ignore option (see cmpopts.IgnoreUnexported) or explictly compared -// using the AllowUnexported option. +// by using an Ignore option (see cmpopts.IgnoreUnexported) or explicitly +// compared using the Exporter option. package cmp import ( "fmt" "reflect" + "strings" "github.com/google/go-cmp/cmp/internal/diff" + "github.com/google/go-cmp/cmp/internal/flags" "github.com/google/go-cmp/cmp/internal/function" "github.com/google/go-cmp/cmp/internal/value" ) -// BUG: Maps with keys containing NaN values cannot be properly compared due to -// the reflection package's inability to retrieve such entries. Equal will panic -// anytime it comes across a NaN key, but this behavior may change. -// -// See https://golang.org/issue/11104 for more details. - -var nothing = reflect.Value{} - // Equal reports whether x and y are equal by recursively applying the // following rules in the given order to x and y and all of their sub-values: // -// • If two values are not of the same type, then they are never equal -// and the overall result is false. -// // • Let S be the set of all Ignore, Transformer, and Comparer options that // remain after applying all path filters, value filters, and type filters. // If at least one Ignore exists in S, then the comparison is ignored. @@ -61,43 +52,84 @@ var nothing = reflect.Value{} // // • If the values have an Equal method of the form "(T) Equal(T) bool" or // "(T) Equal(I) bool" where T is assignable to I, then use the result of -// x.Equal(y). Otherwise, no such method exists and evaluation proceeds to -// the next rule. +// x.Equal(y) even if x or y is nil. Otherwise, no such method exists and +// evaluation proceeds to the next rule. // // • Lastly, try to compare x and y based on their basic kinds. // Simple kinds like booleans, integers, floats, complex numbers, strings, and // channels are compared using the equivalent of the == operator in Go. // Functions are only equal if they are both nil, otherwise they are unequal. -// Pointers are equal if the underlying values they point to are also equal. -// Interfaces are equal if their underlying concrete values are also equal. // -// Structs are equal if all of their fields are equal. If a struct contains -// unexported fields, Equal panics unless the AllowUnexported option is used or -// an Ignore option (e.g., cmpopts.IgnoreUnexported) ignores that field. +// Structs are equal if recursively calling Equal on all fields report equal. +// If a struct contains unexported fields, Equal panics unless an Ignore option +// (e.g., cmpopts.IgnoreUnexported) ignores that field or the Exporter option +// explicitly permits comparing the unexported field. +// +// Slices are equal if they are both nil or both non-nil, where recursively +// calling Equal on all non-ignored slice or array elements report equal. +// Empty non-nil slices and nil slices are not equal; to equate empty slices, +// consider using cmpopts.EquateEmpty. // -// Arrays, slices, and maps are equal if they are both nil or both non-nil -// with the same length and the elements at each index or key are equal. -// Note that a non-nil empty slice and a nil slice are not equal. -// To equate empty slices and maps, consider using cmpopts.EquateEmpty. +// Maps are equal if they are both nil or both non-nil, where recursively +// calling Equal on all non-ignored map entries report equal. // Map keys are equal according to the == operator. // To use custom comparisons for map keys, consider using cmpopts.SortMaps. +// Empty non-nil maps and nil maps are not equal; to equate empty maps, +// consider using cmpopts.EquateEmpty. +// +// Pointers and interfaces are equal if they are both nil or both non-nil, +// where they have the same underlying concrete type and recursively +// calling Equal on the underlying values reports equal. +// +// Before recursing into a pointer, slice element, or map, the current path +// is checked to detect whether the address has already been visited. +// If there is a cycle, then the pointed at values are considered equal +// only if both addresses were previously visited in the same path step. func Equal(x, y interface{}, opts ...Option) bool { + vx := reflect.ValueOf(x) + vy := reflect.ValueOf(y) + + // If the inputs are different types, auto-wrap them in an empty interface + // so that they have the same parent type. + var t reflect.Type + if !vx.IsValid() || !vy.IsValid() || vx.Type() != vy.Type() { + t = reflect.TypeOf((*interface{})(nil)).Elem() + if vx.IsValid() { + vvx := reflect.New(t).Elem() + vvx.Set(vx) + vx = vvx + } + if vy.IsValid() { + vvy := reflect.New(t).Elem() + vvy.Set(vy) + vy = vvy + } + } else { + t = vx.Type() + } + s := newState(opts) - s.compareAny(reflect.ValueOf(x), reflect.ValueOf(y)) + s.compareAny(&pathStep{t, vx, vy}) return s.result.Equal() } // Diff returns a human-readable report of the differences between two values. // It returns an empty string if and only if Equal returns true for the same -// input values and options. The output string will use the "-" symbol to -// indicate elements removed from x, and the "+" symbol to indicate elements -// added to y. +// input values and options. +// +// The output is displayed as a literal in pseudo-Go syntax. +// At the start of each line, a "-" prefix indicates an element removed from x, +// a "+" prefix to indicates an element added to y, and the lack of a prefix +// indicates an element common to both x and y. If possible, the output +// uses fmt.Stringer.String or error.Error methods to produce more humanly +// readable outputs. In such cases, the string is prefixed with either an +// 's' or 'e' character, respectively, to indicate that the method was called. // -// Do not depend on this output being stable. +// Do not depend on this output being stable. If you need the ability to +// programmatically interpret the difference, consider using a custom Reporter. func Diff(x, y interface{}, opts ...Option) string { r := new(defaultReporter) - opts = Options{Options(opts), r} - eq := Equal(x, y, opts...) + eq := Equal(x, y, Options(opts), Reporter(r)) d := r.String() if (d == "") != eq { panic("inconsistent difference and equality results") @@ -108,24 +140,29 @@ func Diff(x, y interface{}, opts ...Option) string { type state struct { // These fields represent the "comparison state". // Calling statelessCompare must not result in observable changes to these. - result diff.Result // The current result of comparison - curPath Path // The current path in the value tree - reporter reporter // Optional reporter used for difference formatting + result diff.Result // The current result of comparison + curPath Path // The current path in the value tree + curPtrs pointerPath // The current set of visited pointers + reporters []reporter // Optional reporters + + // recChecker checks for infinite cycles applying the same set of + // transformers upon the output of itself. + recChecker recChecker // dynChecker triggers pseudo-random checks for option correctness. // It is safe for statelessCompare to mutate this value. dynChecker dynChecker // These fields, once set by processOption, will not change. - exporters map[reflect.Type]bool // Set of structs with unexported field visibility - opts Options // List of all fundamental and filter options + exporters []exporter // List of exporters for structs with unexported fields + opts Options // List of all fundamental and filter options } func newState(opts []Option) *state { - s := new(state) - for _, opt := range opts { - s.processOption(opt) - } + // Always ensure a validator option exists to validate the inputs. + s := &state{opts: Options{validator{}}} + s.curPtrs.Init() + s.processOption(Options(opts)) return s } @@ -144,18 +181,10 @@ func (s *state) processOption(opt Option) { panic(fmt.Sprintf("cannot use an unfiltered option: %v", opt)) } s.opts = append(s.opts, opt) - case visibleStructs: - if s.exporters == nil { - s.exporters = make(map[reflect.Type]bool) - } - for t := range opt { - s.exporters[t] = true - } + case exporter: + s.exporters = append(s.exporters, opt) case reporter: - if s.reporter != nil { - panic("difference reporter already registered") - } - s.reporter = opt + s.reporters = append(s.reporters, opt) default: panic(fmt.Sprintf("unknown option %T", opt)) } @@ -164,152 +193,96 @@ func (s *state) processOption(opt Option) { // statelessCompare compares two values and returns the result. // This function is stateless in that it does not alter the current result, // or output to any registered reporters. -func (s *state) statelessCompare(vx, vy reflect.Value) diff.Result { - // We do not save and restore the curPath because all of the compareX - // methods should properly push and pop from the path. - // It is an implementation bug if the contents of curPath differs from +func (s *state) statelessCompare(step PathStep) diff.Result { + // We do not save and restore curPath and curPtrs because all of the + // compareX methods should properly push and pop from them. + // It is an implementation bug if the contents of the paths differ from // when calling this function to when returning from it. - oldResult, oldReporter := s.result, s.reporter + oldResult, oldReporters := s.result, s.reporters s.result = diff.Result{} // Reset result - s.reporter = nil // Remove reporter to avoid spurious printouts - s.compareAny(vx, vy) + s.reporters = nil // Remove reporters to avoid spurious printouts + s.compareAny(step) res := s.result - s.result, s.reporter = oldResult, oldReporter + s.result, s.reporters = oldResult, oldReporters return res } -func (s *state) compareAny(vx, vy reflect.Value) { - // TODO: Support cyclic data structures. - - // Rule 0: Differing types are never equal. - if !vx.IsValid() || !vy.IsValid() { - s.report(vx.IsValid() == vy.IsValid(), vx, vy) - return - } - if vx.Type() != vy.Type() { - s.report(false, vx, vy) // Possible for path to be empty - return +func (s *state) compareAny(step PathStep) { + // Update the path stack. + s.curPath.push(step) + defer s.curPath.pop() + for _, r := range s.reporters { + r.PushStep(step) + defer r.PopStep() } - t := vx.Type() - if len(s.curPath) == 0 { - s.curPath.push(&pathStep{typ: t}) - defer s.curPath.pop() + s.recChecker.Check(s.curPath) + + // Cycle-detection for slice elements (see NOTE in compareSlice). + t := step.Type() + vx, vy := step.Values() + if si, ok := step.(SliceIndex); ok && si.isSlice && vx.IsValid() && vy.IsValid() { + px, py := vx.Addr(), vy.Addr() + if eq, visited := s.curPtrs.Push(px, py); visited { + s.report(eq, reportByCycle) + return + } + defer s.curPtrs.Pop(px, py) } - vx, vy = s.tryExporting(vx, vy) // Rule 1: Check whether an option applies on this node in the value tree. - if s.tryOptions(vx, vy, t) { + if s.tryOptions(t, vx, vy) { return } // Rule 2: Check whether the type has a valid Equal method. - if s.tryMethod(vx, vy, t) { + if s.tryMethod(t, vx, vy) { return } - // Rule 3: Recursively descend into each value's underlying kind. + // Rule 3: Compare based on the underlying kind. switch t.Kind() { case reflect.Bool: - s.report(vx.Bool() == vy.Bool(), vx, vy) - return + s.report(vx.Bool() == vy.Bool(), 0) case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - s.report(vx.Int() == vy.Int(), vx, vy) - return + s.report(vx.Int() == vy.Int(), 0) case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - s.report(vx.Uint() == vy.Uint(), vx, vy) - return + s.report(vx.Uint() == vy.Uint(), 0) case reflect.Float32, reflect.Float64: - s.report(vx.Float() == vy.Float(), vx, vy) - return + s.report(vx.Float() == vy.Float(), 0) case reflect.Complex64, reflect.Complex128: - s.report(vx.Complex() == vy.Complex(), vx, vy) - return + s.report(vx.Complex() == vy.Complex(), 0) case reflect.String: - s.report(vx.String() == vy.String(), vx, vy) - return + s.report(vx.String() == vy.String(), 0) case reflect.Chan, reflect.UnsafePointer: - s.report(vx.Pointer() == vy.Pointer(), vx, vy) - return + s.report(vx.Pointer() == vy.Pointer(), 0) case reflect.Func: - s.report(vx.IsNil() && vy.IsNil(), vx, vy) - return + s.report(vx.IsNil() && vy.IsNil(), 0) + case reflect.Struct: + s.compareStruct(t, vx, vy) + case reflect.Slice, reflect.Array: + s.compareSlice(t, vx, vy) + case reflect.Map: + s.compareMap(t, vx, vy) case reflect.Ptr: - if vx.IsNil() || vy.IsNil() { - s.report(vx.IsNil() && vy.IsNil(), vx, vy) - return - } - s.curPath.push(&indirect{pathStep{t.Elem()}}) - defer s.curPath.pop() - s.compareAny(vx.Elem(), vy.Elem()) - return + s.comparePtr(t, vx, vy) case reflect.Interface: - if vx.IsNil() || vy.IsNil() { - s.report(vx.IsNil() && vy.IsNil(), vx, vy) - return - } - if vx.Elem().Type() != vy.Elem().Type() { - s.report(false, vx.Elem(), vy.Elem()) - return - } - s.curPath.push(&typeAssertion{pathStep{vx.Elem().Type()}}) - defer s.curPath.pop() - s.compareAny(vx.Elem(), vy.Elem()) - return - case reflect.Slice: - if vx.IsNil() || vy.IsNil() { - s.report(vx.IsNil() && vy.IsNil(), vx, vy) - return - } - fallthrough - case reflect.Array: - s.compareArray(vx, vy, t) - return - case reflect.Map: - s.compareMap(vx, vy, t) - return - case reflect.Struct: - s.compareStruct(vx, vy, t) - return + s.compareInterface(t, vx, vy) default: panic(fmt.Sprintf("%v kind not handled", t.Kind())) } } -func (s *state) tryExporting(vx, vy reflect.Value) (reflect.Value, reflect.Value) { - if sf, ok := s.curPath[len(s.curPath)-1].(*structField); ok && sf.unexported { - if sf.force { - // Use unsafe pointer arithmetic to get read-write access to an - // unexported field in the struct. - vx = unsafeRetrieveField(sf.pvx, sf.field) - vy = unsafeRetrieveField(sf.pvy, sf.field) - } else { - // We are not allowed to export the value, so invalidate them - // so that tryOptions can panic later if not explicitly ignored. - vx = nothing - vy = nothing - } - } - return vx, vy -} - -func (s *state) tryOptions(vx, vy reflect.Value, t reflect.Type) bool { - // If there were no FilterValues, we will not detect invalid inputs, - // so manually check for them and append invalid if necessary. - // We still evaluate the options since an ignore can override invalid. - opts := s.opts - if !vx.IsValid() || !vy.IsValid() { - opts = Options{opts, invalid{}} - } - +func (s *state) tryOptions(t reflect.Type, vx, vy reflect.Value) bool { // Evaluate all filters and apply the remaining options. - if opt := opts.filter(s, vx, vy, t); opt != nil { - return opt.apply(s, vx, vy) + if opt := s.opts.filter(s, t, vx, vy); opt != nil { + opt.apply(s, vx, vy) + return true } return false } -func (s *state) tryMethod(vx, vy reflect.Value, t reflect.Type) bool { +func (s *state) tryMethod(t reflect.Type, vx, vy reflect.Value) bool { // Check if this type even has an Equal method. m, ok := t.MethodByName("Equal") if !ok || !function.IsType(m.Type, function.EqualAssignable) { @@ -317,11 +290,12 @@ func (s *state) tryMethod(vx, vy reflect.Value, t reflect.Type) bool { } eq := s.callTTBFunc(m.Func, vx, vy) - s.report(eq, vx, vy) + s.report(eq, reportByMethod) return true } -func (s *state) callTRFunc(f, v reflect.Value) reflect.Value { +func (s *state) callTRFunc(f, v reflect.Value, step Transform) reflect.Value { + v = sanitizeValue(v, f.Type().In(0)) if !s.dynChecker.Next() { return f.Call([]reflect.Value{v})[0] } @@ -331,20 +305,22 @@ func (s *state) callTRFunc(f, v reflect.Value) reflect.Value { // unsafe mutations to the input. c := make(chan reflect.Value) go detectRaces(c, f, v) + got := <-c want := f.Call([]reflect.Value{v})[0] - if got := <-c; !s.statelessCompare(got, want).Equal() { + if step.vx, step.vy = got, want; !s.statelessCompare(step).Equal() { // To avoid false-positives with non-reflexive equality operations, // we sanity check whether a value is equal to itself. - if !s.statelessCompare(want, want).Equal() { + if step.vx, step.vy = want, want; !s.statelessCompare(step).Equal() { return want } - fn := getFuncName(f.Pointer()) - panic(fmt.Sprintf("non-deterministic function detected: %s", fn)) + panic(fmt.Sprintf("non-deterministic function detected: %s", function.NameOf(f))) } return want } func (s *state) callTTBFunc(f, x, y reflect.Value) bool { + x = sanitizeValue(x, f.Type().In(0)) + y = sanitizeValue(y, f.Type().In(1)) if !s.dynChecker.Next() { return f.Call([]reflect.Value{x, y})[0].Bool() } @@ -355,10 +331,10 @@ func (s *state) callTTBFunc(f, x, y reflect.Value) bool { // unsafe mutations to the input. c := make(chan reflect.Value) go detectRaces(c, f, y, x) + got := <-c want := f.Call([]reflect.Value{x, y})[0].Bool() - if got := <-c; !got.IsValid() || got.Bool() != want { - fn := getFuncName(f.Pointer()) - panic(fmt.Sprintf("non-deterministic or non-symmetric function detected: %s", fn)) + if !got.IsValid() || got.Bool() != want { + panic(fmt.Sprintf("non-deterministic or non-symmetric function detected: %s", function.NameOf(f))) } return want } @@ -372,124 +348,274 @@ func detectRaces(c chan<- reflect.Value, f reflect.Value, vs ...reflect.Value) { ret = f.Call(vs)[0] } -func (s *state) compareArray(vx, vy reflect.Value, t reflect.Type) { - step := &sliceIndex{pathStep{t.Elem()}, 0, 0} - s.curPath.push(step) +// sanitizeValue converts nil interfaces of type T to those of type R, +// assuming that T is assignable to R. +// Otherwise, it returns the input value as is. +func sanitizeValue(v reflect.Value, t reflect.Type) reflect.Value { + // TODO(dsnet): Workaround for reflect bug (https://golang.org/issue/22143). + if !flags.AtLeastGo110 { + if v.Kind() == reflect.Interface && v.IsNil() && v.Type() != t { + return reflect.New(t).Elem() + } + } + return v +} - // Compute an edit-script for slices vx and vy. - eq, es := diff.Difference(vx.Len(), vy.Len(), func(ix, iy int) diff.Result { - step.xkey, step.ykey = ix, iy - return s.statelessCompare(vx.Index(ix), vy.Index(iy)) - }) +func (s *state) compareStruct(t reflect.Type, vx, vy reflect.Value) { + var vax, vay reflect.Value // Addressable versions of vx and vy + + var mayForce, mayForceInit bool + step := StructField{&structField{}} + for i := 0; i < t.NumField(); i++ { + step.typ = t.Field(i).Type + step.vx = vx.Field(i) + step.vy = vy.Field(i) + step.name = t.Field(i).Name + step.idx = i + step.unexported = !isExported(step.name) + if step.unexported { + if step.name == "_" { + continue + } + // Defer checking of unexported fields until later to give an + // Ignore a chance to ignore the field. + if !vax.IsValid() || !vay.IsValid() { + // For retrieveUnexportedField to work, the parent struct must + // be addressable. Create a new copy of the values if + // necessary to make them addressable. + vax = makeAddressable(vx) + vay = makeAddressable(vy) + } + if !mayForceInit { + for _, xf := range s.exporters { + mayForce = mayForce || xf(t) + } + mayForceInit = true + } + step.mayForce = mayForce + step.pvx = vax + step.pvy = vay + step.field = t.Field(i) + } + s.compareAny(step) + } +} - // Equal or no edit-script, so report entire slices as is. - if eq || es == nil { - s.curPath.pop() // Pop first since we are reporting the whole slice - s.report(eq, vx, vy) +func (s *state) compareSlice(t reflect.Type, vx, vy reflect.Value) { + isSlice := t.Kind() == reflect.Slice + if isSlice && (vx.IsNil() || vy.IsNil()) { + s.report(vx.IsNil() && vy.IsNil(), 0) return } - // Replay the edit-script. + // NOTE: It is incorrect to call curPtrs.Push on the slice header pointer + // since slices represents a list of pointers, rather than a single pointer. + // The pointer checking logic must be handled on a per-element basis + // in compareAny. + // + // A slice header (see reflect.SliceHeader) in Go is a tuple of a starting + // pointer P, a length N, and a capacity C. Supposing each slice element has + // a memory size of M, then the slice is equivalent to the list of pointers: + // [P+i*M for i in range(N)] + // + // For example, v[:0] and v[:1] are slices with the same starting pointer, + // but they are clearly different values. Using the slice pointer alone + // violates the assumption that equal pointers implies equal values. + + step := SliceIndex{&sliceIndex{pathStep: pathStep{typ: t.Elem()}, isSlice: isSlice}} + withIndexes := func(ix, iy int) SliceIndex { + if ix >= 0 { + step.vx, step.xkey = vx.Index(ix), ix + } else { + step.vx, step.xkey = reflect.Value{}, -1 + } + if iy >= 0 { + step.vy, step.ykey = vy.Index(iy), iy + } else { + step.vy, step.ykey = reflect.Value{}, -1 + } + return step + } + + // Ignore options are able to ignore missing elements in a slice. + // However, detecting these reliably requires an optimal differencing + // algorithm, for which diff.Difference is not. + // + // Instead, we first iterate through both slices to detect which elements + // would be ignored if standing alone. The index of non-discarded elements + // are stored in a separate slice, which diffing is then performed on. + var indexesX, indexesY []int + var ignoredX, ignoredY []bool + for ix := 0; ix < vx.Len(); ix++ { + ignored := s.statelessCompare(withIndexes(ix, -1)).NumDiff == 0 + if !ignored { + indexesX = append(indexesX, ix) + } + ignoredX = append(ignoredX, ignored) + } + for iy := 0; iy < vy.Len(); iy++ { + ignored := s.statelessCompare(withIndexes(-1, iy)).NumDiff == 0 + if !ignored { + indexesY = append(indexesY, iy) + } + ignoredY = append(ignoredY, ignored) + } + + // Compute an edit-script for slices vx and vy (excluding ignored elements). + edits := diff.Difference(len(indexesX), len(indexesY), func(ix, iy int) diff.Result { + return s.statelessCompare(withIndexes(indexesX[ix], indexesY[iy])) + }) + + // Replay the ignore-scripts and the edit-script. var ix, iy int - for _, e := range es { + for ix < vx.Len() || iy < vy.Len() { + var e diff.EditType + switch { + case ix < len(ignoredX) && ignoredX[ix]: + e = diff.UniqueX + case iy < len(ignoredY) && ignoredY[iy]: + e = diff.UniqueY + default: + e, edits = edits[0], edits[1:] + } switch e { case diff.UniqueX: - step.xkey, step.ykey = ix, -1 - s.report(false, vx.Index(ix), nothing) + s.compareAny(withIndexes(ix, -1)) ix++ case diff.UniqueY: - step.xkey, step.ykey = -1, iy - s.report(false, nothing, vy.Index(iy)) + s.compareAny(withIndexes(-1, iy)) iy++ default: - step.xkey, step.ykey = ix, iy - if e == diff.Identity { - s.report(true, vx.Index(ix), vy.Index(iy)) - } else { - s.compareAny(vx.Index(ix), vy.Index(iy)) - } + s.compareAny(withIndexes(ix, iy)) ix++ iy++ } } - s.curPath.pop() - return } -func (s *state) compareMap(vx, vy reflect.Value, t reflect.Type) { +func (s *state) compareMap(t reflect.Type, vx, vy reflect.Value) { if vx.IsNil() || vy.IsNil() { - s.report(vx.IsNil() && vy.IsNil(), vx, vy) + s.report(vx.IsNil() && vy.IsNil(), 0) + return + } + + // Cycle-detection for maps. + if eq, visited := s.curPtrs.Push(vx, vy); visited { + s.report(eq, reportByCycle) return } + defer s.curPtrs.Pop(vx, vy) // We combine and sort the two map keys so that we can perform the // comparisons in a deterministic order. - step := &mapIndex{pathStep: pathStep{t.Elem()}} - s.curPath.push(step) - defer s.curPath.pop() + step := MapIndex{&mapIndex{pathStep: pathStep{typ: t.Elem()}}} for _, k := range value.SortKeys(append(vx.MapKeys(), vy.MapKeys()...)) { + step.vx = vx.MapIndex(k) + step.vy = vy.MapIndex(k) step.key = k - vvx := vx.MapIndex(k) - vvy := vy.MapIndex(k) - switch { - case vvx.IsValid() && vvy.IsValid(): - s.compareAny(vvx, vvy) - case vvx.IsValid() && !vvy.IsValid(): - s.report(false, vvx, nothing) - case !vvx.IsValid() && vvy.IsValid(): - s.report(false, nothing, vvy) - default: - // It is possible for both vvx and vvy to be invalid if the - // key contained a NaN value in it. There is no way in - // reflection to be able to retrieve these values. - // See https://golang.org/issue/11104 - panic(fmt.Sprintf("%#v has map key with NaNs", s.curPath)) + if !step.vx.IsValid() && !step.vy.IsValid() { + // It is possible for both vx and vy to be invalid if the + // key contained a NaN value in it. + // + // Even with the ability to retrieve NaN keys in Go 1.12, + // there still isn't a sensible way to compare the values since + // a NaN key may map to multiple unordered values. + // The most reasonable way to compare NaNs would be to compare the + // set of values. However, this is impossible to do efficiently + // since set equality is provably an O(n^2) operation given only + // an Equal function. If we had a Less function or Hash function, + // this could be done in O(n*log(n)) or O(n), respectively. + // + // Rather than adding complex logic to deal with NaNs, make it + // the user's responsibility to compare such obscure maps. + const help = "consider providing a Comparer to compare the map" + panic(fmt.Sprintf("%#v has map key with NaNs\n%s", s.curPath, help)) } + s.compareAny(step) } } -func (s *state) compareStruct(vx, vy reflect.Value, t reflect.Type) { - var vax, vay reflect.Value // Addressable versions of vx and vy +func (s *state) comparePtr(t reflect.Type, vx, vy reflect.Value) { + if vx.IsNil() || vy.IsNil() { + s.report(vx.IsNil() && vy.IsNil(), 0) + return + } - step := &structField{} - s.curPath.push(step) - defer s.curPath.pop() - for i := 0; i < t.NumField(); i++ { - vvx := vx.Field(i) - vvy := vy.Field(i) - step.typ = t.Field(i).Type - step.name = t.Field(i).Name - step.idx = i - step.unexported = !isExported(step.name) - if step.unexported { - // Defer checking of unexported fields until later to give an - // Ignore a chance to ignore the field. - if !vax.IsValid() || !vay.IsValid() { - // For unsafeRetrieveField to work, the parent struct must - // be addressable. Create a new copy of the values if - // necessary to make them addressable. - vax = makeAddressable(vx) - vay = makeAddressable(vy) - } - step.force = s.exporters[t] - step.pvx = vax - step.pvy = vay - step.field = t.Field(i) + // Cycle-detection for pointers. + if eq, visited := s.curPtrs.Push(vx, vy); visited { + s.report(eq, reportByCycle) + return + } + defer s.curPtrs.Pop(vx, vy) + + vx, vy = vx.Elem(), vy.Elem() + s.compareAny(Indirect{&indirect{pathStep{t.Elem(), vx, vy}}}) +} + +func (s *state) compareInterface(t reflect.Type, vx, vy reflect.Value) { + if vx.IsNil() || vy.IsNil() { + s.report(vx.IsNil() && vy.IsNil(), 0) + return + } + vx, vy = vx.Elem(), vy.Elem() + if vx.Type() != vy.Type() { + s.report(false, 0) + return + } + s.compareAny(TypeAssertion{&typeAssertion{pathStep{vx.Type(), vx, vy}}}) +} + +func (s *state) report(eq bool, rf resultFlags) { + if rf&reportByIgnore == 0 { + if eq { + s.result.NumSame++ + rf |= reportEqual + } else { + s.result.NumDiff++ + rf |= reportUnequal } - s.compareAny(vvx, vvy) + } + for _, r := range s.reporters { + r.Report(Result{flags: rf}) } } -// report records the result of a single comparison. -// It also calls Report if any reporter is registered. -func (s *state) report(eq bool, vx, vy reflect.Value) { - if eq { - s.result.NSame++ - } else { - s.result.NDiff++ +// recChecker tracks the state needed to periodically perform checks that +// user provided transformers are not stuck in an infinitely recursive cycle. +type recChecker struct{ next int } + +// Check scans the Path for any recursive transformers and panics when any +// recursive transformers are detected. Note that the presence of a +// recursive Transformer does not necessarily imply an infinite cycle. +// As such, this check only activates after some minimal number of path steps. +func (rc *recChecker) Check(p Path) { + const minLen = 1 << 16 + if rc.next == 0 { + rc.next = minLen + } + if len(p) < rc.next { + return + } + rc.next <<= 1 + + // Check whether the same transformer has appeared at least twice. + var ss []string + m := map[Option]int{} + for _, ps := range p { + if t, ok := ps.(Transform); ok { + t := t.Option() + if m[t] == 1 { // Transformer was used exactly once before + tf := t.(*transformer).fnc.Type() + ss = append(ss, fmt.Sprintf("%v: %v => %v", t, tf.In(0), tf.Out(0))) + } + m[t]++ + } } - if s.reporter != nil { - s.reporter.Report(vx, vy, eq, s.curPath) + if len(ss) > 0 { + const warning = "recursive set of Transformers detected" + const help = "consider using cmpopts.AcyclicTransformer" + set := strings.Join(ss, "\n\t") + panic(fmt.Sprintf("%s:\n\t%s\n%s", warning, set, help)) } } diff --git a/vendor/github.com/google/go-cmp/cmp/export_panic.go b/vendor/github.com/google/go-cmp/cmp/export_panic.go new file mode 100644 index 000000000000..dd032354fef1 --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/export_panic.go @@ -0,0 +1,15 @@ +// 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.md file. + +// +build purego + +package cmp + +import "reflect" + +const supportExporters = false + +func retrieveUnexportedField(reflect.Value, reflect.StructField) reflect.Value { + panic("no support for forcibly accessing unexported fields") +} diff --git a/vendor/github.com/google/go-cmp/cmp/export_unsafe.go b/vendor/github.com/google/go-cmp/cmp/export_unsafe.go new file mode 100644 index 000000000000..57020e26ca76 --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/export_unsafe.go @@ -0,0 +1,25 @@ +// 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.md file. + +// +build !purego + +package cmp + +import ( + "reflect" + "unsafe" +) + +const supportExporters = true + +// retrieveUnexportedField uses unsafe to forcibly retrieve any field from +// a struct such that the value has read-write permissions. +// +// The parent struct, v, must be addressable, while f must be a StructField +// describing the field to retrieve. +func retrieveUnexportedField(v reflect.Value, f reflect.StructField) reflect.Value { + // See https://github.com/google/go-cmp/issues/167 for discussion of the + // following expression. + return reflect.NewAt(f.Type, unsafe.Pointer(uintptr(unsafe.Pointer(v.UnsafeAddr()))+f.Offset)).Elem() +} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go index 42afa4960efa..fe98dcc67746 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_disable.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE.md file. -// +build !debug +// +build !cmp_debug package diff diff --git a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go index ba46c62e1c14..597b6ae56b1b 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/diff/debug_enable.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE.md file. -// +build debug +// +build cmp_debug package diff @@ -14,7 +14,7 @@ import ( ) // The algorithm can be seen running in real-time by enabling debugging: -// go test -tags=debug -v +// go test -tags=cmp_debug -v // // Example output: // === RUN TestDifference/#34 @@ -50,7 +50,7 @@ import ( // // The series of '.', 'X', 'Y', and 'M' characters at the bottom represents // the currently established path from the forward and reverse searches, -// seperated by a '|' character. +// separated by a '|' character. const ( updateDelay = 100 * time.Millisecond diff --git a/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go b/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go index baa41fd23cae..3d2e42662ca3 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/diff/diff.go @@ -85,30 +85,39 @@ func (es EditScript) LenY() int { return len(es) - es.stats().NX } type EqualFunc func(ix int, iy int) Result // Result is the result of comparison. -// NSame is the number of sub-elements that are equal. -// NDiff is the number of sub-elements that are not equal. -type Result struct{ NSame, NDiff int } +// NumSame is the number of sub-elements that are equal. +// NumDiff is the number of sub-elements that are not equal. +type Result struct{ NumSame, NumDiff int } + +// BoolResult returns a Result that is either Equal or not Equal. +func BoolResult(b bool) Result { + if b { + return Result{NumSame: 1} // Equal, Similar + } else { + return Result{NumDiff: 2} // Not Equal, not Similar + } +} // Equal indicates whether the symbols are equal. Two symbols are equal -// if and only if NDiff == 0. If Equal, then they are also Similar. -func (r Result) Equal() bool { return r.NDiff == 0 } +// if and only if NumDiff == 0. If Equal, then they are also Similar. +func (r Result) Equal() bool { return r.NumDiff == 0 } // Similar indicates whether two symbols are similar and may be represented // by using the Modified type. As a special case, we consider binary comparisons // (i.e., those that return Result{1, 0} or Result{0, 1}) to be similar. // -// The exact ratio of NSame to NDiff to determine similarity may change. +// The exact ratio of NumSame to NumDiff to determine similarity may change. func (r Result) Similar() bool { - // Use NSame+1 to offset NSame so that binary comparisons are similar. - return r.NSame+1 >= r.NDiff + // Use NumSame+1 to offset NumSame so that binary comparisons are similar. + return r.NumSame+1 >= r.NumDiff } // Difference reports whether two lists of lengths nx and ny are equal // given the definition of equality provided as f. // -// This function may return a edit-script, which is a sequence of operations -// needed to convert one list into the other. If non-nil, the following -// invariants for the edit-script are maintained: +// This function returns an edit-script, which is a sequence of operations +// needed to convert one list into the other. The following invariants for +// the edit-script are maintained: // • eq == (es.Dist()==0) // • nx == es.LenX() // • ny == es.LenY() @@ -117,17 +126,7 @@ func (r Result) Similar() bool { // produces an edit-script with a minimal Levenshtein distance). This algorithm // favors performance over optimality. The exact output is not guaranteed to // be stable and may change over time. -func Difference(nx, ny int, f EqualFunc) (eq bool, es EditScript) { - es = searchGraph(nx, ny, f) - st := es.stats() - eq = len(es) == st.NI - if !eq && st.NI < (nx+ny)/4 { - return eq, nil // Edit-script more distracting than helpful - } - return eq, es -} - -func searchGraph(nx, ny int, f EqualFunc) EditScript { +func Difference(nx, ny int, f EqualFunc) (es EditScript) { // This algorithm is based on traversing what is known as an "edit-graph". // See Figure 1 from "An O(ND) Difference Algorithm and Its Variations" // by Eugene W. Myers. Since D can be as large as N itself, this is @@ -201,9 +200,9 @@ func searchGraph(nx, ny int, f EqualFunc) EditScript { // that two lists commonly differ because elements were added to the front // or end of the other list. // - // Running the tests with the "debug" build tag prints a visualization of - // the algorithm running in real-time. This is educational for understanding - // how the algorithm works. See debug_enable.go. + // Running the tests with the "cmp_debug" build tag prints a visualization + // of the algorithm running in real-time. This is educational for + // understanding how the algorithm works. See debug_enable.go. f = debug.Begin(nx, ny, f, &fwdPath.es, &revPath.es) for { // Forward search from the beginning. diff --git a/vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go b/vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go new file mode 100644 index 000000000000..a9e7fc0b5b39 --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/internal/flags/flags.go @@ -0,0 +1,9 @@ +// Copyright 2019, 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.md file. + +package flags + +// Deterministic controls whether the output of Diff should be deterministic. +// This is only used for testing. +var Deterministic bool diff --git a/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go b/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go new file mode 100644 index 000000000000..01aed0a1532b --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_legacy.go @@ -0,0 +1,10 @@ +// Copyright 2019, 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.md file. + +// +build !go1.10 + +package flags + +// AtLeastGo110 reports whether the Go toolchain is at least Go 1.10. +const AtLeastGo110 = false diff --git a/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go b/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go new file mode 100644 index 000000000000..c0b667f58b05 --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/internal/flags/toolchain_recent.go @@ -0,0 +1,10 @@ +// Copyright 2019, 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.md file. + +// +build go1.10 + +package flags + +// AtLeastGo110 reports whether the Go toolchain is at least Go 1.10. +const AtLeastGo110 = true diff --git a/vendor/github.com/google/go-cmp/cmp/internal/function/func.go b/vendor/github.com/google/go-cmp/cmp/internal/function/func.go index 4c35ff11ee13..ace1dbe86e57 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/function/func.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/function/func.go @@ -2,25 +2,34 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE.md file. -// Package function identifies function types. +// Package function provides functionality for identifying function types. package function -import "reflect" +import ( + "reflect" + "regexp" + "runtime" + "strings" +) type funcType int const ( _ funcType = iota + tbFunc // func(T) bool ttbFunc // func(T, T) bool + trbFunc // func(T, R) bool tibFunc // func(T, I) bool trFunc // func(T) R - Equal = ttbFunc // func(T, T) bool - EqualAssignable = tibFunc // func(T, I) bool; encapsulates func(T, T) bool - Transformer = trFunc // func(T) R - ValueFilter = ttbFunc // func(T, T) bool - Less = ttbFunc // func(T, T) bool + Equal = ttbFunc // func(T, T) bool + EqualAssignable = tibFunc // func(T, I) bool; encapsulates func(T, T) bool + Transformer = trFunc // func(T) R + ValueFilter = ttbFunc // func(T, T) bool + Less = ttbFunc // func(T, T) bool + ValuePredicate = tbFunc // func(T) bool + KeyValuePredicate = trbFunc // func(T, R) bool ) var boolType = reflect.TypeOf(true) @@ -32,10 +41,18 @@ func IsType(t reflect.Type, ft funcType) bool { } ni, no := t.NumIn(), t.NumOut() switch ft { + case tbFunc: // func(T) bool + if ni == 1 && no == 1 && t.Out(0) == boolType { + return true + } case ttbFunc: // func(T, T) bool if ni == 2 && no == 1 && t.In(0) == t.In(1) && t.Out(0) == boolType { return true } + case trbFunc: // func(T, R) bool + if ni == 2 && no == 1 && t.Out(0) == boolType { + return true + } case tibFunc: // func(T, I) bool if ni == 2 && no == 1 && t.In(0).AssignableTo(t.In(1)) && t.Out(0) == boolType { return true @@ -47,3 +64,36 @@ func IsType(t reflect.Type, ft funcType) bool { } return false } + +var lastIdentRx = regexp.MustCompile(`[_\p{L}][_\p{L}\p{N}]*$`) + +// NameOf returns the name of the function value. +func NameOf(v reflect.Value) string { + fnc := runtime.FuncForPC(v.Pointer()) + if fnc == nil { + return "" + } + fullName := fnc.Name() // e.g., "long/path/name/mypkg.(*MyType).(long/path/name/mypkg.myMethod)-fm" + + // Method closures have a "-fm" suffix. + fullName = strings.TrimSuffix(fullName, "-fm") + + var name string + for len(fullName) > 0 { + inParen := strings.HasSuffix(fullName, ")") + fullName = strings.TrimSuffix(fullName, ")") + + s := lastIdentRx.FindString(fullName) + if s == "" { + break + } + name = s + "." + name + fullName = strings.TrimSuffix(fullName, s) + + if i := strings.LastIndexByte(fullName, '('); inParen && i >= 0 { + fullName = fullName[:i] + } + fullName = strings.TrimSuffix(fullName, ".") + } + return strings.TrimSuffix(name, ".") +} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/format.go b/vendor/github.com/google/go-cmp/cmp/internal/value/format.go deleted file mode 100644 index abaeca89e795..000000000000 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/format.go +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE.md file. - -// Package value provides functionality for reflect.Value types. -package value - -import ( - "fmt" - "reflect" - "strings" - "unicode" - "unicode/utf8" -) - -// formatFakePointers controls whether to substitute pointer addresses with nil. -// This is used for deterministic testing. -var formatFakePointers = false - -var stringerIface = reflect.TypeOf((*fmt.Stringer)(nil)).Elem() - -// Format formats the value v as a string. -// -// This is similar to fmt.Sprintf("%+v", v) except this: -// * Prints the type unless it can be elided -// * Avoids printing struct fields that are zero -// * Prints a nil-slice as being nil, not empty -// * Prints map entries in deterministic order -func Format(v reflect.Value, useStringer bool) string { - return formatAny(v, formatConfig{useStringer, true, true, !formatFakePointers}, nil) -} - -type formatConfig struct { - useStringer bool // Should the String method be used if available? - printType bool // Should we print the type before the value? - followPointers bool // Should we recursively follow pointers? - realPointers bool // Should we print the real address of pointers? -} - -func formatAny(v reflect.Value, conf formatConfig, visited map[uintptr]bool) string { - // TODO: Should this be a multi-line printout in certain situations? - - if !v.IsValid() { - return "" - } - if conf.useStringer && v.Type().Implements(stringerIface) && v.CanInterface() { - if (v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface) && v.IsNil() { - return "" - } - return fmt.Sprintf("%q", v.Interface().(fmt.Stringer).String()) - } - - switch v.Kind() { - case reflect.Bool: - return formatPrimitive(v.Type(), v.Bool(), conf) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return formatPrimitive(v.Type(), v.Int(), conf) - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - if v.Type().PkgPath() == "" || v.Kind() == reflect.Uintptr { - // Unnamed uints are usually bytes or words, so use hexadecimal. - return formatPrimitive(v.Type(), formatHex(v.Uint()), conf) - } - return formatPrimitive(v.Type(), v.Uint(), conf) - case reflect.Float32, reflect.Float64: - return formatPrimitive(v.Type(), v.Float(), conf) - case reflect.Complex64, reflect.Complex128: - return formatPrimitive(v.Type(), v.Complex(), conf) - case reflect.String: - return formatPrimitive(v.Type(), fmt.Sprintf("%q", v), conf) - case reflect.UnsafePointer, reflect.Chan, reflect.Func: - return formatPointer(v, conf) - case reflect.Ptr: - if v.IsNil() { - if conf.printType { - return fmt.Sprintf("(%v)(nil)", v.Type()) - } - return "" - } - if visited[v.Pointer()] || !conf.followPointers { - return formatPointer(v, conf) - } - visited = insertPointer(visited, v.Pointer()) - return "&" + formatAny(v.Elem(), conf, visited) - case reflect.Interface: - if v.IsNil() { - if conf.printType { - return fmt.Sprintf("%v(nil)", v.Type()) - } - return "" - } - return formatAny(v.Elem(), conf, visited) - case reflect.Slice: - if v.IsNil() { - if conf.printType { - return fmt.Sprintf("%v(nil)", v.Type()) - } - return "" - } - if visited[v.Pointer()] { - return formatPointer(v, conf) - } - visited = insertPointer(visited, v.Pointer()) - fallthrough - case reflect.Array: - var ss []string - subConf := conf - subConf.printType = v.Type().Elem().Kind() == reflect.Interface - for i := 0; i < v.Len(); i++ { - s := formatAny(v.Index(i), subConf, visited) - ss = append(ss, s) - } - s := fmt.Sprintf("{%s}", strings.Join(ss, ", ")) - if conf.printType { - return v.Type().String() + s - } - return s - case reflect.Map: - if v.IsNil() { - if conf.printType { - return fmt.Sprintf("%v(nil)", v.Type()) - } - return "" - } - if visited[v.Pointer()] { - return formatPointer(v, conf) - } - visited = insertPointer(visited, v.Pointer()) - - var ss []string - subConf := conf - subConf.printType = v.Type().Elem().Kind() == reflect.Interface - for _, k := range SortKeys(v.MapKeys()) { - sk := formatAny(k, formatConfig{realPointers: conf.realPointers}, visited) - sv := formatAny(v.MapIndex(k), subConf, visited) - ss = append(ss, fmt.Sprintf("%s: %s", sk, sv)) - } - s := fmt.Sprintf("{%s}", strings.Join(ss, ", ")) - if conf.printType { - return v.Type().String() + s - } - return s - case reflect.Struct: - var ss []string - subConf := conf - subConf.printType = true - for i := 0; i < v.NumField(); i++ { - vv := v.Field(i) - if isZero(vv) { - continue // Elide zero value fields - } - name := v.Type().Field(i).Name - subConf.useStringer = conf.useStringer && isExported(name) - s := formatAny(vv, subConf, visited) - ss = append(ss, fmt.Sprintf("%s: %s", name, s)) - } - s := fmt.Sprintf("{%s}", strings.Join(ss, ", ")) - if conf.printType { - return v.Type().String() + s - } - return s - default: - panic(fmt.Sprintf("%v kind not handled", v.Kind())) - } -} - -func formatPrimitive(t reflect.Type, v interface{}, conf formatConfig) string { - if conf.printType && t.PkgPath() != "" { - return fmt.Sprintf("%v(%v)", t, v) - } - return fmt.Sprintf("%v", v) -} - -func formatPointer(v reflect.Value, conf formatConfig) string { - p := v.Pointer() - if !conf.realPointers { - p = 0 // For deterministic printing purposes - } - s := formatHex(uint64(p)) - if conf.printType { - return fmt.Sprintf("(%v)(%s)", v.Type(), s) - } - return s -} - -func formatHex(u uint64) string { - var f string - switch { - case u <= 0xff: - f = "0x%02x" - case u <= 0xffff: - f = "0x%04x" - case u <= 0xffffff: - f = "0x%06x" - case u <= 0xffffffff: - f = "0x%08x" - case u <= 0xffffffffff: - f = "0x%010x" - case u <= 0xffffffffffff: - f = "0x%012x" - case u <= 0xffffffffffffff: - f = "0x%014x" - case u <= 0xffffffffffffffff: - f = "0x%016x" - } - return fmt.Sprintf(f, u) -} - -// insertPointer insert p into m, allocating m if necessary. -func insertPointer(m map[uintptr]bool, p uintptr) map[uintptr]bool { - if m == nil { - m = make(map[uintptr]bool) - } - m[p] = true - return m -} - -// isZero reports whether v is the zero value. -// This does not rely on Interface and so can be used on unexported fields. -func isZero(v reflect.Value) bool { - switch v.Kind() { - case reflect.Bool: - return v.Bool() == false - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Complex64, reflect.Complex128: - return v.Complex() == 0 - case reflect.String: - return v.String() == "" - case reflect.UnsafePointer: - return v.Pointer() == 0 - case reflect.Chan, reflect.Func, reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: - return v.IsNil() - case reflect.Array: - for i := 0; i < v.Len(); i++ { - if !isZero(v.Index(i)) { - return false - } - } - return true - case reflect.Struct: - for i := 0; i < v.NumField(); i++ { - if !isZero(v.Field(i)) { - return false - } - } - return true - } - return false -} - -// isExported reports whether the identifier is exported. -func isExported(id string) bool { - r, _ := utf8.DecodeRuneInString(id) - return unicode.IsUpper(r) -} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go new file mode 100644 index 000000000000..0a01c4796f14 --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_purego.go @@ -0,0 +1,23 @@ +// Copyright 2018, 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.md file. + +// +build purego + +package value + +import "reflect" + +// Pointer is an opaque typed pointer and is guaranteed to be comparable. +type Pointer struct { + p uintptr + t reflect.Type +} + +// PointerOf returns a Pointer from v, which must be a +// reflect.Ptr, reflect.Slice, or reflect.Map. +func PointerOf(v reflect.Value) Pointer { + // NOTE: Storing a pointer as an uintptr is technically incorrect as it + // assumes that the GC implementation does not use a moving collector. + return Pointer{v.Pointer(), v.Type()} +} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go new file mode 100644 index 000000000000..da134ae2a80f --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/internal/value/pointer_unsafe.go @@ -0,0 +1,26 @@ +// Copyright 2018, 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.md file. + +// +build !purego + +package value + +import ( + "reflect" + "unsafe" +) + +// Pointer is an opaque typed pointer and is guaranteed to be comparable. +type Pointer struct { + p unsafe.Pointer + t reflect.Type +} + +// PointerOf returns a Pointer from v, which must be a +// reflect.Ptr, reflect.Slice, or reflect.Map. +func PointerOf(v reflect.Value) Pointer { + // The proper representation of a pointer is unsafe.Pointer, + // which is necessary if the GC ever uses a moving collector. + return Pointer{unsafe.Pointer(v.Pointer()), v.Type()} +} diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go b/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go index fe8aa27a077b..24fbae6e3c57 100644 --- a/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go +++ b/vendor/github.com/google/go-cmp/cmp/internal/value/sort.go @@ -19,7 +19,7 @@ func SortKeys(vs []reflect.Value) []reflect.Value { } // Sort the map keys. - sort.Sort(valueSorter(vs)) + sort.SliceStable(vs, func(i, j int) bool { return isLess(vs[i], vs[j]) }) // Deduplicate keys (fails for NaNs). vs2 := vs[:1] @@ -31,13 +31,6 @@ func SortKeys(vs []reflect.Value) []reflect.Value { return vs2 } -// TODO: Use sort.Slice once Google AppEngine is on Go1.8 or above. -type valueSorter []reflect.Value - -func (vs valueSorter) Len() int { return len(vs) } -func (vs valueSorter) Less(i, j int) bool { return isLess(vs[i], vs[j]) } -func (vs valueSorter) Swap(i, j int) { vs[i], vs[j] = vs[j], vs[i] } - // isLess is a generic function for sorting arbitrary map keys. // The inputs must be of the same type and must be comparable. func isLess(x, y reflect.Value) bool { @@ -49,6 +42,8 @@ func isLess(x, y reflect.Value) bool { case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: return x.Uint() < y.Uint() case reflect.Float32, reflect.Float64: + // NOTE: This does not sort -0 as less than +0 + // since Go maps treat -0 and +0 as equal keys. fx, fy := x.Float(), y.Float() return fx < fy || math.IsNaN(fx) && !math.IsNaN(fy) case reflect.Complex64, reflect.Complex128: diff --git a/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go b/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go new file mode 100644 index 000000000000..06a8ffd036d5 --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/internal/value/zero.go @@ -0,0 +1,48 @@ +// 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.md file. + +package value + +import ( + "math" + "reflect" +) + +// IsZero reports whether v is the zero value. +// This does not rely on Interface and so can be used on unexported fields. +func IsZero(v reflect.Value) bool { + switch v.Kind() { + case reflect.Bool: + return v.Bool() == false + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return math.Float64bits(v.Float()) == 0 + case reflect.Complex64, reflect.Complex128: + return math.Float64bits(real(v.Complex())) == 0 && math.Float64bits(imag(v.Complex())) == 0 + case reflect.String: + return v.String() == "" + case reflect.UnsafePointer: + return v.Pointer() == 0 + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: + return v.IsNil() + case reflect.Array: + for i := 0; i < v.Len(); i++ { + if !IsZero(v.Index(i)) { + return false + } + } + return true + case reflect.Struct: + for i := 0; i < v.NumField(); i++ { + if !IsZero(v.Field(i)) { + return false + } + } + return true + } + return false +} diff --git a/vendor/github.com/google/go-cmp/cmp/options.go b/vendor/github.com/google/go-cmp/cmp/options.go index a4e159ac483c..abbd2a63b69a 100644 --- a/vendor/github.com/google/go-cmp/cmp/options.go +++ b/vendor/github.com/google/go-cmp/cmp/options.go @@ -7,7 +7,7 @@ package cmp import ( "fmt" "reflect" - "runtime" + "regexp" "strings" "github.com/google/go-cmp/cmp/internal/function" @@ -29,22 +29,21 @@ type Option interface { // An Options is returned only if multiple comparers or transformers // can apply simultaneously and will only contain values of those types // or sub-Options containing values of those types. - filter(s *state, vx, vy reflect.Value, t reflect.Type) applicableOption + filter(s *state, t reflect.Type, vx, vy reflect.Value) applicableOption } // applicableOption represents the following types: -// Fundamental: ignore | invalid | *comparer | *transformer +// Fundamental: ignore | validator | *comparer | *transformer // Grouping: Options type applicableOption interface { Option - // apply executes the option and reports whether the option was applied. - // Each option may mutate s. - apply(s *state, vx, vy reflect.Value) bool + // apply executes the option, which may mutate s or panic. + apply(s *state, vx, vy reflect.Value) } // coreOption represents the following types: -// Fundamental: ignore | invalid | *comparer | *transformer +// Fundamental: ignore | validator | *comparer | *transformer // Filters: *pathFilter | *valuesFilter type coreOption interface { Option @@ -64,19 +63,19 @@ func (core) isCore() {} // on all individual options held within. type Options []Option -func (opts Options) filter(s *state, vx, vy reflect.Value, t reflect.Type) (out applicableOption) { +func (opts Options) filter(s *state, t reflect.Type, vx, vy reflect.Value) (out applicableOption) { for _, opt := range opts { - switch opt := opt.filter(s, vx, vy, t); opt.(type) { + switch opt := opt.filter(s, t, vx, vy); opt.(type) { case ignore: return ignore{} // Only ignore can short-circuit evaluation - case invalid: - out = invalid{} // Takes precedence over comparer or transformer + case validator: + out = validator{} // Takes precedence over comparer or transformer case *comparer, *transformer, Options: switch out.(type) { case nil: out = opt - case invalid: - // Keep invalid + case validator: + // Keep validator case *comparer, *transformer, Options: out = Options{out, opt} // Conflicting comparers or transformers } @@ -85,7 +84,7 @@ func (opts Options) filter(s *state, vx, vy reflect.Value, t reflect.Type) (out return out } -func (opts Options) apply(s *state, _, _ reflect.Value) bool { +func (opts Options) apply(s *state, _, _ reflect.Value) { const warning = "ambiguous set of applicable options" const help = "consider using filters to ensure at most one Comparer or Transformer may apply" var ss []string @@ -107,6 +106,11 @@ func (opts Options) String() string { // FilterPath returns a new Option where opt is only evaluated if filter f // returns true for the current Path in the value tree. // +// This filter is called even if a slice element or map entry is missing and +// provides an opportunity to ignore such cases. The filter function must be +// symmetric such that the filter result is identical regardless of whether the +// missing value is from x or y. +// // The option passed in may be an Ignore, Transformer, Comparer, Options, or // a previously filtered Option. func FilterPath(f func(Path) bool, opt Option) Option { @@ -125,22 +129,22 @@ type pathFilter struct { opt Option } -func (f pathFilter) filter(s *state, vx, vy reflect.Value, t reflect.Type) applicableOption { +func (f pathFilter) filter(s *state, t reflect.Type, vx, vy reflect.Value) applicableOption { if f.fnc(s.curPath) { - return f.opt.filter(s, vx, vy, t) + return f.opt.filter(s, t, vx, vy) } return nil } func (f pathFilter) String() string { - fn := getFuncName(reflect.ValueOf(f.fnc).Pointer()) - return fmt.Sprintf("FilterPath(%s, %v)", fn, f.opt) + return fmt.Sprintf("FilterPath(%s, %v)", function.NameOf(reflect.ValueOf(f.fnc)), f.opt) } // FilterValues returns a new Option where opt is only evaluated if filter f, // which is a function of the form "func(T, T) bool", returns true for the -// current pair of values being compared. If the type of the values is not -// assignable to T, then this filter implicitly returns false. +// current pair of values being compared. If either value is invalid or +// the type of the values is not assignable to T, then this filter implicitly +// returns false. // // The filter function must be // symmetric (i.e., agnostic to the order of the inputs) and @@ -172,19 +176,18 @@ type valuesFilter struct { opt Option } -func (f valuesFilter) filter(s *state, vx, vy reflect.Value, t reflect.Type) applicableOption { - if !vx.IsValid() || !vy.IsValid() { - return invalid{} +func (f valuesFilter) filter(s *state, t reflect.Type, vx, vy reflect.Value) applicableOption { + if !vx.IsValid() || !vx.CanInterface() || !vy.IsValid() || !vy.CanInterface() { + return nil } if (f.typ == nil || t.AssignableTo(f.typ)) && s.callTTBFunc(f.fnc, vx, vy) { - return f.opt.filter(s, vx, vy, t) + return f.opt.filter(s, t, vx, vy) } return nil } func (f valuesFilter) String() string { - fn := getFuncName(f.fnc.Pointer()) - return fmt.Sprintf("FilterValues(%s, %v)", fn, f.opt) + return fmt.Sprintf("FilterValues(%s, %v)", function.NameOf(f.fnc), f.opt) } // Ignore is an Option that causes all comparisons to be ignored. @@ -195,41 +198,88 @@ func Ignore() Option { return ignore{} } type ignore struct{ core } func (ignore) isFiltered() bool { return false } -func (ignore) filter(_ *state, _, _ reflect.Value, _ reflect.Type) applicableOption { return ignore{} } -func (ignore) apply(_ *state, _, _ reflect.Value) bool { return true } +func (ignore) filter(_ *state, _ reflect.Type, _, _ reflect.Value) applicableOption { return ignore{} } +func (ignore) apply(s *state, _, _ reflect.Value) { s.report(true, reportByIgnore) } func (ignore) String() string { return "Ignore()" } -// invalid is a sentinel Option type to indicate that some options could not -// be evaluated due to unexported fields. -type invalid struct{ core } +// validator is a sentinel Option type to indicate that some options could not +// be evaluated due to unexported fields, missing slice elements, or +// missing map entries. Both values are validator only for unexported fields. +type validator struct{ core } + +func (validator) filter(_ *state, _ reflect.Type, vx, vy reflect.Value) applicableOption { + if !vx.IsValid() || !vy.IsValid() { + return validator{} + } + if !vx.CanInterface() || !vy.CanInterface() { + return validator{} + } + return nil +} +func (validator) apply(s *state, vx, vy reflect.Value) { + // Implies missing slice element or map entry. + if !vx.IsValid() || !vy.IsValid() { + s.report(vx.IsValid() == vy.IsValid(), 0) + return + } + + // Unable to Interface implies unexported field without visibility access. + if !vx.CanInterface() || !vy.CanInterface() { + const help = "consider using a custom Comparer; if you control the implementation of type, you can also consider using an Exporter, AllowUnexported, or cmpopts.IgnoreUnexported" + var name string + if t := s.curPath.Index(-2).Type(); t.Name() != "" { + // Named type with unexported fields. + name = fmt.Sprintf("%q.%v", t.PkgPath(), t.Name()) // e.g., "path/to/package".MyType + } else { + // Unnamed type with unexported fields. Derive PkgPath from field. + var pkgPath string + for i := 0; i < t.NumField() && pkgPath == ""; i++ { + pkgPath = t.Field(i).PkgPath + } + name = fmt.Sprintf("%q.(%v)", pkgPath, t.String()) // e.g., "path/to/package".(struct { a int }) + } + panic(fmt.Sprintf("cannot handle unexported field at %#v:\n\t%v\n%s", s.curPath, name, help)) + } -func (invalid) filter(_ *state, _, _ reflect.Value, _ reflect.Type) applicableOption { return invalid{} } -func (invalid) apply(s *state, _, _ reflect.Value) bool { - const help = "consider using AllowUnexported or cmpopts.IgnoreUnexported" - panic(fmt.Sprintf("cannot handle unexported field: %#v\n%s", s.curPath, help)) + panic("not reachable") } +// identRx represents a valid identifier according to the Go specification. +const identRx = `[_\p{L}][_\p{L}\p{N}]*` + +var identsRx = regexp.MustCompile(`^` + identRx + `(\.` + identRx + `)*$`) + // Transformer returns an Option that applies a transformation function that // converts values of a certain type into that of another. // // The transformer f must be a function "func(T) R" that converts values of // type T to those of type R and is implicitly filtered to input values // assignable to T. The transformer must not mutate T in any way. -// If T and R are the same type, an additional filter must be applied to -// act as the base case to prevent an infinite recursion applying the same -// transform to itself (see the SortedSlice example). +// +// To help prevent some cases of infinite recursive cycles applying the +// same transform to the output of itself (e.g., in the case where the +// input and output types are the same), an implicit filter is added such that +// a transformer is applicable only if that exact transformer is not already +// in the tail of the Path since the last non-Transform step. +// For situations where the implicit filter is still insufficient, +// consider using cmpopts.AcyclicTransformer, which adds a filter +// to prevent the transformer from being recursively applied upon itself. // // The name is a user provided label that is used as the Transform.Name in the -// transformation PathStep. If empty, an arbitrary name is used. +// transformation PathStep (and eventually shown in the Diff output). +// The name must be a valid identifier or qualified identifier in Go syntax. +// If empty, an arbitrary name is used. func Transformer(name string, f interface{}) Option { v := reflect.ValueOf(f) if !function.IsType(v.Type(), function.Transformer) || v.IsNil() { panic(fmt.Sprintf("invalid transformer function: %T", f)) } if name == "" { - name = "λ" // Lambda-symbol as place-holder for anonymous transformer - } - if !isValid(name) { + name = function.NameOf(v) + if !identsRx.MatchString(name) { + name = "λ" // Lambda-symbol as placeholder name + } + } else if !identsRx.MatchString(name) { panic(fmt.Sprintf("invalid name: %q", name)) } tr := &transformer{name: name, fnc: reflect.ValueOf(f)} @@ -248,27 +298,30 @@ type transformer struct { func (tr *transformer) isFiltered() bool { return tr.typ != nil } -func (tr *transformer) filter(_ *state, _, _ reflect.Value, t reflect.Type) applicableOption { +func (tr *transformer) filter(s *state, t reflect.Type, _, _ reflect.Value) applicableOption { + for i := len(s.curPath) - 1; i >= 0; i-- { + if t, ok := s.curPath[i].(Transform); !ok { + break // Hit most recent non-Transform step + } else if tr == t.trans { + return nil // Cannot directly use same Transform + } + } if tr.typ == nil || t.AssignableTo(tr.typ) { return tr } return nil } -func (tr *transformer) apply(s *state, vx, vy reflect.Value) bool { - // Update path before calling the Transformer so that dynamic checks - // will use the updated path. - s.curPath.push(&transform{pathStep{tr.fnc.Type().Out(0)}, tr}) - defer s.curPath.pop() - - vx = s.callTRFunc(tr.fnc, vx) - vy = s.callTRFunc(tr.fnc, vy) - s.compareAny(vx, vy) - return true +func (tr *transformer) apply(s *state, vx, vy reflect.Value) { + step := Transform{&transform{pathStep{typ: tr.fnc.Type().Out(0)}, tr}} + vvx := s.callTRFunc(tr.fnc, vx, step) + vvy := s.callTRFunc(tr.fnc, vy, step) + step.vx, step.vy = vvx, vvy + s.compareAny(step) } func (tr transformer) String() string { - return fmt.Sprintf("Transformer(%s, %s)", tr.name, getFuncName(tr.fnc.Pointer())) + return fmt.Sprintf("Transformer(%s, %s)", tr.name, function.NameOf(tr.fnc)) } // Comparer returns an Option that determines whether two values are equal @@ -303,26 +356,24 @@ type comparer struct { func (cm *comparer) isFiltered() bool { return cm.typ != nil } -func (cm *comparer) filter(_ *state, _, _ reflect.Value, t reflect.Type) applicableOption { +func (cm *comparer) filter(_ *state, t reflect.Type, _, _ reflect.Value) applicableOption { if cm.typ == nil || t.AssignableTo(cm.typ) { return cm } return nil } -func (cm *comparer) apply(s *state, vx, vy reflect.Value) bool { +func (cm *comparer) apply(s *state, vx, vy reflect.Value) { eq := s.callTTBFunc(cm.fnc, vx, vy) - s.report(eq, vx, vy) - return true + s.report(eq, reportByFunc) } func (cm comparer) String() string { - return fmt.Sprintf("Comparer(%s)", getFuncName(cm.fnc.Pointer())) + return fmt.Sprintf("Comparer(%s)", function.NameOf(cm.fnc)) } -// AllowUnexported returns an Option that forcibly allows operations on -// unexported fields in certain structs, which are specified by passing in a -// value of each struct type. +// Exporter returns an Option that specifies whether Equal is allowed to +// introspect into the unexported fields of certain struct types. // // Users of this option must understand that comparing on unexported fields // from external packages is not safe since changes in the internal @@ -331,7 +382,7 @@ func (cm comparer) String() string { // defined in an internal package where the semantic meaning of an unexported // field is in the control of the user. // -// For some cases, a custom Comparer should be used instead that defines +// In many cases, a custom Comparer should be used instead that defines // equality as a function of the public API of a type rather than the underlying // unexported implementation. // @@ -346,10 +397,24 @@ func (cm comparer) String() string { // // In other cases, the cmpopts.IgnoreUnexported option can be used to ignore // all unexported fields on specified struct types. -func AllowUnexported(types ...interface{}) Option { - if !supportAllowUnexported { - panic("AllowUnexported is not supported on App Engine Classic or GopherJS") +func Exporter(f func(reflect.Type) bool) Option { + if !supportExporters { + panic("Exporter is not supported on purego builds") } + return exporter(f) +} + +type exporter func(reflect.Type) bool + +func (exporter) filter(_ *state, _ reflect.Type, _, _ reflect.Value) applicableOption { + panic("not implemented") +} + +// AllowUnexported returns an Options that allows Equal to forcibly introspect +// unexported fields of the specified struct types. +// +// See Exporter for the proper use of this option. +func AllowUnexported(types ...interface{}) Option { m := make(map[reflect.Type]bool) for _, typ := range types { t := reflect.TypeOf(typ) @@ -358,32 +423,97 @@ func AllowUnexported(types ...interface{}) Option { } m[t] = true } - return visibleStructs(m) + return exporter(func(t reflect.Type) bool { return m[t] }) +} + +// Result represents the comparison result for a single node and +// is provided by cmp when calling Result (see Reporter). +type Result struct { + _ [0]func() // Make Result incomparable + flags resultFlags } -type visibleStructs map[reflect.Type]bool +// Equal reports whether the node was determined to be equal or not. +// As a special case, ignored nodes are considered equal. +func (r Result) Equal() bool { + return r.flags&(reportEqual|reportByIgnore) != 0 +} -func (visibleStructs) filter(_ *state, _, _ reflect.Value, _ reflect.Type) applicableOption { - panic("not implemented") +// ByIgnore reports whether the node is equal because it was ignored. +// This never reports true if Equal reports false. +func (r Result) ByIgnore() bool { + return r.flags&reportByIgnore != 0 } -// reporter is an Option that configures how differences are reported. -type reporter interface { - // TODO: Not exported yet. +// ByMethod reports whether the Equal method determined equality. +func (r Result) ByMethod() bool { + return r.flags&reportByMethod != 0 +} + +// ByFunc reports whether a Comparer function determined equality. +func (r Result) ByFunc() bool { + return r.flags&reportByFunc != 0 +} + +// ByCycle reports whether a reference cycle was detected. +func (r Result) ByCycle() bool { + return r.flags&reportByCycle != 0 +} + +type resultFlags uint + +const ( + _ resultFlags = (1 << iota) / 2 + + reportEqual + reportUnequal + reportByIgnore + reportByMethod + reportByFunc + reportByCycle +) + +// Reporter is an Option that can be passed to Equal. When Equal traverses +// the value trees, it calls PushStep as it descends into each node in the +// tree and PopStep as it ascend out of the node. The leaves of the tree are +// either compared (determined to be equal or not equal) or ignored and reported +// as such by calling the Report method. +func Reporter(r interface { + // PushStep is called when a tree-traversal operation is performed. + // The PathStep itself is only valid until the step is popped. + // The PathStep.Values are valid for the duration of the entire traversal + // and must not be mutated. // - // Perhaps add PushStep and PopStep and change Report to only accept - // a PathStep instead of the full-path? Adding a PushStep and PopStep makes - // it clear that we are traversing the value tree in a depth-first-search - // manner, which has an effect on how values are printed. + // Equal always calls PushStep at the start to provide an operation-less + // PathStep used to report the root values. + // + // Within a slice, the exact set of inserted, removed, or modified elements + // is unspecified and may change in future implementations. + // The entries of a map are iterated through in an unspecified order. + PushStep(PathStep) + + // Report is called exactly once on leaf nodes to report whether the + // comparison identified the node as equal, unequal, or ignored. + // A leaf node is one that is immediately preceded by and followed by + // a pair of PushStep and PopStep calls. + Report(Result) + + // PopStep ascends back up the value tree. + // There is always a matching pop call for every push call. + PopStep() +}) Option { + return reporter{r} +} - Option +type reporter struct{ reporterIface } +type reporterIface interface { + PushStep(PathStep) + Report(Result) + PopStep() +} - // Report is called for every comparison made and will be provided with - // the two values being compared, the equality result, and the - // current path in the value tree. It is possible for x or y to be an - // invalid reflect.Value if one of the values is non-existent; - // which is possible with maps and slices. - Report(x, y reflect.Value, eq bool, p Path) +func (reporter) filter(_ *state, _ reflect.Type, _, _ reflect.Value) applicableOption { + panic("not implemented") } // normalizeOption normalizes the input options such that all Options groups @@ -417,30 +547,3 @@ func flattenOptions(dst, src Options) Options { } return dst } - -// getFuncName returns a short function name from the pointer. -// The string parsing logic works up until Go1.9. -func getFuncName(p uintptr) string { - fnc := runtime.FuncForPC(p) - if fnc == nil { - return "" - } - name := fnc.Name() // E.g., "long/path/name/mypkg.(mytype).(long/path/name/mypkg.myfunc)-fm" - if strings.HasSuffix(name, ")-fm") || strings.HasSuffix(name, ")·fm") { - // Strip the package name from method name. - name = strings.TrimSuffix(name, ")-fm") - name = strings.TrimSuffix(name, ")·fm") - if i := strings.LastIndexByte(name, '('); i >= 0 { - methodName := name[i+1:] // E.g., "long/path/name/mypkg.myfunc" - if j := strings.LastIndexByte(methodName, '.'); j >= 0 { - methodName = methodName[j+1:] // E.g., "myfunc" - } - name = name[:i] + methodName // E.g., "long/path/name/mypkg.(mytype)." + "myfunc" - } - } - if i := strings.LastIndexByte(name, '/'); i >= 0 { - // Strip the package name. - name = name[i+1:] // E.g., "mypkg.(mytype).myfunc" - } - return name -} diff --git a/vendor/github.com/google/go-cmp/cmp/path.go b/vendor/github.com/google/go-cmp/cmp/path.go index 0c2eb333ff6a..509d6b8527db 100644 --- a/vendor/github.com/google/go-cmp/cmp/path.go +++ b/vendor/github.com/google/go-cmp/cmp/path.go @@ -10,77 +10,56 @@ import ( "strings" "unicode" "unicode/utf8" + + "github.com/google/go-cmp/cmp/internal/value" ) -type ( - // Path is a list of PathSteps describing the sequence of operations to get - // from some root type to the current position in the value tree. - // The first Path element is always an operation-less PathStep that exists - // simply to identify the initial type. +// Path is a list of PathSteps describing the sequence of operations to get +// from some root type to the current position in the value tree. +// The first Path element is always an operation-less PathStep that exists +// simply to identify the initial type. +// +// When traversing structs with embedded structs, the embedded struct will +// always be accessed as a field before traversing the fields of the +// embedded struct themselves. That is, an exported field from the +// embedded struct will never be accessed directly from the parent struct. +type Path []PathStep + +// PathStep is a union-type for specific operations to traverse +// a value's tree structure. Users of this package never need to implement +// these types as values of this type will be returned by this package. +// +// Implementations of this interface are +// StructField, SliceIndex, MapIndex, Indirect, TypeAssertion, and Transform. +type PathStep interface { + String() string + + // Type is the resulting type after performing the path step. + Type() reflect.Type + + // Values is the resulting values after performing the path step. + // The type of each valid value is guaranteed to be identical to Type. // - // When traversing structs with embedded structs, the embedded struct will - // always be accessed as a field before traversing the fields of the - // embedded struct themselves. That is, an exported field from the - // embedded struct will never be accessed directly from the parent struct. - Path []PathStep - - // PathStep is a union-type for specific operations to traverse - // a value's tree structure. Users of this package never need to implement - // these types as values of this type will be returned by this package. - PathStep interface { - String() string - Type() reflect.Type // Resulting type after performing the path step - isPathStep() - } + // In some cases, one or both may be invalid or have restrictions: + // • For StructField, both are not interface-able if the current field + // is unexported and the struct type is not explicitly permitted by + // an Exporter to traverse unexported fields. + // • For SliceIndex, one may be invalid if an element is missing from + // either the x or y slice. + // • For MapIndex, one may be invalid if an entry is missing from + // either the x or y map. + // + // The provided values must not be mutated. + Values() (vx, vy reflect.Value) +} - // SliceIndex is an index operation on a slice or array at some index Key. - SliceIndex interface { - PathStep - Key() int // May return -1 if in a split state - - // SplitKeys returns the indexes for indexing into slices in the - // x and y values, respectively. These indexes may differ due to the - // insertion or removal of an element in one of the slices, causing - // all of the indexes to be shifted. If an index is -1, then that - // indicates that the element does not exist in the associated slice. - // - // Key is guaranteed to return -1 if and only if the indexes returned - // by SplitKeys are not the same. SplitKeys will never return -1 for - // both indexes. - SplitKeys() (x int, y int) - - isSliceIndex() - } - // MapIndex is an index operation on a map at some index Key. - MapIndex interface { - PathStep - Key() reflect.Value - isMapIndex() - } - // TypeAssertion represents a type assertion on an interface. - TypeAssertion interface { - PathStep - isTypeAssertion() - } - // StructField represents a struct field access on a field called Name. - StructField interface { - PathStep - Name() string - Index() int - isStructField() - } - // Indirect represents pointer indirection on the parent type. - Indirect interface { - PathStep - isIndirect() - } - // Transform is a transformation from the parent type to the current type. - Transform interface { - PathStep - Name() string - Func() reflect.Value - isTransform() - } +var ( + _ PathStep = StructField{} + _ PathStep = SliceIndex{} + _ PathStep = MapIndex{} + _ PathStep = Indirect{} + _ PathStep = TypeAssertion{} + _ PathStep = Transform{} ) func (pa *Path) push(s PathStep) { @@ -94,10 +73,21 @@ func (pa *Path) pop() { // Last returns the last PathStep in the Path. // If the path is empty, this returns a non-nil PathStep that reports a nil Type. func (pa Path) Last() PathStep { - if len(pa) > 0 { - return pa[len(pa)-1] + return pa.Index(-1) +} + +// Index returns the ith step in the Path and supports negative indexing. +// A negative index starts counting from the tail of the Path such that -1 +// refers to the last step, -2 refers to the second-to-last step, and so on. +// If index is invalid, this returns a non-nil PathStep that reports a nil Type. +func (pa Path) Index(i int) PathStep { + if i < 0 { + i = len(pa) + i } - return pathStep{} + if i < 0 || i >= len(pa) { + return pathStep{} + } + return pa[i] } // String returns the simplified path to a node. @@ -108,7 +98,7 @@ func (pa Path) Last() PathStep { func (pa Path) String() string { var ss []string for _, s := range pa { - if _, ok := s.(*structField); ok { + if _, ok := s.(StructField); ok { ss = append(ss, s.String()) } } @@ -128,13 +118,13 @@ func (pa Path) GoString() string { nextStep = pa[i+1] } switch s := s.(type) { - case *indirect: + case Indirect: numIndirect++ pPre, pPost := "(", ")" switch nextStep.(type) { - case *indirect: + case Indirect: continue // Next step is indirection, so let them batch up - case *structField: + case StructField: numIndirect-- // Automatic indirection on struct fields case nil: pPre, pPost = "", "" // Last step; no need for parenthesis @@ -145,20 +135,10 @@ func (pa Path) GoString() string { } numIndirect = 0 continue - case *transform: + case Transform: ssPre = append(ssPre, s.trans.name+"(") ssPost = append(ssPost, ")") continue - case *typeAssertion: - // Elide type assertions immediately following a transform to - // prevent overly verbose path printouts. - // Some transforms return interface{} because of Go's lack of - // generics, but typically take in and return the exact same - // concrete type. Other times, the transform creates an anonymous - // struct, which will be very verbose to print. - if _, ok := nextStep.(*transform); ok { - continue - } } ssPost = append(ssPost, s.String()) } @@ -168,44 +148,13 @@ func (pa Path) GoString() string { return strings.Join(ssPre, "") + strings.Join(ssPost, "") } -type ( - pathStep struct { - typ reflect.Type - } - - sliceIndex struct { - pathStep - xkey, ykey int - } - mapIndex struct { - pathStep - key reflect.Value - } - typeAssertion struct { - pathStep - } - structField struct { - pathStep - name string - idx int - - // These fields are used for forcibly accessing an unexported field. - // pvx, pvy, and field are only valid if unexported is true. - unexported bool - force bool // Forcibly allow visibility - pvx, pvy reflect.Value // Parent values - field reflect.StructField // Field information - } - indirect struct { - pathStep - } - transform struct { - pathStep - trans *transformer - } -) +type pathStep struct { + typ reflect.Type + vx, vy reflect.Value +} -func (ps pathStep) Type() reflect.Type { return ps.typ } +func (ps pathStep) Type() reflect.Type { return ps.typ } +func (ps pathStep) Values() (vx, vy reflect.Value) { return ps.vx, ps.vy } func (ps pathStep) String() string { if ps.typ == nil { return "" @@ -217,7 +166,55 @@ func (ps pathStep) String() string { return fmt.Sprintf("{%s}", s) } -func (si sliceIndex) String() string { +// StructField represents a struct field access on a field called Name. +type StructField struct{ *structField } +type structField struct { + pathStep + name string + idx int + + // These fields are used for forcibly accessing an unexported field. + // pvx, pvy, and field are only valid if unexported is true. + unexported bool + mayForce bool // Forcibly allow visibility + pvx, pvy reflect.Value // Parent values + field reflect.StructField // Field information +} + +func (sf StructField) Type() reflect.Type { return sf.typ } +func (sf StructField) Values() (vx, vy reflect.Value) { + if !sf.unexported { + return sf.vx, sf.vy // CanInterface reports true + } + + // Forcibly obtain read-write access to an unexported struct field. + if sf.mayForce { + vx = retrieveUnexportedField(sf.pvx, sf.field) + vy = retrieveUnexportedField(sf.pvy, sf.field) + return vx, vy // CanInterface reports true + } + return sf.vx, sf.vy // CanInterface reports false +} +func (sf StructField) String() string { return fmt.Sprintf(".%s", sf.name) } + +// Name is the field name. +func (sf StructField) Name() string { return sf.name } + +// Index is the index of the field in the parent struct type. +// See reflect.Type.Field. +func (sf StructField) Index() int { return sf.idx } + +// SliceIndex is an index operation on a slice or array at some index Key. +type SliceIndex struct{ *sliceIndex } +type sliceIndex struct { + pathStep + xkey, ykey int + isSlice bool // False for reflect.Array +} + +func (si SliceIndex) Type() reflect.Type { return si.typ } +func (si SliceIndex) Values() (vx, vy reflect.Value) { return si.vx, si.vy } +func (si SliceIndex) String() string { switch { case si.xkey == si.ykey: return fmt.Sprintf("[%d]", si.xkey) @@ -232,62 +229,149 @@ func (si sliceIndex) String() string { return fmt.Sprintf("[%d->%d]", si.xkey, si.ykey) } } -func (mi mapIndex) String() string { return fmt.Sprintf("[%#v]", mi.key) } -func (ta typeAssertion) String() string { return fmt.Sprintf(".(%v)", ta.typ) } -func (sf structField) String() string { return fmt.Sprintf(".%s", sf.name) } -func (in indirect) String() string { return "*" } -func (tf transform) String() string { return fmt.Sprintf("%s()", tf.trans.name) } -func (si sliceIndex) Key() int { +// Key is the index key; it may return -1 if in a split state +func (si SliceIndex) Key() int { if si.xkey != si.ykey { return -1 } return si.xkey } -func (si sliceIndex) SplitKeys() (x, y int) { return si.xkey, si.ykey } -func (mi mapIndex) Key() reflect.Value { return mi.key } -func (sf structField) Name() string { return sf.name } -func (sf structField) Index() int { return sf.idx } -func (tf transform) Name() string { return tf.trans.name } -func (tf transform) Func() reflect.Value { return tf.trans.fnc } - -func (pathStep) isPathStep() {} -func (sliceIndex) isSliceIndex() {} -func (mapIndex) isMapIndex() {} -func (typeAssertion) isTypeAssertion() {} -func (structField) isStructField() {} -func (indirect) isIndirect() {} -func (transform) isTransform() {} -var ( - _ SliceIndex = sliceIndex{} - _ MapIndex = mapIndex{} - _ TypeAssertion = typeAssertion{} - _ StructField = structField{} - _ Indirect = indirect{} - _ Transform = transform{} - - _ PathStep = sliceIndex{} - _ PathStep = mapIndex{} - _ PathStep = typeAssertion{} - _ PathStep = structField{} - _ PathStep = indirect{} - _ PathStep = transform{} -) +// SplitKeys are the indexes for indexing into slices in the +// x and y values, respectively. These indexes may differ due to the +// insertion or removal of an element in one of the slices, causing +// all of the indexes to be shifted. If an index is -1, then that +// indicates that the element does not exist in the associated slice. +// +// Key is guaranteed to return -1 if and only if the indexes returned +// by SplitKeys are not the same. SplitKeys will never return -1 for +// both indexes. +func (si SliceIndex) SplitKeys() (ix, iy int) { return si.xkey, si.ykey } + +// MapIndex is an index operation on a map at some index Key. +type MapIndex struct{ *mapIndex } +type mapIndex struct { + pathStep + key reflect.Value +} + +func (mi MapIndex) Type() reflect.Type { return mi.typ } +func (mi MapIndex) Values() (vx, vy reflect.Value) { return mi.vx, mi.vy } +func (mi MapIndex) String() string { return fmt.Sprintf("[%#v]", mi.key) } + +// Key is the value of the map key. +func (mi MapIndex) Key() reflect.Value { return mi.key } + +// Indirect represents pointer indirection on the parent type. +type Indirect struct{ *indirect } +type indirect struct { + pathStep +} + +func (in Indirect) Type() reflect.Type { return in.typ } +func (in Indirect) Values() (vx, vy reflect.Value) { return in.vx, in.vy } +func (in Indirect) String() string { return "*" } + +// TypeAssertion represents a type assertion on an interface. +type TypeAssertion struct{ *typeAssertion } +type typeAssertion struct { + pathStep +} + +func (ta TypeAssertion) Type() reflect.Type { return ta.typ } +func (ta TypeAssertion) Values() (vx, vy reflect.Value) { return ta.vx, ta.vy } +func (ta TypeAssertion) String() string { return fmt.Sprintf(".(%v)", ta.typ) } + +// Transform is a transformation from the parent type to the current type. +type Transform struct{ *transform } +type transform struct { + pathStep + trans *transformer +} + +func (tf Transform) Type() reflect.Type { return tf.typ } +func (tf Transform) Values() (vx, vy reflect.Value) { return tf.vx, tf.vy } +func (tf Transform) String() string { return fmt.Sprintf("%s()", tf.trans.name) } + +// Name is the name of the Transformer. +func (tf Transform) Name() string { return tf.trans.name } + +// Func is the function pointer to the transformer function. +func (tf Transform) Func() reflect.Value { return tf.trans.fnc } + +// Option returns the originally constructed Transformer option. +// The == operator can be used to detect the exact option used. +func (tf Transform) Option() Option { return tf.trans } + +// pointerPath represents a dual-stack of pointers encountered when +// recursively traversing the x and y values. This data structure supports +// detection of cycles and determining whether the cycles are equal. +// In Go, cycles can occur via pointers, slices, and maps. +// +// The pointerPath uses a map to represent a stack; where descension into a +// pointer pushes the address onto the stack, and ascension from a pointer +// pops the address from the stack. Thus, when traversing into a pointer from +// reflect.Ptr, reflect.Slice element, or reflect.Map, we can detect cycles +// by checking whether the pointer has already been visited. The cycle detection +// uses a seperate stack for the x and y values. +// +// If a cycle is detected we need to determine whether the two pointers +// should be considered equal. The definition of equality chosen by Equal +// requires two graphs to have the same structure. To determine this, both the +// x and y values must have a cycle where the previous pointers were also +// encountered together as a pair. +// +// Semantically, this is equivalent to augmenting Indirect, SliceIndex, and +// MapIndex with pointer information for the x and y values. +// Suppose px and py are two pointers to compare, we then search the +// Path for whether px was ever encountered in the Path history of x, and +// similarly so with py. If either side has a cycle, the comparison is only +// equal if both px and py have a cycle resulting from the same PathStep. +// +// Using a map as a stack is more performant as we can perform cycle detection +// in O(1) instead of O(N) where N is len(Path). +type pointerPath struct { + // mx is keyed by x pointers, where the value is the associated y pointer. + mx map[value.Pointer]value.Pointer + // my is keyed by y pointers, where the value is the associated x pointer. + my map[value.Pointer]value.Pointer +} + +func (p *pointerPath) Init() { + p.mx = make(map[value.Pointer]value.Pointer) + p.my = make(map[value.Pointer]value.Pointer) +} + +// Push indicates intent to descend into pointers vx and vy where +// visited reports whether either has been seen before. If visited before, +// equal reports whether both pointers were encountered together. +// Pop must be called if and only if the pointers were never visited. +// +// The pointers vx and vy must be a reflect.Ptr, reflect.Slice, or reflect.Map +// and be non-nil. +func (p pointerPath) Push(vx, vy reflect.Value) (equal, visited bool) { + px := value.PointerOf(vx) + py := value.PointerOf(vy) + _, ok1 := p.mx[px] + _, ok2 := p.my[py] + if ok1 || ok2 { + equal = p.mx[px] == py && p.my[py] == px // Pointers paired together + return equal, true + } + p.mx[px] = py + p.my[py] = px + return false, false +} + +// Pop ascends from pointers vx and vy. +func (p pointerPath) Pop(vx, vy reflect.Value) { + delete(p.mx, value.PointerOf(vx)) + delete(p.my, value.PointerOf(vy)) +} // isExported reports whether the identifier is exported. func isExported(id string) bool { r, _ := utf8.DecodeRuneInString(id) return unicode.IsUpper(r) } - -// isValid reports whether the identifier is valid. -// Empty and underscore-only strings are not valid. -func isValid(id string) bool { - ok := id != "" && id != "_" - for j, c := range id { - ok = ok && (j > 0 || !unicode.IsDigit(c)) - ok = ok && (c == '_' || unicode.IsLetter(c) || unicode.IsDigit(c)) - } - return ok -} diff --git a/vendor/github.com/google/go-cmp/cmp/report.go b/vendor/github.com/google/go-cmp/cmp/report.go new file mode 100644 index 000000000000..6ddf29993e52 --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/report.go @@ -0,0 +1,51 @@ +// 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.md file. + +package cmp + +// defaultReporter implements the reporter interface. +// +// As Equal serially calls the PushStep, Report, and PopStep methods, the +// defaultReporter constructs a tree-based representation of the compared value +// and the result of each comparison (see valueNode). +// +// When the String method is called, the FormatDiff method transforms the +// valueNode tree into a textNode tree, which is a tree-based representation +// of the textual output (see textNode). +// +// Lastly, the textNode.String method produces the final report as a string. +type defaultReporter struct { + root *valueNode + curr *valueNode +} + +func (r *defaultReporter) PushStep(ps PathStep) { + r.curr = r.curr.PushStep(ps) + if r.root == nil { + r.root = r.curr + } +} +func (r *defaultReporter) Report(rs Result) { + r.curr.Report(rs) +} +func (r *defaultReporter) PopStep() { + r.curr = r.curr.PopStep() +} + +// String provides a full report of the differences detected as a structured +// literal in pseudo-Go syntax. String may only be called after the entire tree +// has been traversed. +func (r *defaultReporter) String() string { + assert(r.root != nil && r.curr == nil) + if r.root.NumDiff == 0 { + return "" + } + return formatOptions{}.FormatDiff(r.root).String() +} + +func assert(ok bool) { + if !ok { + panic("assertion failure") + } +} diff --git a/vendor/github.com/google/go-cmp/cmp/report_compare.go b/vendor/github.com/google/go-cmp/cmp/report_compare.go new file mode 100644 index 000000000000..17a05eede489 --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/report_compare.go @@ -0,0 +1,296 @@ +// Copyright 2019, 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.md file. + +package cmp + +import ( + "fmt" + "reflect" + + "github.com/google/go-cmp/cmp/internal/value" +) + +// TODO: Enforce limits? +// * Enforce maximum number of records to print per node? +// * Enforce maximum size in bytes allowed? +// * As a heuristic, use less verbosity for equal nodes than unequal nodes. +// TODO: Enforce unique outputs? +// * Avoid Stringer methods if it results in same output? +// * Print pointer address if outputs still equal? + +// numContextRecords is the number of surrounding equal records to print. +const numContextRecords = 2 + +type diffMode byte + +const ( + diffUnknown diffMode = 0 + diffIdentical diffMode = ' ' + diffRemoved diffMode = '-' + diffInserted diffMode = '+' +) + +type typeMode int + +const ( + // emitType always prints the type. + emitType typeMode = iota + // elideType never prints the type. + elideType + // autoType prints the type only for composite kinds + // (i.e., structs, slices, arrays, and maps). + autoType +) + +type formatOptions struct { + // DiffMode controls the output mode of FormatDiff. + // + // If diffUnknown, then produce a diff of the x and y values. + // If diffIdentical, then emit values as if they were equal. + // If diffRemoved, then only emit x values (ignoring y values). + // If diffInserted, then only emit y values (ignoring x values). + DiffMode diffMode + + // TypeMode controls whether to print the type for the current node. + // + // As a general rule of thumb, we always print the type of the next node + // after an interface, and always elide the type of the next node after + // a slice or map node. + TypeMode typeMode + + // formatValueOptions are options specific to printing reflect.Values. + formatValueOptions +} + +func (opts formatOptions) WithDiffMode(d diffMode) formatOptions { + opts.DiffMode = d + return opts +} +func (opts formatOptions) WithTypeMode(t typeMode) formatOptions { + opts.TypeMode = t + return opts +} + +// FormatDiff converts a valueNode tree into a textNode tree, where the later +// is a textual representation of the differences detected in the former. +func (opts formatOptions) FormatDiff(v *valueNode) textNode { + // Check whether we have specialized formatting for this node. + // This is not necessary, but helpful for producing more readable outputs. + if opts.CanFormatDiffSlice(v) { + return opts.FormatDiffSlice(v) + } + + // For leaf nodes, format the value based on the reflect.Values alone. + if v.MaxDepth == 0 { + switch opts.DiffMode { + case diffUnknown, diffIdentical: + // Format Equal. + if v.NumDiff == 0 { + outx := opts.FormatValue(v.ValueX, visitedPointers{}) + outy := opts.FormatValue(v.ValueY, visitedPointers{}) + if v.NumIgnored > 0 && v.NumSame == 0 { + return textEllipsis + } else if outx.Len() < outy.Len() { + return outx + } else { + return outy + } + } + + // Format unequal. + assert(opts.DiffMode == diffUnknown) + var list textList + outx := opts.WithTypeMode(elideType).FormatValue(v.ValueX, visitedPointers{}) + outy := opts.WithTypeMode(elideType).FormatValue(v.ValueY, visitedPointers{}) + if outx != nil { + list = append(list, textRecord{Diff: '-', Value: outx}) + } + if outy != nil { + list = append(list, textRecord{Diff: '+', Value: outy}) + } + return opts.WithTypeMode(emitType).FormatType(v.Type, list) + case diffRemoved: + return opts.FormatValue(v.ValueX, visitedPointers{}) + case diffInserted: + return opts.FormatValue(v.ValueY, visitedPointers{}) + default: + panic("invalid diff mode") + } + } + + // Descend into the child value node. + if v.TransformerName != "" { + out := opts.WithTypeMode(emitType).FormatDiff(v.Value) + out = textWrap{"Inverse(" + v.TransformerName + ", ", out, ")"} + return opts.FormatType(v.Type, out) + } else { + switch k := v.Type.Kind(); k { + case reflect.Struct, reflect.Array, reflect.Slice, reflect.Map: + return opts.FormatType(v.Type, opts.formatDiffList(v.Records, k)) + case reflect.Ptr: + return textWrap{"&", opts.FormatDiff(v.Value), ""} + case reflect.Interface: + return opts.WithTypeMode(emitType).FormatDiff(v.Value) + default: + panic(fmt.Sprintf("%v cannot have children", k)) + } + } +} + +func (opts formatOptions) formatDiffList(recs []reportRecord, k reflect.Kind) textNode { + // Derive record name based on the data structure kind. + var name string + var formatKey func(reflect.Value) string + switch k { + case reflect.Struct: + name = "field" + opts = opts.WithTypeMode(autoType) + formatKey = func(v reflect.Value) string { return v.String() } + case reflect.Slice, reflect.Array: + name = "element" + opts = opts.WithTypeMode(elideType) + formatKey = func(reflect.Value) string { return "" } + case reflect.Map: + name = "entry" + opts = opts.WithTypeMode(elideType) + formatKey = formatMapKey + } + + // Handle unification. + switch opts.DiffMode { + case diffIdentical, diffRemoved, diffInserted: + var list textList + var deferredEllipsis bool // Add final "..." to indicate records were dropped + for _, r := range recs { + // Elide struct fields that are zero value. + if k == reflect.Struct { + var isZero bool + switch opts.DiffMode { + case diffIdentical: + isZero = value.IsZero(r.Value.ValueX) || value.IsZero(r.Value.ValueY) + case diffRemoved: + isZero = value.IsZero(r.Value.ValueX) + case diffInserted: + isZero = value.IsZero(r.Value.ValueY) + } + if isZero { + continue + } + } + // Elide ignored nodes. + if r.Value.NumIgnored > 0 && r.Value.NumSame+r.Value.NumDiff == 0 { + deferredEllipsis = !(k == reflect.Slice || k == reflect.Array) + if !deferredEllipsis { + list.AppendEllipsis(diffStats{}) + } + continue + } + if out := opts.FormatDiff(r.Value); out != nil { + list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) + } + } + if deferredEllipsis { + list.AppendEllipsis(diffStats{}) + } + return textWrap{"{", list, "}"} + case diffUnknown: + default: + panic("invalid diff mode") + } + + // Handle differencing. + var list textList + groups := coalesceAdjacentRecords(name, recs) + for i, ds := range groups { + // Handle equal records. + if ds.NumDiff() == 0 { + // Compute the number of leading and trailing records to print. + var numLo, numHi int + numEqual := ds.NumIgnored + ds.NumIdentical + for numLo < numContextRecords && numLo+numHi < numEqual && i != 0 { + if r := recs[numLo].Value; r.NumIgnored > 0 && r.NumSame+r.NumDiff == 0 { + break + } + numLo++ + } + for numHi < numContextRecords && numLo+numHi < numEqual && i != len(groups)-1 { + if r := recs[numEqual-numHi-1].Value; r.NumIgnored > 0 && r.NumSame+r.NumDiff == 0 { + break + } + numHi++ + } + if numEqual-(numLo+numHi) == 1 && ds.NumIgnored == 0 { + numHi++ // Avoid pointless coalescing of a single equal record + } + + // Format the equal values. + for _, r := range recs[:numLo] { + out := opts.WithDiffMode(diffIdentical).FormatDiff(r.Value) + list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) + } + if numEqual > numLo+numHi { + ds.NumIdentical -= numLo + numHi + list.AppendEllipsis(ds) + } + for _, r := range recs[numEqual-numHi : numEqual] { + out := opts.WithDiffMode(diffIdentical).FormatDiff(r.Value) + list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) + } + recs = recs[numEqual:] + continue + } + + // Handle unequal records. + for _, r := range recs[:ds.NumDiff()] { + switch { + case opts.CanFormatDiffSlice(r.Value): + out := opts.FormatDiffSlice(r.Value) + list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) + case r.Value.NumChildren == r.Value.MaxDepth: + outx := opts.WithDiffMode(diffRemoved).FormatDiff(r.Value) + outy := opts.WithDiffMode(diffInserted).FormatDiff(r.Value) + if outx != nil { + list = append(list, textRecord{Diff: diffRemoved, Key: formatKey(r.Key), Value: outx}) + } + if outy != nil { + list = append(list, textRecord{Diff: diffInserted, Key: formatKey(r.Key), Value: outy}) + } + default: + out := opts.FormatDiff(r.Value) + list = append(list, textRecord{Key: formatKey(r.Key), Value: out}) + } + } + recs = recs[ds.NumDiff():] + } + assert(len(recs) == 0) + return textWrap{"{", list, "}"} +} + +// coalesceAdjacentRecords coalesces the list of records into groups of +// adjacent equal, or unequal counts. +func coalesceAdjacentRecords(name string, recs []reportRecord) (groups []diffStats) { + var prevCase int // Arbitrary index into which case last occurred + lastStats := func(i int) *diffStats { + if prevCase != i { + groups = append(groups, diffStats{Name: name}) + prevCase = i + } + return &groups[len(groups)-1] + } + for _, r := range recs { + switch rv := r.Value; { + case rv.NumIgnored > 0 && rv.NumSame+rv.NumDiff == 0: + lastStats(1).NumIgnored++ + case rv.NumDiff == 0: + lastStats(1).NumIdentical++ + case rv.NumDiff > 0 && !rv.ValueY.IsValid(): + lastStats(2).NumRemoved++ + case rv.NumDiff > 0 && !rv.ValueX.IsValid(): + lastStats(2).NumInserted++ + default: + lastStats(2).NumModified++ + } + } + return groups +} diff --git a/vendor/github.com/google/go-cmp/cmp/report_reflect.go b/vendor/github.com/google/go-cmp/cmp/report_reflect.go new file mode 100644 index 000000000000..2761b6289215 --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/report_reflect.go @@ -0,0 +1,278 @@ +// Copyright 2019, 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.md file. + +package cmp + +import ( + "fmt" + "reflect" + "strconv" + "strings" + "unicode" + + "github.com/google/go-cmp/cmp/internal/flags" + "github.com/google/go-cmp/cmp/internal/value" +) + +type formatValueOptions struct { + // AvoidStringer controls whether to avoid calling custom stringer + // methods like error.Error or fmt.Stringer.String. + AvoidStringer bool + + // ShallowPointers controls whether to avoid descending into pointers. + // Useful when printing map keys, where pointer comparison is performed + // on the pointer address rather than the pointed-at value. + ShallowPointers bool + + // PrintAddresses controls whether to print the address of all pointers, + // slice elements, and maps. + PrintAddresses bool +} + +// FormatType prints the type as if it were wrapping s. +// This may return s as-is depending on the current type and TypeMode mode. +func (opts formatOptions) FormatType(t reflect.Type, s textNode) textNode { + // Check whether to emit the type or not. + switch opts.TypeMode { + case autoType: + switch t.Kind() { + case reflect.Struct, reflect.Slice, reflect.Array, reflect.Map: + if s.Equal(textNil) { + return s + } + default: + return s + } + case elideType: + return s + } + + // Determine the type label, applying special handling for unnamed types. + typeName := t.String() + if t.Name() == "" { + // According to Go grammar, certain type literals contain symbols that + // do not strongly bind to the next lexicographical token (e.g., *T). + switch t.Kind() { + case reflect.Chan, reflect.Func, reflect.Ptr: + typeName = "(" + typeName + ")" + } + typeName = strings.Replace(typeName, "struct {", "struct{", -1) + typeName = strings.Replace(typeName, "interface {", "interface{", -1) + } + + // Avoid wrap the value in parenthesis if unnecessary. + if s, ok := s.(textWrap); ok { + hasParens := strings.HasPrefix(s.Prefix, "(") && strings.HasSuffix(s.Suffix, ")") + hasBraces := strings.HasPrefix(s.Prefix, "{") && strings.HasSuffix(s.Suffix, "}") + if hasParens || hasBraces { + return textWrap{typeName, s, ""} + } + } + return textWrap{typeName + "(", s, ")"} +} + +// FormatValue prints the reflect.Value, taking extra care to avoid descending +// into pointers already in m. As pointers are visited, m is also updated. +func (opts formatOptions) FormatValue(v reflect.Value, m visitedPointers) (out textNode) { + if !v.IsValid() { + return nil + } + t := v.Type() + + // Check whether there is an Error or String method to call. + if !opts.AvoidStringer && v.CanInterface() { + // Avoid calling Error or String methods on nil receivers since many + // implementations crash when doing so. + if (t.Kind() != reflect.Ptr && t.Kind() != reflect.Interface) || !v.IsNil() { + switch v := v.Interface().(type) { + case error: + return textLine("e" + formatString(v.Error())) + case fmt.Stringer: + return textLine("s" + formatString(v.String())) + } + } + } + + // Check whether to explicitly wrap the result with the type. + var skipType bool + defer func() { + if !skipType { + out = opts.FormatType(t, out) + } + }() + + var ptr string + switch t.Kind() { + case reflect.Bool: + return textLine(fmt.Sprint(v.Bool())) + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return textLine(fmt.Sprint(v.Int())) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + // Unnamed uints are usually bytes or words, so use hexadecimal. + if t.PkgPath() == "" || t.Kind() == reflect.Uintptr { + return textLine(formatHex(v.Uint())) + } + return textLine(fmt.Sprint(v.Uint())) + case reflect.Float32, reflect.Float64: + return textLine(fmt.Sprint(v.Float())) + case reflect.Complex64, reflect.Complex128: + return textLine(fmt.Sprint(v.Complex())) + case reflect.String: + return textLine(formatString(v.String())) + case reflect.UnsafePointer, reflect.Chan, reflect.Func: + return textLine(formatPointer(v)) + case reflect.Struct: + var list textList + for i := 0; i < v.NumField(); i++ { + vv := v.Field(i) + if value.IsZero(vv) { + continue // Elide fields with zero values + } + s := opts.WithTypeMode(autoType).FormatValue(vv, m) + list = append(list, textRecord{Key: t.Field(i).Name, Value: s}) + } + return textWrap{"{", list, "}"} + case reflect.Slice: + if v.IsNil() { + return textNil + } + if opts.PrintAddresses { + ptr = formatPointer(v) + } + fallthrough + case reflect.Array: + var list textList + for i := 0; i < v.Len(); i++ { + vi := v.Index(i) + if vi.CanAddr() { // Check for cyclic elements + p := vi.Addr() + if m.Visit(p) { + var out textNode + out = textLine(formatPointer(p)) + out = opts.WithTypeMode(emitType).FormatType(p.Type(), out) + out = textWrap{"*", out, ""} + list = append(list, textRecord{Value: out}) + continue + } + } + s := opts.WithTypeMode(elideType).FormatValue(vi, m) + list = append(list, textRecord{Value: s}) + } + return textWrap{ptr + "{", list, "}"} + case reflect.Map: + if v.IsNil() { + return textNil + } + if m.Visit(v) { + return textLine(formatPointer(v)) + } + + var list textList + for _, k := range value.SortKeys(v.MapKeys()) { + sk := formatMapKey(k) + sv := opts.WithTypeMode(elideType).FormatValue(v.MapIndex(k), m) + list = append(list, textRecord{Key: sk, Value: sv}) + } + if opts.PrintAddresses { + ptr = formatPointer(v) + } + return textWrap{ptr + "{", list, "}"} + case reflect.Ptr: + if v.IsNil() { + return textNil + } + if m.Visit(v) || opts.ShallowPointers { + return textLine(formatPointer(v)) + } + if opts.PrintAddresses { + ptr = formatPointer(v) + } + skipType = true // Let the underlying value print the type instead + return textWrap{"&" + ptr, opts.FormatValue(v.Elem(), m), ""} + case reflect.Interface: + if v.IsNil() { + return textNil + } + // Interfaces accept different concrete types, + // so configure the underlying value to explicitly print the type. + skipType = true // Print the concrete type instead + return opts.WithTypeMode(emitType).FormatValue(v.Elem(), m) + default: + panic(fmt.Sprintf("%v kind not handled", v.Kind())) + } +} + +// formatMapKey formats v as if it were a map key. +// The result is guaranteed to be a single line. +func formatMapKey(v reflect.Value) string { + var opts formatOptions + opts.TypeMode = elideType + opts.ShallowPointers = true + s := opts.FormatValue(v, visitedPointers{}).String() + return strings.TrimSpace(s) +} + +// formatString prints s as a double-quoted or backtick-quoted string. +func formatString(s string) string { + // Use quoted string if it the same length as a raw string literal. + // Otherwise, attempt to use the raw string form. + qs := strconv.Quote(s) + if len(qs) == 1+len(s)+1 { + return qs + } + + // Disallow newlines to ensure output is a single line. + // Only allow printable runes for readability purposes. + rawInvalid := func(r rune) bool { + return r == '`' || r == '\n' || !(unicode.IsPrint(r) || r == '\t') + } + if strings.IndexFunc(s, rawInvalid) < 0 { + return "`" + s + "`" + } + return qs +} + +// formatHex prints u as a hexadecimal integer in Go notation. +func formatHex(u uint64) string { + var f string + switch { + case u <= 0xff: + f = "0x%02x" + case u <= 0xffff: + f = "0x%04x" + case u <= 0xffffff: + f = "0x%06x" + case u <= 0xffffffff: + f = "0x%08x" + case u <= 0xffffffffff: + f = "0x%010x" + case u <= 0xffffffffffff: + f = "0x%012x" + case u <= 0xffffffffffffff: + f = "0x%014x" + case u <= 0xffffffffffffffff: + f = "0x%016x" + } + return fmt.Sprintf(f, u) +} + +// formatPointer prints the address of the pointer. +func formatPointer(v reflect.Value) string { + p := v.Pointer() + if flags.Deterministic { + p = 0xdeadf00f // Only used for stable testing purposes + } + return fmt.Sprintf("⟪0x%x⟫", p) +} + +type visitedPointers map[value.Pointer]struct{} + +// Visit inserts pointer v into the visited map and reports whether it had +// already been visited before. +func (m visitedPointers) Visit(v reflect.Value) bool { + p := value.PointerOf(v) + _, visited := m[p] + m[p] = struct{}{} + return visited +} diff --git a/vendor/github.com/google/go-cmp/cmp/report_slices.go b/vendor/github.com/google/go-cmp/cmp/report_slices.go new file mode 100644 index 000000000000..eafcf2e4c0be --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/report_slices.go @@ -0,0 +1,333 @@ +// Copyright 2019, 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.md file. + +package cmp + +import ( + "bytes" + "fmt" + "reflect" + "strings" + "unicode" + "unicode/utf8" + + "github.com/google/go-cmp/cmp/internal/diff" +) + +// CanFormatDiffSlice reports whether we support custom formatting for nodes +// that are slices of primitive kinds or strings. +func (opts formatOptions) CanFormatDiffSlice(v *valueNode) bool { + switch { + case opts.DiffMode != diffUnknown: + return false // Must be formatting in diff mode + case v.NumDiff == 0: + return false // No differences detected + case v.NumIgnored+v.NumCompared+v.NumTransformed > 0: + // TODO: Handle the case where someone uses bytes.Equal on a large slice. + return false // Some custom option was used to determined equality + case !v.ValueX.IsValid() || !v.ValueY.IsValid(): + return false // Both values must be valid + } + + switch t := v.Type; t.Kind() { + case reflect.String: + case reflect.Array, reflect.Slice: + // Only slices of primitive types have specialized handling. + switch t.Elem().Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, + reflect.Bool, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128: + default: + return false + } + + // If a sufficient number of elements already differ, + // use specialized formatting even if length requirement is not met. + if v.NumDiff > v.NumSame { + return true + } + default: + return false + } + + // Use specialized string diffing for longer slices or strings. + const minLength = 64 + return v.ValueX.Len() >= minLength && v.ValueY.Len() >= minLength +} + +// FormatDiffSlice prints a diff for the slices (or strings) represented by v. +// This provides custom-tailored logic to make printing of differences in +// textual strings and slices of primitive kinds more readable. +func (opts formatOptions) FormatDiffSlice(v *valueNode) textNode { + assert(opts.DiffMode == diffUnknown) + t, vx, vy := v.Type, v.ValueX, v.ValueY + + // Auto-detect the type of the data. + var isLinedText, isText, isBinary bool + var sx, sy string + switch { + case t.Kind() == reflect.String: + sx, sy = vx.String(), vy.String() + isText = true // Initial estimate, verify later + case t.Kind() == reflect.Slice && t.Elem() == reflect.TypeOf(byte(0)): + sx, sy = string(vx.Bytes()), string(vy.Bytes()) + isBinary = true // Initial estimate, verify later + case t.Kind() == reflect.Array: + // Arrays need to be addressable for slice operations to work. + vx2, vy2 := reflect.New(t).Elem(), reflect.New(t).Elem() + vx2.Set(vx) + vy2.Set(vy) + vx, vy = vx2, vy2 + } + if isText || isBinary { + var numLines, lastLineIdx, maxLineLen int + isBinary = false + for i, r := range sx + sy { + if !(unicode.IsPrint(r) || unicode.IsSpace(r)) || r == utf8.RuneError { + isBinary = true + break + } + if r == '\n' { + if maxLineLen < i-lastLineIdx { + maxLineLen = i - lastLineIdx + } + lastLineIdx = i + 1 + numLines++ + } + } + isText = !isBinary + isLinedText = isText && numLines >= 4 && maxLineLen <= 256 + } + + // Format the string into printable records. + var list textList + var delim string + switch { + // If the text appears to be multi-lined text, + // then perform differencing across individual lines. + case isLinedText: + ssx := strings.Split(sx, "\n") + ssy := strings.Split(sy, "\n") + list = opts.formatDiffSlice( + reflect.ValueOf(ssx), reflect.ValueOf(ssy), 1, "line", + func(v reflect.Value, d diffMode) textRecord { + s := formatString(v.Index(0).String()) + return textRecord{Diff: d, Value: textLine(s)} + }, + ) + delim = "\n" + // If the text appears to be single-lined text, + // then perform differencing in approximately fixed-sized chunks. + // The output is printed as quoted strings. + case isText: + list = opts.formatDiffSlice( + reflect.ValueOf(sx), reflect.ValueOf(sy), 64, "byte", + func(v reflect.Value, d diffMode) textRecord { + s := formatString(v.String()) + return textRecord{Diff: d, Value: textLine(s)} + }, + ) + delim = "" + // If the text appears to be binary data, + // then perform differencing in approximately fixed-sized chunks. + // The output is inspired by hexdump. + case isBinary: + list = opts.formatDiffSlice( + reflect.ValueOf(sx), reflect.ValueOf(sy), 16, "byte", + func(v reflect.Value, d diffMode) textRecord { + var ss []string + for i := 0; i < v.Len(); i++ { + ss = append(ss, formatHex(v.Index(i).Uint())) + } + s := strings.Join(ss, ", ") + comment := commentString(fmt.Sprintf("%c|%v|", d, formatASCII(v.String()))) + return textRecord{Diff: d, Value: textLine(s), Comment: comment} + }, + ) + // For all other slices of primitive types, + // then perform differencing in approximately fixed-sized chunks. + // The size of each chunk depends on the width of the element kind. + default: + var chunkSize int + if t.Elem().Kind() == reflect.Bool { + chunkSize = 16 + } else { + switch t.Elem().Bits() { + case 8: + chunkSize = 16 + case 16: + chunkSize = 12 + case 32: + chunkSize = 8 + default: + chunkSize = 8 + } + } + list = opts.formatDiffSlice( + vx, vy, chunkSize, t.Elem().Kind().String(), + func(v reflect.Value, d diffMode) textRecord { + var ss []string + for i := 0; i < v.Len(); i++ { + switch t.Elem().Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + ss = append(ss, fmt.Sprint(v.Index(i).Int())) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + ss = append(ss, formatHex(v.Index(i).Uint())) + case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128: + ss = append(ss, fmt.Sprint(v.Index(i).Interface())) + } + } + s := strings.Join(ss, ", ") + return textRecord{Diff: d, Value: textLine(s)} + }, + ) + } + + // Wrap the output with appropriate type information. + var out textNode = textWrap{"{", list, "}"} + if !isText { + // The "{...}" byte-sequence literal is not valid Go syntax for strings. + // Emit the type for extra clarity (e.g. "string{...}"). + if t.Kind() == reflect.String { + opts = opts.WithTypeMode(emitType) + } + return opts.FormatType(t, out) + } + switch t.Kind() { + case reflect.String: + out = textWrap{"strings.Join(", out, fmt.Sprintf(", %q)", delim)} + if t != reflect.TypeOf(string("")) { + out = opts.FormatType(t, out) + } + case reflect.Slice: + out = textWrap{"bytes.Join(", out, fmt.Sprintf(", %q)", delim)} + if t != reflect.TypeOf([]byte(nil)) { + out = opts.FormatType(t, out) + } + } + return out +} + +// formatASCII formats s as an ASCII string. +// This is useful for printing binary strings in a semi-legible way. +func formatASCII(s string) string { + b := bytes.Repeat([]byte{'.'}, len(s)) + for i := 0; i < len(s); i++ { + if ' ' <= s[i] && s[i] <= '~' { + b[i] = s[i] + } + } + return string(b) +} + +func (opts formatOptions) formatDiffSlice( + vx, vy reflect.Value, chunkSize int, name string, + makeRec func(reflect.Value, diffMode) textRecord, +) (list textList) { + es := diff.Difference(vx.Len(), vy.Len(), func(ix int, iy int) diff.Result { + return diff.BoolResult(vx.Index(ix).Interface() == vy.Index(iy).Interface()) + }) + + appendChunks := func(v reflect.Value, d diffMode) int { + n0 := v.Len() + for v.Len() > 0 { + n := chunkSize + if n > v.Len() { + n = v.Len() + } + list = append(list, makeRec(v.Slice(0, n), d)) + v = v.Slice(n, v.Len()) + } + return n0 - v.Len() + } + + groups := coalesceAdjacentEdits(name, es) + groups = coalesceInterveningIdentical(groups, chunkSize/4) + for i, ds := range groups { + // Print equal. + if ds.NumDiff() == 0 { + // Compute the number of leading and trailing equal bytes to print. + var numLo, numHi int + numEqual := ds.NumIgnored + ds.NumIdentical + for numLo < chunkSize*numContextRecords && numLo+numHi < numEqual && i != 0 { + numLo++ + } + for numHi < chunkSize*numContextRecords && numLo+numHi < numEqual && i != len(groups)-1 { + numHi++ + } + if numEqual-(numLo+numHi) <= chunkSize && ds.NumIgnored == 0 { + numHi = numEqual - numLo // Avoid pointless coalescing of single equal row + } + + // Print the equal bytes. + appendChunks(vx.Slice(0, numLo), diffIdentical) + if numEqual > numLo+numHi { + ds.NumIdentical -= numLo + numHi + list.AppendEllipsis(ds) + } + appendChunks(vx.Slice(numEqual-numHi, numEqual), diffIdentical) + vx = vx.Slice(numEqual, vx.Len()) + vy = vy.Slice(numEqual, vy.Len()) + continue + } + + // Print unequal. + nx := appendChunks(vx.Slice(0, ds.NumIdentical+ds.NumRemoved+ds.NumModified), diffRemoved) + vx = vx.Slice(nx, vx.Len()) + ny := appendChunks(vy.Slice(0, ds.NumIdentical+ds.NumInserted+ds.NumModified), diffInserted) + vy = vy.Slice(ny, vy.Len()) + } + assert(vx.Len() == 0 && vy.Len() == 0) + return list +} + +// coalesceAdjacentEdits coalesces the list of edits into groups of adjacent +// equal or unequal counts. +func coalesceAdjacentEdits(name string, es diff.EditScript) (groups []diffStats) { + var prevCase int // Arbitrary index into which case last occurred + lastStats := func(i int) *diffStats { + if prevCase != i { + groups = append(groups, diffStats{Name: name}) + prevCase = i + } + return &groups[len(groups)-1] + } + for _, e := range es { + switch e { + case diff.Identity: + lastStats(1).NumIdentical++ + case diff.UniqueX: + lastStats(2).NumRemoved++ + case diff.UniqueY: + lastStats(2).NumInserted++ + case diff.Modified: + lastStats(2).NumModified++ + } + } + return groups +} + +// coalesceInterveningIdentical coalesces sufficiently short (<= windowSize) +// equal groups into adjacent unequal groups that currently result in a +// dual inserted/removed printout. This acts as a high-pass filter to smooth +// out high-frequency changes within the windowSize. +func coalesceInterveningIdentical(groups []diffStats, windowSize int) []diffStats { + groups, groupsOrig := groups[:0], groups + for i, ds := range groupsOrig { + if len(groups) >= 2 && ds.NumDiff() > 0 { + prev := &groups[len(groups)-2] // Unequal group + curr := &groups[len(groups)-1] // Equal group + next := &groupsOrig[i] // Unequal group + hadX, hadY := prev.NumRemoved > 0, prev.NumInserted > 0 + hasX, hasY := next.NumRemoved > 0, next.NumInserted > 0 + if ((hadX || hasX) && (hadY || hasY)) && curr.NumIdentical <= windowSize { + *prev = prev.Append(*curr).Append(*next) + groups = groups[:len(groups)-1] // Truncate off equal group + continue + } + } + groups = append(groups, ds) + } + return groups +} diff --git a/vendor/github.com/google/go-cmp/cmp/report_text.go b/vendor/github.com/google/go-cmp/cmp/report_text.go new file mode 100644 index 000000000000..8b8fcab7bdf3 --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/report_text.go @@ -0,0 +1,387 @@ +// Copyright 2019, 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.md file. + +package cmp + +import ( + "bytes" + "fmt" + "math/rand" + "strings" + "time" + + "github.com/google/go-cmp/cmp/internal/flags" +) + +var randBool = rand.New(rand.NewSource(time.Now().Unix())).Intn(2) == 0 + +type indentMode int + +func (n indentMode) appendIndent(b []byte, d diffMode) []byte { + // The output of Diff is documented as being unstable to provide future + // flexibility in changing the output for more humanly readable reports. + // This logic intentionally introduces instability to the exact output + // so that users can detect accidental reliance on stability early on, + // rather than much later when an actual change to the format occurs. + if flags.Deterministic || randBool { + // Use regular spaces (U+0020). + switch d { + case diffUnknown, diffIdentical: + b = append(b, " "...) + case diffRemoved: + b = append(b, "- "...) + case diffInserted: + b = append(b, "+ "...) + } + } else { + // Use non-breaking spaces (U+00a0). + switch d { + case diffUnknown, diffIdentical: + b = append(b, "  "...) + case diffRemoved: + b = append(b, "- "...) + case diffInserted: + b = append(b, "+ "...) + } + } + return repeatCount(n).appendChar(b, '\t') +} + +type repeatCount int + +func (n repeatCount) appendChar(b []byte, c byte) []byte { + for ; n > 0; n-- { + b = append(b, c) + } + return b +} + +// textNode is a simplified tree-based representation of structured text. +// Possible node types are textWrap, textList, or textLine. +type textNode interface { + // Len reports the length in bytes of a single-line version of the tree. + // Nested textRecord.Diff and textRecord.Comment fields are ignored. + Len() int + // Equal reports whether the two trees are structurally identical. + // Nested textRecord.Diff and textRecord.Comment fields are compared. + Equal(textNode) bool + // String returns the string representation of the text tree. + // It is not guaranteed that len(x.String()) == x.Len(), + // nor that x.String() == y.String() implies that x.Equal(y). + String() string + + // formatCompactTo formats the contents of the tree as a single-line string + // to the provided buffer. Any nested textRecord.Diff and textRecord.Comment + // fields are ignored. + // + // However, not all nodes in the tree should be collapsed as a single-line. + // If a node can be collapsed as a single-line, it is replaced by a textLine + // node. Since the top-level node cannot replace itself, this also returns + // the current node itself. + // + // This does not mutate the receiver. + formatCompactTo([]byte, diffMode) ([]byte, textNode) + // formatExpandedTo formats the contents of the tree as a multi-line string + // to the provided buffer. In order for column alignment to operate well, + // formatCompactTo must be called before calling formatExpandedTo. + formatExpandedTo([]byte, diffMode, indentMode) []byte +} + +// textWrap is a wrapper that concatenates a prefix and/or a suffix +// to the underlying node. +type textWrap struct { + Prefix string // e.g., "bytes.Buffer{" + Value textNode // textWrap | textList | textLine + Suffix string // e.g., "}" +} + +func (s textWrap) Len() int { + return len(s.Prefix) + s.Value.Len() + len(s.Suffix) +} +func (s1 textWrap) Equal(s2 textNode) bool { + if s2, ok := s2.(textWrap); ok { + return s1.Prefix == s2.Prefix && s1.Value.Equal(s2.Value) && s1.Suffix == s2.Suffix + } + return false +} +func (s textWrap) String() string { + var d diffMode + var n indentMode + _, s2 := s.formatCompactTo(nil, d) + b := n.appendIndent(nil, d) // Leading indent + b = s2.formatExpandedTo(b, d, n) // Main body + b = append(b, '\n') // Trailing newline + return string(b) +} +func (s textWrap) formatCompactTo(b []byte, d diffMode) ([]byte, textNode) { + n0 := len(b) // Original buffer length + b = append(b, s.Prefix...) + b, s.Value = s.Value.formatCompactTo(b, d) + b = append(b, s.Suffix...) + if _, ok := s.Value.(textLine); ok { + return b, textLine(b[n0:]) + } + return b, s +} +func (s textWrap) formatExpandedTo(b []byte, d diffMode, n indentMode) []byte { + b = append(b, s.Prefix...) + b = s.Value.formatExpandedTo(b, d, n) + b = append(b, s.Suffix...) + return b +} + +// textList is a comma-separated list of textWrap or textLine nodes. +// The list may be formatted as multi-lines or single-line at the discretion +// of the textList.formatCompactTo method. +type textList []textRecord +type textRecord struct { + Diff diffMode // e.g., 0 or '-' or '+' + Key string // e.g., "MyField" + Value textNode // textWrap | textLine + Comment fmt.Stringer // e.g., "6 identical fields" +} + +// AppendEllipsis appends a new ellipsis node to the list if none already +// exists at the end. If cs is non-zero it coalesces the statistics with the +// previous diffStats. +func (s *textList) AppendEllipsis(ds diffStats) { + hasStats := ds != diffStats{} + if len(*s) == 0 || !(*s)[len(*s)-1].Value.Equal(textEllipsis) { + if hasStats { + *s = append(*s, textRecord{Value: textEllipsis, Comment: ds}) + } else { + *s = append(*s, textRecord{Value: textEllipsis}) + } + return + } + if hasStats { + (*s)[len(*s)-1].Comment = (*s)[len(*s)-1].Comment.(diffStats).Append(ds) + } +} + +func (s textList) Len() (n int) { + for i, r := range s { + n += len(r.Key) + if r.Key != "" { + n += len(": ") + } + n += r.Value.Len() + if i < len(s)-1 { + n += len(", ") + } + } + return n +} + +func (s1 textList) Equal(s2 textNode) bool { + if s2, ok := s2.(textList); ok { + if len(s1) != len(s2) { + return false + } + for i := range s1 { + r1, r2 := s1[i], s2[i] + if !(r1.Diff == r2.Diff && r1.Key == r2.Key && r1.Value.Equal(r2.Value) && r1.Comment == r2.Comment) { + return false + } + } + return true + } + return false +} + +func (s textList) String() string { + return textWrap{"{", s, "}"}.String() +} + +func (s textList) formatCompactTo(b []byte, d diffMode) ([]byte, textNode) { + s = append(textList(nil), s...) // Avoid mutating original + + // Determine whether we can collapse this list as a single line. + n0 := len(b) // Original buffer length + var multiLine bool + for i, r := range s { + if r.Diff == diffInserted || r.Diff == diffRemoved { + multiLine = true + } + b = append(b, r.Key...) + if r.Key != "" { + b = append(b, ": "...) + } + b, s[i].Value = r.Value.formatCompactTo(b, d|r.Diff) + if _, ok := s[i].Value.(textLine); !ok { + multiLine = true + } + if r.Comment != nil { + multiLine = true + } + if i < len(s)-1 { + b = append(b, ", "...) + } + } + // Force multi-lined output when printing a removed/inserted node that + // is sufficiently long. + if (d == diffInserted || d == diffRemoved) && len(b[n0:]) > 80 { + multiLine = true + } + if !multiLine { + return b, textLine(b[n0:]) + } + return b, s +} + +func (s textList) formatExpandedTo(b []byte, d diffMode, n indentMode) []byte { + alignKeyLens := s.alignLens( + func(r textRecord) bool { + _, isLine := r.Value.(textLine) + return r.Key == "" || !isLine + }, + func(r textRecord) int { return len(r.Key) }, + ) + alignValueLens := s.alignLens( + func(r textRecord) bool { + _, isLine := r.Value.(textLine) + return !isLine || r.Value.Equal(textEllipsis) || r.Comment == nil + }, + func(r textRecord) int { return len(r.Value.(textLine)) }, + ) + + // Format the list as a multi-lined output. + n++ + for i, r := range s { + b = n.appendIndent(append(b, '\n'), d|r.Diff) + if r.Key != "" { + b = append(b, r.Key+": "...) + } + b = alignKeyLens[i].appendChar(b, ' ') + + b = r.Value.formatExpandedTo(b, d|r.Diff, n) + if !r.Value.Equal(textEllipsis) { + b = append(b, ',') + } + b = alignValueLens[i].appendChar(b, ' ') + + if r.Comment != nil { + b = append(b, " // "+r.Comment.String()...) + } + } + n-- + + return n.appendIndent(append(b, '\n'), d) +} + +func (s textList) alignLens( + skipFunc func(textRecord) bool, + lenFunc func(textRecord) int, +) []repeatCount { + var startIdx, endIdx, maxLen int + lens := make([]repeatCount, len(s)) + for i, r := range s { + if skipFunc(r) { + for j := startIdx; j < endIdx && j < len(s); j++ { + lens[j] = repeatCount(maxLen - lenFunc(s[j])) + } + startIdx, endIdx, maxLen = i+1, i+1, 0 + } else { + if maxLen < lenFunc(r) { + maxLen = lenFunc(r) + } + endIdx = i + 1 + } + } + for j := startIdx; j < endIdx && j < len(s); j++ { + lens[j] = repeatCount(maxLen - lenFunc(s[j])) + } + return lens +} + +// textLine is a single-line segment of text and is always a leaf node +// in the textNode tree. +type textLine []byte + +var ( + textNil = textLine("nil") + textEllipsis = textLine("...") +) + +func (s textLine) Len() int { + return len(s) +} +func (s1 textLine) Equal(s2 textNode) bool { + if s2, ok := s2.(textLine); ok { + return bytes.Equal([]byte(s1), []byte(s2)) + } + return false +} +func (s textLine) String() string { + return string(s) +} +func (s textLine) formatCompactTo(b []byte, d diffMode) ([]byte, textNode) { + return append(b, s...), s +} +func (s textLine) formatExpandedTo(b []byte, _ diffMode, _ indentMode) []byte { + return append(b, s...) +} + +type diffStats struct { + Name string + NumIgnored int + NumIdentical int + NumRemoved int + NumInserted int + NumModified int +} + +func (s diffStats) NumDiff() int { + return s.NumRemoved + s.NumInserted + s.NumModified +} + +func (s diffStats) Append(ds diffStats) diffStats { + assert(s.Name == ds.Name) + s.NumIgnored += ds.NumIgnored + s.NumIdentical += ds.NumIdentical + s.NumRemoved += ds.NumRemoved + s.NumInserted += ds.NumInserted + s.NumModified += ds.NumModified + return s +} + +// String prints a humanly-readable summary of coalesced records. +// +// Example: +// diffStats{Name: "Field", NumIgnored: 5}.String() => "5 ignored fields" +func (s diffStats) String() string { + var ss []string + var sum int + labels := [...]string{"ignored", "identical", "removed", "inserted", "modified"} + counts := [...]int{s.NumIgnored, s.NumIdentical, s.NumRemoved, s.NumInserted, s.NumModified} + for i, n := range counts { + if n > 0 { + ss = append(ss, fmt.Sprintf("%d %v", n, labels[i])) + } + sum += n + } + + // Pluralize the name (adjusting for some obscure English grammar rules). + name := s.Name + if sum > 1 { + name += "s" + if strings.HasSuffix(name, "ys") { + name = name[:len(name)-2] + "ies" // e.g., "entrys" => "entries" + } + } + + // Format the list according to English grammar (with Oxford comma). + switch n := len(ss); n { + case 0: + return "" + case 1, 2: + return strings.Join(ss, " and ") + " " + name + default: + return strings.Join(ss[:n-1], ", ") + ", and " + ss[n-1] + " " + name + } +} + +type commentString string + +func (s commentString) String() string { return string(s) } diff --git a/vendor/github.com/google/go-cmp/cmp/report_value.go b/vendor/github.com/google/go-cmp/cmp/report_value.go new file mode 100644 index 000000000000..83031a7f5070 --- /dev/null +++ b/vendor/github.com/google/go-cmp/cmp/report_value.go @@ -0,0 +1,121 @@ +// Copyright 2019, 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.md file. + +package cmp + +import "reflect" + +// valueNode represents a single node within a report, which is a +// structured representation of the value tree, containing information +// regarding which nodes are equal or not. +type valueNode struct { + parent *valueNode + + Type reflect.Type + ValueX reflect.Value + ValueY reflect.Value + + // NumSame is the number of leaf nodes that are equal. + // All descendants are equal only if NumDiff is 0. + NumSame int + // NumDiff is the number of leaf nodes that are not equal. + NumDiff int + // NumIgnored is the number of leaf nodes that are ignored. + NumIgnored int + // NumCompared is the number of leaf nodes that were compared + // using an Equal method or Comparer function. + NumCompared int + // NumTransformed is the number of non-leaf nodes that were transformed. + NumTransformed int + // NumChildren is the number of transitive descendants of this node. + // This counts from zero; thus, leaf nodes have no descendants. + NumChildren int + // MaxDepth is the maximum depth of the tree. This counts from zero; + // thus, leaf nodes have a depth of zero. + MaxDepth int + + // Records is a list of struct fields, slice elements, or map entries. + Records []reportRecord // If populated, implies Value is not populated + + // Value is the result of a transformation, pointer indirect, of + // type assertion. + Value *valueNode // If populated, implies Records is not populated + + // TransformerName is the name of the transformer. + TransformerName string // If non-empty, implies Value is populated +} +type reportRecord struct { + Key reflect.Value // Invalid for slice element + Value *valueNode +} + +func (parent *valueNode) PushStep(ps PathStep) (child *valueNode) { + vx, vy := ps.Values() + child = &valueNode{parent: parent, Type: ps.Type(), ValueX: vx, ValueY: vy} + switch s := ps.(type) { + case StructField: + assert(parent.Value == nil) + parent.Records = append(parent.Records, reportRecord{Key: reflect.ValueOf(s.Name()), Value: child}) + case SliceIndex: + assert(parent.Value == nil) + parent.Records = append(parent.Records, reportRecord{Value: child}) + case MapIndex: + assert(parent.Value == nil) + parent.Records = append(parent.Records, reportRecord{Key: s.Key(), Value: child}) + case Indirect: + assert(parent.Value == nil && parent.Records == nil) + parent.Value = child + case TypeAssertion: + assert(parent.Value == nil && parent.Records == nil) + parent.Value = child + case Transform: + assert(parent.Value == nil && parent.Records == nil) + parent.Value = child + parent.TransformerName = s.Name() + parent.NumTransformed++ + default: + assert(parent == nil) // Must be the root step + } + return child +} + +func (r *valueNode) Report(rs Result) { + assert(r.MaxDepth == 0) // May only be called on leaf nodes + + if rs.ByIgnore() { + r.NumIgnored++ + } else { + if rs.Equal() { + r.NumSame++ + } else { + r.NumDiff++ + } + } + assert(r.NumSame+r.NumDiff+r.NumIgnored == 1) + + if rs.ByMethod() { + r.NumCompared++ + } + if rs.ByFunc() { + r.NumCompared++ + } + assert(r.NumCompared <= 1) +} + +func (child *valueNode) PopStep() (parent *valueNode) { + if child.parent == nil { + return nil + } + parent = child.parent + parent.NumSame += child.NumSame + parent.NumDiff += child.NumDiff + parent.NumIgnored += child.NumIgnored + parent.NumCompared += child.NumCompared + parent.NumTransformed += child.NumTransformed + parent.NumChildren += child.NumChildren + 1 + if parent.MaxDepth < child.MaxDepth+1 { + parent.MaxDepth = child.MaxDepth + 1 + } + return parent +} diff --git a/vendor/github.com/google/go-cmp/cmp/reporter.go b/vendor/github.com/google/go-cmp/cmp/reporter.go deleted file mode 100644 index a21d0cded2c2..000000000000 --- a/vendor/github.com/google/go-cmp/cmp/reporter.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE.md file. - -package cmp - -import ( - "fmt" - "reflect" - "strings" - - "github.com/google/go-cmp/cmp/internal/value" -) - -type defaultReporter struct { - Option - diffs []string // List of differences, possibly truncated - ndiffs int // Total number of differences - nbytes int // Number of bytes in diffs - nlines int // Number of lines in diffs -} - -var _ reporter = (*defaultReporter)(nil) - -func (r *defaultReporter) Report(x, y reflect.Value, eq bool, p Path) { - if eq { - return // Ignore equal results - } - const maxBytes = 4096 - const maxLines = 256 - r.ndiffs++ - if r.nbytes < maxBytes && r.nlines < maxLines { - sx := value.Format(x, true) - sy := value.Format(y, true) - if sx == sy { - // Stringer is not helpful, so rely on more exact formatting. - sx = value.Format(x, false) - sy = value.Format(y, false) - } - s := fmt.Sprintf("%#v:\n\t-: %s\n\t+: %s\n", p, sx, sy) - r.diffs = append(r.diffs, s) - r.nbytes += len(s) - r.nlines += strings.Count(s, "\n") - } -} - -func (r *defaultReporter) String() string { - s := strings.Join(r.diffs, "") - if r.ndiffs == len(r.diffs) { - return s - } - return fmt.Sprintf("%s... %d more differences ...", s, len(r.diffs)-r.ndiffs) -} diff --git a/vendor/github.com/google/go-cmp/cmp/unsafe_reflect.go b/vendor/github.com/google/go-cmp/cmp/unsafe_reflect.go deleted file mode 100644 index 81fb82632e34..000000000000 --- a/vendor/github.com/google/go-cmp/cmp/unsafe_reflect.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2017, The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE.md file. - -// +build !appengine,!js - -package cmp - -import ( - "reflect" - "unsafe" -) - -const supportAllowUnexported = true - -// unsafeRetrieveField uses unsafe to forcibly retrieve any field from a struct -// such that the value has read-write permissions. -// -// The parent struct, v, must be addressable, while f must be a StructField -// describing the field to retrieve. -func unsafeRetrieveField(v reflect.Value, f reflect.StructField) reflect.Value { - return reflect.NewAt(f.Type, unsafe.Pointer(v.UnsafeAddr()+f.Offset)).Elem() -} diff --git a/vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/google/go-querystring/query/encode.go b/vendor/github.com/google/go-querystring/query/encode.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/digitalocean/vendor/github.com/google/go-querystring/query/encode.go rename to vendor/github.com/google/go-querystring/query/encode.go diff --git a/vendor/github.com/googleapis/gax-go/LICENSE b/vendor/github.com/googleapis/gax-go/v2/LICENSE similarity index 100% rename from vendor/github.com/googleapis/gax-go/LICENSE rename to vendor/github.com/googleapis/gax-go/v2/LICENSE diff --git a/vendor/github.com/gophercloud/gophercloud/.gitignore b/vendor/github.com/gophercloud/gophercloud/.gitignore new file mode 100644 index 000000000000..dd91ed205597 --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/.gitignore @@ -0,0 +1,3 @@ +**/*.swp +.idea +.vscode diff --git a/vendor/github.com/gophercloud/gophercloud/.travis.yml b/vendor/github.com/gophercloud/gophercloud/.travis.yml new file mode 100644 index 000000000000..02728f496825 --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/.travis.yml @@ -0,0 +1,21 @@ +language: go +sudo: false +install: +- go get golang.org/x/crypto/ssh +- go get -v -tags 'fixtures acceptance' ./... +- go get github.com/wadey/gocovmerge +- go get github.com/mattn/goveralls +- go get golang.org/x/tools/cmd/goimports +go: +- "1.10" +- "tip" +env: + global: + - secure: "xSQsAG5wlL9emjbCdxzz/hYQsSpJ/bABO1kkbwMSISVcJ3Nk0u4ywF+LS4bgeOnwPfmFvNTOqVDu3RwEvMeWXSI76t1piCPcObutb2faKLVD/hLoAS76gYX+Z8yGWGHrSB7Do5vTPj1ERe2UljdrnsSeOXzoDwFxYRaZLX4bBOB4AyoGvRniil5QXPATiA1tsWX1VMicj8a4F8X+xeESzjt1Q5Iy31e7vkptu71bhvXCaoo5QhYwT+pLR9dN0S1b7Ro0KVvkRefmr1lUOSYd2e74h6Lc34tC1h3uYZCS4h47t7v5cOXvMNxinEj2C51RvbjvZI1RLVdkuAEJD1Iz4+Ote46nXbZ//6XRZMZz/YxQ13l7ux1PFjgEB6HAapmF5Xd8PRsgeTU9LRJxpiTJ3P5QJ3leS1va8qnziM5kYipj/Rn+V8g2ad/rgkRox9LSiR9VYZD2Pe45YCb1mTKSl2aIJnV7nkOqsShY5LNB4JZSg7xIffA+9YVDktw8dJlATjZqt7WvJJ49g6A61mIUV4C15q2JPGKTkZzDiG81NtmS7hFa7k0yaE2ELgYocbcuyUcAahhxntYTC0i23nJmEHVNiZmBO3u7EgpWe4KGVfumU+lt12tIn5b3dZRBBUk3QakKKozSK1QPHGpk/AZGrhu7H6l8to6IICKWtDcyMPQ=" +before_script: +- go vet ./... +script: +- ./script/coverage +- ./script/format +after_success: +- $HOME/gopath/bin/goveralls -service=travis-ci -coverprofile=cover.out diff --git a/vendor/github.com/gophercloud/gophercloud/.zuul.yaml b/vendor/github.com/gophercloud/gophercloud/.zuul.yaml new file mode 100644 index 000000000000..92fd9d482684 --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/.zuul.yaml @@ -0,0 +1,86 @@ +- job: + name: gophercloud-unittest + parent: golang-test + description: | + Run gophercloud unit test + run: .zuul/playbooks/gophercloud-unittest/run.yaml + nodeset: ubuntu-xenial-ut + +- job: + name: gophercloud-acceptance-test + parent: golang-test + description: | + Run gophercloud acceptance test on master branch + run: .zuul/playbooks/gophercloud-acceptance-test/run.yaml + +- job: + name: gophercloud-acceptance-test-queens + parent: gophercloud-acceptance-test + description: | + Run gophercloud acceptance test on queens branch + vars: + global_env: + OS_BRANCH: stable/queens + +- job: + name: gophercloud-acceptance-test-pike + parent: gophercloud-acceptance-test + description: | + Run gophercloud acceptance test on pike branch + vars: + global_env: + OS_BRANCH: stable/pike + +- job: + name: gophercloud-acceptance-test-ocata + parent: gophercloud-acceptance-test + description: | + Run gophercloud acceptance test on ocata branch + vars: + global_env: + OS_BRANCH: stable/ocata + +- job: + name: gophercloud-acceptance-test-newton + parent: gophercloud-acceptance-test + description: | + Run gophercloud acceptance test on newton branch + vars: + global_env: + OS_BRANCH: stable/newton + +- job: + name: gophercloud-acceptance-test-mitaka + parent: gophercloud-acceptance-test + description: | + Run gophercloud acceptance test on mitaka branch + vars: + global_env: + OS_BRANCH: stable/mitaka + nodeset: ubuntu-trusty + +- project: + name: gophercloud/gophercloud + check: + jobs: + - gophercloud-unittest + - gophercloud-acceptance-test + recheck-mitaka: + jobs: + - gophercloud-acceptance-test-mitaka + recheck-newton: + jobs: + - gophercloud-acceptance-test-newton + recheck-ocata: + jobs: + - gophercloud-acceptance-test-ocata + recheck-pike: + jobs: + - gophercloud-acceptance-test-pike + recheck-queens: + jobs: + - gophercloud-acceptance-test-queens + periodic: + jobs: + - gophercloud-unittest + - gophercloud-acceptance-test diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/CHANGELOG.md b/vendor/github.com/gophercloud/gophercloud/CHANGELOG.md similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/CHANGELOG.md rename to vendor/github.com/gophercloud/gophercloud/CHANGELOG.md diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/LICENSE b/vendor/github.com/gophercloud/gophercloud/LICENSE similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/LICENSE rename to vendor/github.com/gophercloud/gophercloud/LICENSE diff --git a/vendor/github.com/gophercloud/gophercloud/README.md b/vendor/github.com/gophercloud/gophercloud/README.md new file mode 100644 index 000000000000..ad29041d9bfe --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/README.md @@ -0,0 +1,159 @@ +# Gophercloud: an OpenStack SDK for Go +[![Build Status](https://travis-ci.org/gophercloud/gophercloud.svg?branch=master)](https://travis-ci.org/gophercloud/gophercloud) +[![Coverage Status](https://coveralls.io/repos/github/gophercloud/gophercloud/badge.svg?branch=master)](https://coveralls.io/github/gophercloud/gophercloud?branch=master) + +Gophercloud is an OpenStack Go SDK. + +## Useful links + +* [Reference documentation](http://godoc.org/github.com/gophercloud/gophercloud) +* [Effective Go](https://golang.org/doc/effective_go.html) + +## How to install + +Before installing, you need to ensure that your [GOPATH environment variable](https://golang.org/doc/code.html#GOPATH) +is pointing to an appropriate directory where you want to install Gophercloud: + +```bash +mkdir $HOME/go +export GOPATH=$HOME/go +``` + +To protect yourself against changes in your dependencies, we highly recommend choosing a +[dependency management solution](https://github.com/golang/go/wiki/PackageManagementTools) for +your projects, such as [godep](https://github.com/tools/godep). Once this is set up, you can install +Gophercloud as a dependency like so: + +```bash +go get github.com/gophercloud/gophercloud + +# Edit your code to import relevant packages from "github.com/gophercloud/gophercloud" + +godep save ./... +``` + +This will install all the source files you need into a `Godeps/_workspace` directory, which is +referenceable from your own source files when you use the `godep go` command. + +## Getting started + +### Credentials + +Because you'll be hitting an API, you will need to retrieve your OpenStack +credentials and either store them as environment variables or in your local Go +files. The first method is recommended because it decouples credential +information from source code, allowing you to push the latter to your version +control system without any security risk. + +You will need to retrieve the following: + +* username +* password +* a valid Keystone identity URL + +For users that have the OpenStack dashboard installed, there's a shortcut. If +you visit the `project/access_and_security` path in Horizon and click on the +"Download OpenStack RC File" button at the top right hand corner, you will +download a bash file that exports all of your access details to environment +variables. To execute the file, run `source admin-openrc.sh` and you will be +prompted for your password. + +### Authentication + +Once you have access to your credentials, you can begin plugging them into +Gophercloud. The next step is authentication, and this is handled by a base +"Provider" struct. To get one, you can either pass in your credentials +explicitly, or tell Gophercloud to use environment variables: + +```go +import ( + "github.com/gophercloud/gophercloud" + "github.com/gophercloud/gophercloud/openstack" + "github.com/gophercloud/gophercloud/openstack/utils" +) + +// Option 1: Pass in the values yourself +opts := gophercloud.AuthOptions{ + IdentityEndpoint: "https://openstack.example.com:5000/v2.0", + Username: "{username}", + Password: "{password}", +} + +// Option 2: Use a utility function to retrieve all your environment variables +opts, err := openstack.AuthOptionsFromEnv() +``` + +Once you have the `opts` variable, you can pass it in and get back a +`ProviderClient` struct: + +```go +provider, err := openstack.AuthenticatedClient(opts) +``` + +The `ProviderClient` is the top-level client that all of your OpenStack services +derive from. The provider contains all of the authentication details that allow +your Go code to access the API - such as the base URL and token ID. + +### Provision a server + +Once we have a base Provider, we inject it as a dependency into each OpenStack +service. In order to work with the Compute API, we need a Compute service +client; which can be created like so: + +```go +client, err := openstack.NewComputeV2(provider, gophercloud.EndpointOpts{ + Region: os.Getenv("OS_REGION_NAME"), +}) +``` + +We then use this `client` for any Compute API operation we want. In our case, +we want to provision a new server - so we invoke the `Create` method and pass +in the flavor ID (hardware specification) and image ID (operating system) we're +interested in: + +```go +import "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" + +server, err := servers.Create(client, servers.CreateOpts{ + Name: "My new server!", + FlavorRef: "flavor_id", + ImageRef: "image_id", +}).Extract() +``` + +The above code sample creates a new server with the parameters, and embodies the +new resource in the `server` variable (a +[`servers.Server`](http://godoc.org/github.com/gophercloud/gophercloud) struct). + +## Advanced Usage + +Have a look at the [FAQ](./docs/FAQ.md) for some tips on customizing the way Gophercloud works. + +## Backwards-Compatibility Guarantees + +None. Vendor it and write tests covering the parts you use. + +## Contributing + +See the [contributing guide](./.github/CONTRIBUTING.md). + +## Help and feedback + +If you're struggling with something or have spotted a potential bug, feel free +to submit an issue to our [bug tracker](https://github.com/gophercloud/gophercloud/issues). + +## Thank You + +We'd like to extend special thanks and appreciation to the following: + +### OpenLab + + + +OpenLab is providing a full CI environment to test each PR and merge for a variety of OpenStack releases. + +### VEXXHOST + + + +VEXXHOST is providing their services to assist with the development and testing of Gophercloud. diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/auth_options.go b/vendor/github.com/gophercloud/gophercloud/auth_options.go similarity index 87% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/auth_options.go rename to vendor/github.com/gophercloud/gophercloud/auth_options.go index 4211470020ae..5e693585c2d3 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/auth_options.go +++ b/vendor/github.com/gophercloud/gophercloud/auth_options.go @@ -81,6 +81,17 @@ type AuthOptions struct { // TokenID allows users to authenticate (possibly as another user) with an // authentication token ID. TokenID string `json:"-"` + + // Scope determines the scoping of the authentication request. + Scope *AuthScope `json:"-"` +} + +// AuthScope allows a created token to be limited to a specific domain or project. +type AuthScope struct { + ProjectID string + ProjectName string + DomainID string + DomainName string } // ToTokenV2CreateMap allows AuthOptions to satisfy the AuthOptionsBuilder @@ -263,85 +274,83 @@ func (opts *AuthOptions) ToTokenV3CreateMap(scope map[string]interface{}) (map[s } func (opts *AuthOptions) ToTokenV3ScopeMap() (map[string]interface{}, error) { - - var scope struct { - ProjectID string - ProjectName string - DomainID string - DomainName string - } - - if opts.TenantID != "" { - scope.ProjectID = opts.TenantID - } else { - if opts.TenantName != "" { - scope.ProjectName = opts.TenantName - scope.DomainID = opts.DomainID - scope.DomainName = opts.DomainName + // For backwards compatibility. + // If AuthOptions.Scope was not set, try to determine it. + // This works well for common scenarios. + if opts.Scope == nil { + opts.Scope = new(AuthScope) + if opts.TenantID != "" { + opts.Scope.ProjectID = opts.TenantID + } else { + if opts.TenantName != "" { + opts.Scope.ProjectName = opts.TenantName + opts.Scope.DomainID = opts.DomainID + opts.Scope.DomainName = opts.DomainName + } } } - if scope.ProjectName != "" { + if opts.Scope.ProjectName != "" { // ProjectName provided: either DomainID or DomainName must also be supplied. // ProjectID may not be supplied. - if scope.DomainID == "" && scope.DomainName == "" { + if opts.Scope.DomainID == "" && opts.Scope.DomainName == "" { return nil, ErrScopeDomainIDOrDomainName{} } - if scope.ProjectID != "" { + if opts.Scope.ProjectID != "" { return nil, ErrScopeProjectIDOrProjectName{} } - if scope.DomainID != "" { + if opts.Scope.DomainID != "" { // ProjectName + DomainID return map[string]interface{}{ "project": map[string]interface{}{ - "name": &scope.ProjectName, - "domain": map[string]interface{}{"id": &scope.DomainID}, + "name": &opts.Scope.ProjectName, + "domain": map[string]interface{}{"id": &opts.Scope.DomainID}, }, }, nil } - if scope.DomainName != "" { + if opts.Scope.DomainName != "" { // ProjectName + DomainName return map[string]interface{}{ "project": map[string]interface{}{ - "name": &scope.ProjectName, - "domain": map[string]interface{}{"name": &scope.DomainName}, + "name": &opts.Scope.ProjectName, + "domain": map[string]interface{}{"name": &opts.Scope.DomainName}, }, }, nil } - } else if scope.ProjectID != "" { + } else if opts.Scope.ProjectID != "" { // ProjectID provided. ProjectName, DomainID, and DomainName may not be provided. - if scope.DomainID != "" { + if opts.Scope.DomainID != "" { return nil, ErrScopeProjectIDAlone{} } - if scope.DomainName != "" { + if opts.Scope.DomainName != "" { return nil, ErrScopeProjectIDAlone{} } // ProjectID return map[string]interface{}{ "project": map[string]interface{}{ - "id": &scope.ProjectID, + "id": &opts.Scope.ProjectID, }, }, nil - } else if scope.DomainID != "" { + } else if opts.Scope.DomainID != "" { // DomainID provided. ProjectID, ProjectName, and DomainName may not be provided. - if scope.DomainName != "" { + if opts.Scope.DomainName != "" { return nil, ErrScopeDomainIDOrDomainName{} } // DomainID return map[string]interface{}{ "domain": map[string]interface{}{ - "id": &scope.DomainID, + "id": &opts.Scope.DomainID, }, }, nil - } else if scope.DomainName != "" { + } else if opts.Scope.DomainName != "" { // DomainName return map[string]interface{}{ "domain": map[string]interface{}{ - "name": &scope.DomainName, + "name": &opts.Scope.DomainName, }, }, nil } diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/doc.go b/vendor/github.com/gophercloud/gophercloud/doc.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/doc.go rename to vendor/github.com/gophercloud/gophercloud/doc.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/endpoint_search.go b/vendor/github.com/gophercloud/gophercloud/endpoint_search.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/endpoint_search.go rename to vendor/github.com/gophercloud/gophercloud/endpoint_search.go diff --git a/vendor/github.com/gophercloud/gophercloud/errors.go b/vendor/github.com/gophercloud/gophercloud/errors.go new file mode 100644 index 000000000000..a5fa68d6d55f --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/errors.go @@ -0,0 +1,453 @@ +package gophercloud + +import ( + "fmt" + "strings" +) + +// BaseError is an error type that all other error types embed. +type BaseError struct { + DefaultErrString string + Info string +} + +func (e BaseError) Error() string { + e.DefaultErrString = "An error occurred while executing a Gophercloud request." + return e.choseErrString() +} + +func (e BaseError) choseErrString() string { + if e.Info != "" { + return e.Info + } + return e.DefaultErrString +} + +// ErrMissingInput is the error when input is required in a particular +// situation but not provided by the user +type ErrMissingInput struct { + BaseError + Argument string +} + +func (e ErrMissingInput) Error() string { + e.DefaultErrString = fmt.Sprintf("Missing input for argument [%s]", e.Argument) + return e.choseErrString() +} + +// ErrInvalidInput is an error type used for most non-HTTP Gophercloud errors. +type ErrInvalidInput struct { + ErrMissingInput + Value interface{} +} + +func (e ErrInvalidInput) Error() string { + e.DefaultErrString = fmt.Sprintf("Invalid input provided for argument [%s]: [%+v]", e.Argument, e.Value) + return e.choseErrString() +} + +// ErrMissingEnvironmentVariable is the error when environment variable is required +// in a particular situation but not provided by the user +type ErrMissingEnvironmentVariable struct { + BaseError + EnvironmentVariable string +} + +func (e ErrMissingEnvironmentVariable) Error() string { + e.DefaultErrString = fmt.Sprintf("Missing environment variable [%s]", e.EnvironmentVariable) + return e.choseErrString() +} + +// ErrMissingAnyoneOfEnvironmentVariables is the error when anyone of the environment variables +// is required in a particular situation but not provided by the user +type ErrMissingAnyoneOfEnvironmentVariables struct { + BaseError + EnvironmentVariables []string +} + +func (e ErrMissingAnyoneOfEnvironmentVariables) Error() string { + e.DefaultErrString = fmt.Sprintf( + "Missing one of the following environment variables [%s]", + strings.Join(e.EnvironmentVariables, ", "), + ) + return e.choseErrString() +} + +// ErrUnexpectedResponseCode is returned by the Request method when a response code other than +// those listed in OkCodes is encountered. +type ErrUnexpectedResponseCode struct { + BaseError + URL string + Method string + Expected []int + Actual int + Body []byte +} + +func (e ErrUnexpectedResponseCode) Error() string { + e.DefaultErrString = fmt.Sprintf( + "Expected HTTP response code %v when accessing [%s %s], but got %d instead\n%s", + e.Expected, e.Method, e.URL, e.Actual, e.Body, + ) + return e.choseErrString() +} + +// ErrDefault400 is the default error type returned on a 400 HTTP response code. +type ErrDefault400 struct { + ErrUnexpectedResponseCode +} + +// ErrDefault401 is the default error type returned on a 401 HTTP response code. +type ErrDefault401 struct { + ErrUnexpectedResponseCode +} + +// ErrDefault403 is the default error type returned on a 403 HTTP response code. +type ErrDefault403 struct { + ErrUnexpectedResponseCode +} + +// ErrDefault404 is the default error type returned on a 404 HTTP response code. +type ErrDefault404 struct { + ErrUnexpectedResponseCode +} + +// ErrDefault405 is the default error type returned on a 405 HTTP response code. +type ErrDefault405 struct { + ErrUnexpectedResponseCode +} + +// ErrDefault408 is the default error type returned on a 408 HTTP response code. +type ErrDefault408 struct { + ErrUnexpectedResponseCode +} + +// ErrDefault429 is the default error type returned on a 429 HTTP response code. +type ErrDefault429 struct { + ErrUnexpectedResponseCode +} + +// ErrDefault500 is the default error type returned on a 500 HTTP response code. +type ErrDefault500 struct { + ErrUnexpectedResponseCode +} + +// ErrDefault503 is the default error type returned on a 503 HTTP response code. +type ErrDefault503 struct { + ErrUnexpectedResponseCode +} + +func (e ErrDefault400) Error() string { + e.DefaultErrString = fmt.Sprintf( + "Bad request with: [%s %s], error message: %s", + e.Method, e.URL, e.Body, + ) + return e.choseErrString() +} +func (e ErrDefault401) Error() string { + return "Authentication failed" +} +func (e ErrDefault403) Error() string { + e.DefaultErrString = fmt.Sprintf( + "Request forbidden: [%s %s], error message: %s", + e.Method, e.URL, e.Body, + ) + return e.choseErrString() +} +func (e ErrDefault404) Error() string { + return "Resource not found" +} +func (e ErrDefault405) Error() string { + return "Method not allowed" +} +func (e ErrDefault408) Error() string { + return "The server timed out waiting for the request" +} +func (e ErrDefault429) Error() string { + return "Too many requests have been sent in a given amount of time. Pause" + + " requests, wait up to one minute, and try again." +} +func (e ErrDefault500) Error() string { + return "Internal Server Error" +} +func (e ErrDefault503) Error() string { + return "The service is currently unable to handle the request due to a temporary" + + " overloading or maintenance. This is a temporary condition. Try again later." +} + +// Err400er is the interface resource error types implement to override the error message +// from a 400 error. +type Err400er interface { + Error400(ErrUnexpectedResponseCode) error +} + +// Err401er is the interface resource error types implement to override the error message +// from a 401 error. +type Err401er interface { + Error401(ErrUnexpectedResponseCode) error +} + +// Err403er is the interface resource error types implement to override the error message +// from a 403 error. +type Err403er interface { + Error403(ErrUnexpectedResponseCode) error +} + +// Err404er is the interface resource error types implement to override the error message +// from a 404 error. +type Err404er interface { + Error404(ErrUnexpectedResponseCode) error +} + +// Err405er is the interface resource error types implement to override the error message +// from a 405 error. +type Err405er interface { + Error405(ErrUnexpectedResponseCode) error +} + +// Err408er is the interface resource error types implement to override the error message +// from a 408 error. +type Err408er interface { + Error408(ErrUnexpectedResponseCode) error +} + +// Err429er is the interface resource error types implement to override the error message +// from a 429 error. +type Err429er interface { + Error429(ErrUnexpectedResponseCode) error +} + +// Err500er is the interface resource error types implement to override the error message +// from a 500 error. +type Err500er interface { + Error500(ErrUnexpectedResponseCode) error +} + +// Err503er is the interface resource error types implement to override the error message +// from a 503 error. +type Err503er interface { + Error503(ErrUnexpectedResponseCode) error +} + +// ErrTimeOut is the error type returned when an operations times out. +type ErrTimeOut struct { + BaseError +} + +func (e ErrTimeOut) Error() string { + e.DefaultErrString = "A time out occurred" + return e.choseErrString() +} + +// ErrUnableToReauthenticate is the error type returned when reauthentication fails. +type ErrUnableToReauthenticate struct { + BaseError + ErrOriginal error +} + +func (e ErrUnableToReauthenticate) Error() string { + e.DefaultErrString = fmt.Sprintf("Unable to re-authenticate: %s", e.ErrOriginal) + return e.choseErrString() +} + +// ErrErrorAfterReauthentication is the error type returned when reauthentication +// succeeds, but an error occurs afterword (usually an HTTP error). +type ErrErrorAfterReauthentication struct { + BaseError + ErrOriginal error +} + +func (e ErrErrorAfterReauthentication) Error() string { + e.DefaultErrString = fmt.Sprintf("Successfully re-authenticated, but got error executing request: %s", e.ErrOriginal) + return e.choseErrString() +} + +// ErrServiceNotFound is returned when no service in a service catalog matches +// the provided EndpointOpts. This is generally returned by provider service +// factory methods like "NewComputeV2()" and can mean that a service is not +// enabled for your account. +type ErrServiceNotFound struct { + BaseError +} + +func (e ErrServiceNotFound) Error() string { + e.DefaultErrString = "No suitable service could be found in the service catalog." + return e.choseErrString() +} + +// ErrEndpointNotFound is returned when no available endpoints match the +// provided EndpointOpts. This is also generally returned by provider service +// factory methods, and usually indicates that a region was specified +// incorrectly. +type ErrEndpointNotFound struct { + BaseError +} + +func (e ErrEndpointNotFound) Error() string { + e.DefaultErrString = "No suitable endpoint could be found in the service catalog." + return e.choseErrString() +} + +// ErrResourceNotFound is the error when trying to retrieve a resource's +// ID by name and the resource doesn't exist. +type ErrResourceNotFound struct { + BaseError + Name string + ResourceType string +} + +func (e ErrResourceNotFound) Error() string { + e.DefaultErrString = fmt.Sprintf("Unable to find %s with name %s", e.ResourceType, e.Name) + return e.choseErrString() +} + +// ErrMultipleResourcesFound is the error when trying to retrieve a resource's +// ID by name and multiple resources have the user-provided name. +type ErrMultipleResourcesFound struct { + BaseError + Name string + Count int + ResourceType string +} + +func (e ErrMultipleResourcesFound) Error() string { + e.DefaultErrString = fmt.Sprintf("Found %d %ss matching %s", e.Count, e.ResourceType, e.Name) + return e.choseErrString() +} + +// ErrUnexpectedType is the error when an unexpected type is encountered +type ErrUnexpectedType struct { + BaseError + Expected string + Actual string +} + +func (e ErrUnexpectedType) Error() string { + e.DefaultErrString = fmt.Sprintf("Expected %s but got %s", e.Expected, e.Actual) + return e.choseErrString() +} + +func unacceptedAttributeErr(attribute string) string { + return fmt.Sprintf("The base Identity V3 API does not accept authentication by %s", attribute) +} + +func redundantWithTokenErr(attribute string) string { + return fmt.Sprintf("%s may not be provided when authenticating with a TokenID", attribute) +} + +func redundantWithUserID(attribute string) string { + return fmt.Sprintf("%s may not be provided when authenticating with a UserID", attribute) +} + +// ErrAPIKeyProvided indicates that an APIKey was provided but can't be used. +type ErrAPIKeyProvided struct{ BaseError } + +func (e ErrAPIKeyProvided) Error() string { + return unacceptedAttributeErr("APIKey") +} + +// ErrTenantIDProvided indicates that a TenantID was provided but can't be used. +type ErrTenantIDProvided struct{ BaseError } + +func (e ErrTenantIDProvided) Error() string { + return unacceptedAttributeErr("TenantID") +} + +// ErrTenantNameProvided indicates that a TenantName was provided but can't be used. +type ErrTenantNameProvided struct{ BaseError } + +func (e ErrTenantNameProvided) Error() string { + return unacceptedAttributeErr("TenantName") +} + +// ErrUsernameWithToken indicates that a Username was provided, but token authentication is being used instead. +type ErrUsernameWithToken struct{ BaseError } + +func (e ErrUsernameWithToken) Error() string { + return redundantWithTokenErr("Username") +} + +// ErrUserIDWithToken indicates that a UserID was provided, but token authentication is being used instead. +type ErrUserIDWithToken struct{ BaseError } + +func (e ErrUserIDWithToken) Error() string { + return redundantWithTokenErr("UserID") +} + +// ErrDomainIDWithToken indicates that a DomainID was provided, but token authentication is being used instead. +type ErrDomainIDWithToken struct{ BaseError } + +func (e ErrDomainIDWithToken) Error() string { + return redundantWithTokenErr("DomainID") +} + +// ErrDomainNameWithToken indicates that a DomainName was provided, but token authentication is being used instead.s +type ErrDomainNameWithToken struct{ BaseError } + +func (e ErrDomainNameWithToken) Error() string { + return redundantWithTokenErr("DomainName") +} + +// ErrUsernameOrUserID indicates that neither username nor userID are specified, or both are at once. +type ErrUsernameOrUserID struct{ BaseError } + +func (e ErrUsernameOrUserID) Error() string { + return "Exactly one of Username and UserID must be provided for password authentication" +} + +// ErrDomainIDWithUserID indicates that a DomainID was provided, but unnecessary because a UserID is being used. +type ErrDomainIDWithUserID struct{ BaseError } + +func (e ErrDomainIDWithUserID) Error() string { + return redundantWithUserID("DomainID") +} + +// ErrDomainNameWithUserID indicates that a DomainName was provided, but unnecessary because a UserID is being used. +type ErrDomainNameWithUserID struct{ BaseError } + +func (e ErrDomainNameWithUserID) Error() string { + return redundantWithUserID("DomainName") +} + +// ErrDomainIDOrDomainName indicates that a username was provided, but no domain to scope it. +// It may also indicate that both a DomainID and a DomainName were provided at once. +type ErrDomainIDOrDomainName struct{ BaseError } + +func (e ErrDomainIDOrDomainName) Error() string { + return "You must provide exactly one of DomainID or DomainName to authenticate by Username" +} + +// ErrMissingPassword indicates that no password was provided and no token is available. +type ErrMissingPassword struct{ BaseError } + +func (e ErrMissingPassword) Error() string { + return "You must provide a password to authenticate" +} + +// ErrScopeDomainIDOrDomainName indicates that a domain ID or Name was required in a Scope, but not present. +type ErrScopeDomainIDOrDomainName struct{ BaseError } + +func (e ErrScopeDomainIDOrDomainName) Error() string { + return "You must provide exactly one of DomainID or DomainName in a Scope with ProjectName" +} + +// ErrScopeProjectIDOrProjectName indicates that both a ProjectID and a ProjectName were provided in a Scope. +type ErrScopeProjectIDOrProjectName struct{ BaseError } + +func (e ErrScopeProjectIDOrProjectName) Error() string { + return "You must provide at most one of ProjectID or ProjectName in a Scope" +} + +// ErrScopeProjectIDAlone indicates that a ProjectID was provided with other constraints in a Scope. +type ErrScopeProjectIDAlone struct{ BaseError } + +func (e ErrScopeProjectIDAlone) Error() string { + return "ProjectID must be supplied alone in a Scope" +} + +// ErrScopeEmpty indicates that no credentials were provided in a Scope. +type ErrScopeEmpty struct{ BaseError } + +func (e ErrScopeEmpty) Error() string { + return "You must provide either a Project or Domain in a Scope" +} diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/auth_env.go b/vendor/github.com/gophercloud/gophercloud/openstack/auth_env.go new file mode 100644 index 000000000000..994b5550c91e --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/openstack/auth_env.go @@ -0,0 +1,85 @@ +package openstack + +import ( + "os" + + "github.com/gophercloud/gophercloud" +) + +var nilOptions = gophercloud.AuthOptions{} + +/* +AuthOptionsFromEnv fills out an identity.AuthOptions structure with the +settings found on the various OpenStack OS_* environment variables. + +The following variables provide sources of truth: OS_AUTH_URL, OS_USERNAME, +OS_PASSWORD, OS_TENANT_ID, and OS_TENANT_NAME. + +Of these, OS_USERNAME, OS_PASSWORD, and OS_AUTH_URL must have settings, +or an error will result. OS_TENANT_ID, OS_TENANT_NAME, OS_PROJECT_ID, and +OS_PROJECT_NAME are optional. + +OS_TENANT_ID and OS_TENANT_NAME are mutually exclusive to OS_PROJECT_ID and +OS_PROJECT_NAME. If OS_PROJECT_ID and OS_PROJECT_NAME are set, they will +still be referred as "tenant" in Gophercloud. + +To use this function, first set the OS_* environment variables (for example, +by sourcing an `openrc` file), then: + + opts, err := openstack.AuthOptionsFromEnv() + provider, err := openstack.AuthenticatedClient(opts) +*/ +func AuthOptionsFromEnv() (gophercloud.AuthOptions, error) { + authURL := os.Getenv("OS_AUTH_URL") + username := os.Getenv("OS_USERNAME") + userID := os.Getenv("OS_USERID") + password := os.Getenv("OS_PASSWORD") + tenantID := os.Getenv("OS_TENANT_ID") + tenantName := os.Getenv("OS_TENANT_NAME") + domainID := os.Getenv("OS_DOMAIN_ID") + domainName := os.Getenv("OS_DOMAIN_NAME") + + // If OS_PROJECT_ID is set, overwrite tenantID with the value. + if v := os.Getenv("OS_PROJECT_ID"); v != "" { + tenantID = v + } + + // If OS_PROJECT_NAME is set, overwrite tenantName with the value. + if v := os.Getenv("OS_PROJECT_NAME"); v != "" { + tenantName = v + } + + if authURL == "" { + err := gophercloud.ErrMissingEnvironmentVariable{ + EnvironmentVariable: "OS_AUTH_URL", + } + return nilOptions, err + } + + if username == "" && userID == "" { + err := gophercloud.ErrMissingAnyoneOfEnvironmentVariables{ + EnvironmentVariables: []string{"OS_USERNAME", "OS_USERID"}, + } + return nilOptions, err + } + + if password == "" { + err := gophercloud.ErrMissingEnvironmentVariable{ + EnvironmentVariable: "OS_PASSWORD", + } + return nilOptions, err + } + + ao := gophercloud.AuthOptions{ + IdentityEndpoint: authURL, + UserID: userID, + Username: username, + Password: password, + TenantID: tenantID, + TenantName: tenantName, + DomainID: domainID, + DomainName: domainName, + } + + return ao, nil +} diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/client.go b/vendor/github.com/gophercloud/gophercloud/openstack/client.go new file mode 100644 index 000000000000..0859d9cb75ba --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/openstack/client.go @@ -0,0 +1,422 @@ +package openstack + +import ( + "fmt" + "reflect" + + "github.com/gophercloud/gophercloud" + tokens2 "github.com/gophercloud/gophercloud/openstack/identity/v2/tokens" + tokens3 "github.com/gophercloud/gophercloud/openstack/identity/v3/tokens" + "github.com/gophercloud/gophercloud/openstack/utils" +) + +const ( + // v2 represents Keystone v2. + // It should never increase beyond 2.0. + v2 = "v2.0" + + // v3 represents Keystone v3. + // The version can be anything from v3 to v3.x. + v3 = "v3" +) + +/* +NewClient prepares an unauthenticated ProviderClient instance. +Most users will probably prefer using the AuthenticatedClient function +instead. + +This is useful if you wish to explicitly control the version of the identity +service that's used for authentication explicitly, for example. + +A basic example of using this would be: + + ao, err := openstack.AuthOptionsFromEnv() + provider, err := openstack.NewClient(ao.IdentityEndpoint) + client, err := openstack.NewIdentityV3(provider, gophercloud.EndpointOpts{}) +*/ +func NewClient(endpoint string) (*gophercloud.ProviderClient, error) { + base, err := utils.BaseEndpoint(endpoint) + if err != nil { + return nil, err + } + + endpoint = gophercloud.NormalizeURL(endpoint) + base = gophercloud.NormalizeURL(base) + + p := new(gophercloud.ProviderClient) + p.IdentityBase = base + p.IdentityEndpoint = endpoint + p.UseTokenLock() + + return p, nil +} + +/* +AuthenticatedClient logs in to an OpenStack cloud found at the identity endpoint +specified by the options, acquires a token, and returns a Provider Client +instance that's ready to operate. + +If the full path to a versioned identity endpoint was specified (example: +http://example.com:5000/v3), that path will be used as the endpoint to query. + +If a versionless endpoint was specified (example: http://example.com:5000/), +the endpoint will be queried to determine which versions of the identity service +are available, then chooses the most recent or most supported version. + +Example: + + ao, err := openstack.AuthOptionsFromEnv() + provider, err := openstack.AuthenticatedClient(ao) + client, err := openstack.NewNetworkV2(client, gophercloud.EndpointOpts{ + Region: os.Getenv("OS_REGION_NAME"), + }) +*/ +func AuthenticatedClient(options gophercloud.AuthOptions) (*gophercloud.ProviderClient, error) { + client, err := NewClient(options.IdentityEndpoint) + if err != nil { + return nil, err + } + + err = Authenticate(client, options) + if err != nil { + return nil, err + } + return client, nil +} + +// Authenticate or re-authenticate against the most recent identity service +// supported at the provided endpoint. +func Authenticate(client *gophercloud.ProviderClient, options gophercloud.AuthOptions) error { + versions := []*utils.Version{ + {ID: v2, Priority: 20, Suffix: "/v2.0/"}, + {ID: v3, Priority: 30, Suffix: "/v3/"}, + } + + chosen, endpoint, err := utils.ChooseVersion(client, versions) + if err != nil { + return err + } + + switch chosen.ID { + case v2: + return v2auth(client, endpoint, options, gophercloud.EndpointOpts{}) + case v3: + return v3auth(client, endpoint, &options, gophercloud.EndpointOpts{}) + default: + // The switch statement must be out of date from the versions list. + return fmt.Errorf("Unrecognized identity version: %s", chosen.ID) + } +} + +// AuthenticateV2 explicitly authenticates against the identity v2 endpoint. +func AuthenticateV2(client *gophercloud.ProviderClient, options gophercloud.AuthOptions, eo gophercloud.EndpointOpts) error { + return v2auth(client, "", options, eo) +} + +func v2auth(client *gophercloud.ProviderClient, endpoint string, options gophercloud.AuthOptions, eo gophercloud.EndpointOpts) error { + v2Client, err := NewIdentityV2(client, eo) + if err != nil { + return err + } + + if endpoint != "" { + v2Client.Endpoint = endpoint + } + + v2Opts := tokens2.AuthOptions{ + IdentityEndpoint: options.IdentityEndpoint, + Username: options.Username, + Password: options.Password, + TenantID: options.TenantID, + TenantName: options.TenantName, + AllowReauth: options.AllowReauth, + TokenID: options.TokenID, + } + + result := tokens2.Create(v2Client, v2Opts) + + token, err := result.ExtractToken() + if err != nil { + return err + } + + catalog, err := result.ExtractServiceCatalog() + if err != nil { + return err + } + + if options.AllowReauth { + // here we're creating a throw-away client (tac). it's a copy of the user's provider client, but + // with the token and reauth func zeroed out. combined with setting `AllowReauth` to `false`, + // this should retry authentication only once + tac := *client + tac.ReauthFunc = nil + tac.TokenID = "" + tao := options + tao.AllowReauth = false + client.ReauthFunc = func() error { + err := v2auth(&tac, endpoint, tao, eo) + if err != nil { + return err + } + client.TokenID = tac.TokenID + return nil + } + } + client.TokenID = token.ID + client.EndpointLocator = func(opts gophercloud.EndpointOpts) (string, error) { + return V2EndpointURL(catalog, opts) + } + + return nil +} + +// AuthenticateV3 explicitly authenticates against the identity v3 service. +func AuthenticateV3(client *gophercloud.ProviderClient, options tokens3.AuthOptionsBuilder, eo gophercloud.EndpointOpts) error { + return v3auth(client, "", options, eo) +} + +func v3auth(client *gophercloud.ProviderClient, endpoint string, opts tokens3.AuthOptionsBuilder, eo gophercloud.EndpointOpts) error { + // Override the generated service endpoint with the one returned by the version endpoint. + v3Client, err := NewIdentityV3(client, eo) + if err != nil { + return err + } + + if endpoint != "" { + v3Client.Endpoint = endpoint + } + + result := tokens3.Create(v3Client, opts) + + token, err := result.ExtractToken() + if err != nil { + return err + } + + catalog, err := result.ExtractServiceCatalog() + if err != nil { + return err + } + + client.TokenID = token.ID + + if opts.CanReauth() { + // here we're creating a throw-away client (tac). it's a copy of the user's provider client, but + // with the token and reauth func zeroed out. combined with setting `AllowReauth` to `false`, + // this should retry authentication only once + tac := *client + tac.ReauthFunc = nil + tac.TokenID = "" + var tao tokens3.AuthOptionsBuilder + switch ot := opts.(type) { + case *gophercloud.AuthOptions: + o := *ot + o.AllowReauth = false + tao = &o + case *tokens3.AuthOptions: + o := *ot + o.AllowReauth = false + tao = &o + default: + tao = opts + } + client.ReauthFunc = func() error { + err := v3auth(&tac, endpoint, tao, eo) + if err != nil { + return err + } + client.TokenID = tac.TokenID + return nil + } + } + client.EndpointLocator = func(opts gophercloud.EndpointOpts) (string, error) { + return V3EndpointURL(catalog, opts) + } + + return nil +} + +// NewIdentityV2 creates a ServiceClient that may be used to interact with the +// v2 identity service. +func NewIdentityV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + endpoint := client.IdentityBase + "v2.0/" + clientType := "identity" + var err error + if !reflect.DeepEqual(eo, gophercloud.EndpointOpts{}) { + eo.ApplyDefaults(clientType) + endpoint, err = client.EndpointLocator(eo) + if err != nil { + return nil, err + } + } + + return &gophercloud.ServiceClient{ + ProviderClient: client, + Endpoint: endpoint, + Type: clientType, + }, nil +} + +// NewIdentityV3 creates a ServiceClient that may be used to access the v3 +// identity service. +func NewIdentityV3(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + endpoint := client.IdentityBase + "v3/" + clientType := "identity" + var err error + if !reflect.DeepEqual(eo, gophercloud.EndpointOpts{}) { + eo.ApplyDefaults(clientType) + endpoint, err = client.EndpointLocator(eo) + if err != nil { + return nil, err + } + } + + // Ensure endpoint still has a suffix of v3. + // This is because EndpointLocator might have found a versionless + // endpoint or the published endpoint is still /v2.0. In both + // cases, we need to fix the endpoint to point to /v3. + base, err := utils.BaseEndpoint(endpoint) + if err != nil { + return nil, err + } + + base = gophercloud.NormalizeURL(base) + + endpoint = base + "v3/" + + return &gophercloud.ServiceClient{ + ProviderClient: client, + Endpoint: endpoint, + Type: clientType, + }, nil +} + +func initClientOpts(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts, clientType string) (*gophercloud.ServiceClient, error) { + sc := new(gophercloud.ServiceClient) + eo.ApplyDefaults(clientType) + url, err := client.EndpointLocator(eo) + if err != nil { + return sc, err + } + sc.ProviderClient = client + sc.Endpoint = url + sc.Type = clientType + return sc, nil +} + +// NewObjectStorageV1 creates a ServiceClient that may be used with the v1 +// object storage package. +func NewObjectStorageV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + return initClientOpts(client, eo, "object-store") +} + +// NewComputeV2 creates a ServiceClient that may be used with the v2 compute +// package. +func NewComputeV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + return initClientOpts(client, eo, "compute") +} + +// NewNetworkV2 creates a ServiceClient that may be used with the v2 network +// package. +func NewNetworkV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + sc, err := initClientOpts(client, eo, "network") + sc.ResourceBase = sc.Endpoint + "v2.0/" + return sc, err +} + +// NewBlockStorageV1 creates a ServiceClient that may be used to access the v1 +// block storage service. +func NewBlockStorageV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + return initClientOpts(client, eo, "volume") +} + +// NewBlockStorageV2 creates a ServiceClient that may be used to access the v2 +// block storage service. +func NewBlockStorageV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + return initClientOpts(client, eo, "volumev2") +} + +// NewBlockStorageV3 creates a ServiceClient that may be used to access the v3 block storage service. +func NewBlockStorageV3(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + return initClientOpts(client, eo, "volumev3") +} + +// NewSharedFileSystemV2 creates a ServiceClient that may be used to access the v2 shared file system service. +func NewSharedFileSystemV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + return initClientOpts(client, eo, "sharev2") +} + +// NewCDNV1 creates a ServiceClient that may be used to access the OpenStack v1 +// CDN service. +func NewCDNV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + return initClientOpts(client, eo, "cdn") +} + +// NewOrchestrationV1 creates a ServiceClient that may be used to access the v1 +// orchestration service. +func NewOrchestrationV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + return initClientOpts(client, eo, "orchestration") +} + +// NewDBV1 creates a ServiceClient that may be used to access the v1 DB service. +func NewDBV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + return initClientOpts(client, eo, "database") +} + +// NewDNSV2 creates a ServiceClient that may be used to access the v2 DNS +// service. +func NewDNSV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + sc, err := initClientOpts(client, eo, "dns") + sc.ResourceBase = sc.Endpoint + "v2/" + return sc, err +} + +// NewImageServiceV2 creates a ServiceClient that may be used to access the v2 +// image service. +func NewImageServiceV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + sc, err := initClientOpts(client, eo, "image") + sc.ResourceBase = sc.Endpoint + "v2/" + return sc, err +} + +// NewLoadBalancerV2 creates a ServiceClient that may be used to access the v2 +// load balancer service. +func NewLoadBalancerV2(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + sc, err := initClientOpts(client, eo, "load-balancer") + sc.ResourceBase = sc.Endpoint + "v2.0/" + return sc, err +} + +// NewClusteringV1 creates a ServiceClient that may be used with the v1 clustering +// package. +func NewClusteringV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + return initClientOpts(client, eo, "clustering") +} + +// NewMessagingV2 creates a ServiceClient that may be used with the v2 messaging +// service. +func NewMessagingV2(client *gophercloud.ProviderClient, clientID string, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + sc, err := initClientOpts(client, eo, "messaging") + sc.MoreHeaders = map[string]string{"Client-ID": clientID} + return sc, err +} + +// NewContainerV1 creates a ServiceClient that may be used with v1 container package +func NewContainerV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + return initClientOpts(client, eo, "container") +} + +// NewKeyManagerV1 creates a ServiceClient that may be used with the v1 key +// manager service. +func NewKeyManagerV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + sc, err := initClientOpts(client, eo, "key-manager") + sc.ResourceBase = sc.Endpoint + "v1/" + return sc, err +} + +// NewContainerInfraV1 creates a ServiceClient that may be used with the v1 container infra management +// package. +func NewContainerInfraV1(client *gophercloud.ProviderClient, eo gophercloud.EndpointOpts) (*gophercloud.ServiceClient, error) { + return initClientOpts(client, eo, "container-infra") +} diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/doc.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/doc.go new file mode 100644 index 000000000000..34d8764fadb2 --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/doc.go @@ -0,0 +1,137 @@ +/* +Package flavors provides information and interaction with the flavor API +in the OpenStack Compute service. + +A flavor is an available hardware configuration for a server. Each flavor +has a unique combination of disk space, memory capacity and priority for CPU +time. + +Example to List Flavors + + listOpts := flavors.ListOpts{ + AccessType: flavors.PublicAccess, + } + + allPages, err := flavors.ListDetail(computeClient, listOpts).AllPages() + if err != nil { + panic(err) + } + + allFlavors, err := flavors.ExtractFlavors(allPages) + if err != nil { + panic(err) + } + + for _, flavor := range allFlavors { + fmt.Printf("%+v\n", flavor) + } + +Example to Create a Flavor + + createOpts := flavors.CreateOpts{ + ID: "1", + Name: "m1.tiny", + Disk: gophercloud.IntToPointer(1), + RAM: 512, + VCPUs: 1, + RxTxFactor: 1.0, + } + + flavor, err := flavors.Create(computeClient, createOpts).Extract() + if err != nil { + panic(err) + } + +Example to List Flavor Access + + flavorID := "e91758d6-a54a-4778-ad72-0c73a1cb695b" + + allPages, err := flavors.ListAccesses(computeClient, flavorID).AllPages() + if err != nil { + panic(err) + } + + allAccesses, err := flavors.ExtractAccesses(allPages) + if err != nil { + panic(err) + } + + for _, access := range allAccesses { + fmt.Printf("%+v", access) + } + +Example to Grant Access to a Flavor + + flavorID := "e91758d6-a54a-4778-ad72-0c73a1cb695b" + + accessOpts := flavors.AddAccessOpts{ + Tenant: "15153a0979884b59b0592248ef947921", + } + + accessList, err := flavors.AddAccess(computeClient, flavor.ID, accessOpts).Extract() + if err != nil { + panic(err) + } + +Example to Remove/Revoke Access to a Flavor + + flavorID := "e91758d6-a54a-4778-ad72-0c73a1cb695b" + + accessOpts := flavors.RemoveAccessOpts{ + Tenant: "15153a0979884b59b0592248ef947921", + } + + accessList, err := flavors.RemoveAccess(computeClient, flavor.ID, accessOpts).Extract() + if err != nil { + panic(err) + } + +Example to Create Extra Specs for a Flavor + + flavorID := "e91758d6-a54a-4778-ad72-0c73a1cb695b" + + createOpts := flavors.ExtraSpecsOpts{ + "hw:cpu_policy": "CPU-POLICY", + "hw:cpu_thread_policy": "CPU-THREAD-POLICY", + } + createdExtraSpecs, err := flavors.CreateExtraSpecs(computeClient, flavorID, createOpts).Extract() + if err != nil { + panic(err) + } + + fmt.Printf("%+v", createdExtraSpecs) + +Example to Get Extra Specs for a Flavor + + flavorID := "e91758d6-a54a-4778-ad72-0c73a1cb695b" + + extraSpecs, err := flavors.ListExtraSpecs(computeClient, flavorID).Extract() + if err != nil { + panic(err) + } + + fmt.Printf("%+v", extraSpecs) + +Example to Update Extra Specs for a Flavor + + flavorID := "e91758d6-a54a-4778-ad72-0c73a1cb695b" + + updateOpts := flavors.ExtraSpecsOpts{ + "hw:cpu_thread_policy": "CPU-THREAD-POLICY-UPDATED", + } + updatedExtraSpec, err := flavors.UpdateExtraSpec(computeClient, flavorID, updateOpts).Extract() + if err != nil { + panic(err) + } + + fmt.Printf("%+v", updatedExtraSpec) + +Example to Delete an Extra Spec for a Flavor + + flavorID := "e91758d6-a54a-4778-ad72-0c73a1cb695b" + err := flavors.DeleteExtraSpec(computeClient, flavorID, "hw:cpu_thread_policy").ExtractErr() + if err != nil { + panic(err) + } +*/ +package flavors diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/requests.go new file mode 100644 index 000000000000..539019e90d37 --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/requests.go @@ -0,0 +1,357 @@ +package flavors + +import ( + "github.com/gophercloud/gophercloud" + "github.com/gophercloud/gophercloud/pagination" +) + +// ListOptsBuilder allows extensions to add additional parameters to the +// List request. +type ListOptsBuilder interface { + ToFlavorListQuery() (string, error) +} + +/* + AccessType maps to OpenStack's Flavor.is_public field. Although the is_public + field is boolean, the request options are ternary, which is why AccessType is + a string. The following values are allowed: + + The AccessType arguement is optional, and if it is not supplied, OpenStack + returns the PublicAccess flavors. +*/ +type AccessType string + +const ( + // PublicAccess returns public flavors and private flavors associated with + // that project. + PublicAccess AccessType = "true" + + // PrivateAccess (admin only) returns private flavors, across all projects. + PrivateAccess AccessType = "false" + + // AllAccess (admin only) returns public and private flavors across all + // projects. + AllAccess AccessType = "None" +) + +/* + ListOpts filters the results returned by the List() function. + For example, a flavor with a minDisk field of 10 will not be returned if you + specify MinDisk set to 20. + + Typically, software will use the last ID of the previous call to List to set + the Marker for the current call. +*/ +type ListOpts struct { + // ChangesSince, if provided, instructs List to return only those things which + // have changed since the timestamp provided. + ChangesSince string `q:"changes-since"` + + // MinDisk and MinRAM, if provided, elides flavors which do not meet your + // criteria. + MinDisk int `q:"minDisk"` + MinRAM int `q:"minRam"` + + // SortDir allows to select sort direction. + // It can be "asc" or "desc" (default). + SortDir string `q:"sort_dir"` + + // SortKey allows to sort by one of the flavors attributes. + // Default is flavorid. + SortKey string `q:"sort_key"` + + // Marker and Limit control paging. + // Marker instructs List where to start listing from. + Marker string `q:"marker"` + + // Limit instructs List to refrain from sending excessively large lists of + // flavors. + Limit int `q:"limit"` + + // AccessType, if provided, instructs List which set of flavors to return. + // If IsPublic not provided, flavors for the current project are returned. + AccessType AccessType `q:"is_public"` +} + +// ToFlavorListQuery formats a ListOpts into a query string. +func (opts ListOpts) ToFlavorListQuery() (string, error) { + q, err := gophercloud.BuildQueryString(opts) + return q.String(), err +} + +// ListDetail instructs OpenStack to provide a list of flavors. +// You may provide criteria by which List curtails its results for easier +// processing. +func ListDetail(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager { + url := listURL(client) + if opts != nil { + query, err := opts.ToFlavorListQuery() + if err != nil { + return pagination.Pager{Err: err} + } + url += query + } + return pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page { + return FlavorPage{pagination.LinkedPageBase{PageResult: r}} + }) +} + +type CreateOptsBuilder interface { + ToFlavorCreateMap() (map[string]interface{}, error) +} + +// CreateOpts specifies parameters used for creating a flavor. +type CreateOpts struct { + // Name is the name of the flavor. + Name string `json:"name" required:"true"` + + // RAM is the memory of the flavor, measured in MB. + RAM int `json:"ram" required:"true"` + + // VCPUs is the number of vcpus for the flavor. + VCPUs int `json:"vcpus" required:"true"` + + // Disk the amount of root disk space, measured in GB. + Disk *int `json:"disk" required:"true"` + + // ID is a unique ID for the flavor. + ID string `json:"id,omitempty"` + + // Swap is the amount of swap space for the flavor, measured in MB. + Swap *int `json:"swap,omitempty"` + + // RxTxFactor alters the network bandwidth of a flavor. + RxTxFactor float64 `json:"rxtx_factor,omitempty"` + + // IsPublic flags a flavor as being available to all projects or not. + IsPublic *bool `json:"os-flavor-access:is_public,omitempty"` + + // Ephemeral is the amount of ephemeral disk space, measured in GB. + Ephemeral *int `json:"OS-FLV-EXT-DATA:ephemeral,omitempty"` +} + +// ToFlavorCreateMap constructs a request body from CreateOpts. +func (opts CreateOpts) ToFlavorCreateMap() (map[string]interface{}, error) { + return gophercloud.BuildRequestBody(opts, "flavor") +} + +// Create requests the creation of a new flavor. +func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) { + b, err := opts.ToFlavorCreateMap() + if err != nil { + r.Err = err + return + } + _, r.Err = client.Post(createURL(client), b, &r.Body, &gophercloud.RequestOpts{ + OkCodes: []int{200, 201}, + }) + return +} + +// Get retrieves details of a single flavor. Use ExtractFlavor to convert its +// result into a Flavor. +func Get(client *gophercloud.ServiceClient, id string) (r GetResult) { + _, r.Err = client.Get(getURL(client, id), &r.Body, nil) + return +} + +// Delete deletes the specified flavor ID. +func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) { + _, r.Err = client.Delete(deleteURL(client, id), nil) + return +} + +// ListAccesses retrieves the tenants which have access to a flavor. +func ListAccesses(client *gophercloud.ServiceClient, id string) pagination.Pager { + url := accessURL(client, id) + + return pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page { + return AccessPage{pagination.SinglePageBase(r)} + }) +} + +// AddAccessOptsBuilder allows extensions to add additional parameters to the +// AddAccess requests. +type AddAccessOptsBuilder interface { + ToFlavorAddAccessMap() (map[string]interface{}, error) +} + +// AddAccessOpts represents options for adding access to a flavor. +type AddAccessOpts struct { + // Tenant is the project/tenant ID to grant access. + Tenant string `json:"tenant"` +} + +// ToFlavorAddAccessMap constructs a request body from AddAccessOpts. +func (opts AddAccessOpts) ToFlavorAddAccessMap() (map[string]interface{}, error) { + return gophercloud.BuildRequestBody(opts, "addTenantAccess") +} + +// AddAccess grants a tenant/project access to a flavor. +func AddAccess(client *gophercloud.ServiceClient, id string, opts AddAccessOptsBuilder) (r AddAccessResult) { + b, err := opts.ToFlavorAddAccessMap() + if err != nil { + r.Err = err + return + } + _, r.Err = client.Post(accessActionURL(client, id), b, &r.Body, &gophercloud.RequestOpts{ + OkCodes: []int{200}, + }) + return +} + +// RemoveAccessOptsBuilder allows extensions to add additional parameters to the +// RemoveAccess requests. +type RemoveAccessOptsBuilder interface { + ToFlavorRemoveAccessMap() (map[string]interface{}, error) +} + +// RemoveAccessOpts represents options for removing access to a flavor. +type RemoveAccessOpts struct { + // Tenant is the project/tenant ID to grant access. + Tenant string `json:"tenant"` +} + +// ToFlavorRemoveAccessMap constructs a request body from RemoveAccessOpts. +func (opts RemoveAccessOpts) ToFlavorRemoveAccessMap() (map[string]interface{}, error) { + return gophercloud.BuildRequestBody(opts, "removeTenantAccess") +} + +// RemoveAccess removes/revokes a tenant/project access to a flavor. +func RemoveAccess(client *gophercloud.ServiceClient, id string, opts RemoveAccessOptsBuilder) (r RemoveAccessResult) { + b, err := opts.ToFlavorRemoveAccessMap() + if err != nil { + r.Err = err + return + } + _, r.Err = client.Post(accessActionURL(client, id), b, &r.Body, &gophercloud.RequestOpts{ + OkCodes: []int{200}, + }) + return +} + +// ExtraSpecs requests all the extra-specs for the given flavor ID. +func ListExtraSpecs(client *gophercloud.ServiceClient, flavorID string) (r ListExtraSpecsResult) { + _, r.Err = client.Get(extraSpecsListURL(client, flavorID), &r.Body, nil) + return +} + +func GetExtraSpec(client *gophercloud.ServiceClient, flavorID string, key string) (r GetExtraSpecResult) { + _, r.Err = client.Get(extraSpecsGetURL(client, flavorID, key), &r.Body, nil) + return +} + +// CreateExtraSpecsOptsBuilder allows extensions to add additional parameters to the +// CreateExtraSpecs requests. +type CreateExtraSpecsOptsBuilder interface { + ToFlavorExtraSpecsCreateMap() (map[string]interface{}, error) +} + +// ExtraSpecsOpts is a map that contains key-value pairs. +type ExtraSpecsOpts map[string]string + +// ToFlavorExtraSpecsCreateMap assembles a body for a Create request based on +// the contents of ExtraSpecsOpts. +func (opts ExtraSpecsOpts) ToFlavorExtraSpecsCreateMap() (map[string]interface{}, error) { + return map[string]interface{}{"extra_specs": opts}, nil +} + +// CreateExtraSpecs will create or update the extra-specs key-value pairs for +// the specified Flavor. +func CreateExtraSpecs(client *gophercloud.ServiceClient, flavorID string, opts CreateExtraSpecsOptsBuilder) (r CreateExtraSpecsResult) { + b, err := opts.ToFlavorExtraSpecsCreateMap() + if err != nil { + r.Err = err + return + } + _, r.Err = client.Post(extraSpecsCreateURL(client, flavorID), b, &r.Body, &gophercloud.RequestOpts{ + OkCodes: []int{200}, + }) + return +} + +// UpdateExtraSpecOptsBuilder allows extensions to add additional parameters to +// the Update request. +type UpdateExtraSpecOptsBuilder interface { + ToFlavorExtraSpecUpdateMap() (map[string]string, string, error) +} + +// ToFlavorExtraSpecUpdateMap assembles a body for an Update request based on +// the contents of a ExtraSpecOpts. +func (opts ExtraSpecsOpts) ToFlavorExtraSpecUpdateMap() (map[string]string, string, error) { + if len(opts) != 1 { + err := gophercloud.ErrInvalidInput{} + err.Argument = "flavors.ExtraSpecOpts" + err.Info = "Must have 1 and only one key-value pair" + return nil, "", err + } + + var key string + for k := range opts { + key = k + } + + return opts, key, nil +} + +// UpdateExtraSpec will updates the value of the specified flavor's extra spec +// for the key in opts. +func UpdateExtraSpec(client *gophercloud.ServiceClient, flavorID string, opts UpdateExtraSpecOptsBuilder) (r UpdateExtraSpecResult) { + b, key, err := opts.ToFlavorExtraSpecUpdateMap() + if err != nil { + r.Err = err + return + } + _, r.Err = client.Put(extraSpecUpdateURL(client, flavorID, key), b, &r.Body, &gophercloud.RequestOpts{ + OkCodes: []int{200}, + }) + return +} + +// DeleteExtraSpec will delete the key-value pair with the given key for the given +// flavor ID. +func DeleteExtraSpec(client *gophercloud.ServiceClient, flavorID, key string) (r DeleteExtraSpecResult) { + _, r.Err = client.Delete(extraSpecDeleteURL(client, flavorID, key), &gophercloud.RequestOpts{ + OkCodes: []int{200}, + }) + return +} + +// IDFromName is a convienience function that returns a flavor's ID given its +// name. +func IDFromName(client *gophercloud.ServiceClient, name string) (string, error) { + count := 0 + id := "" + allPages, err := ListDetail(client, nil).AllPages() + if err != nil { + return "", err + } + + all, err := ExtractFlavors(allPages) + if err != nil { + return "", err + } + + for _, f := range all { + if f.Name == name { + count++ + id = f.ID + } + } + + switch count { + case 0: + err := &gophercloud.ErrResourceNotFound{} + err.ResourceType = "flavor" + err.Name = name + return "", err + case 1: + return id, nil + default: + err := &gophercloud.ErrMultipleResourcesFound{} + err.ResourceType = "flavor" + err.Name = name + err.Count = count + return "", err + } +} diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/results.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/results.go new file mode 100644 index 000000000000..92fe1b1809d4 --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/results.go @@ -0,0 +1,252 @@ +package flavors + +import ( + "encoding/json" + "strconv" + + "github.com/gophercloud/gophercloud" + "github.com/gophercloud/gophercloud/pagination" +) + +type commonResult struct { + gophercloud.Result +} + +// CreateResult is the response of a Get operations. Call its Extract method to +// interpret it as a Flavor. +type CreateResult struct { + commonResult +} + +// GetResult is the response of a Get operations. Call its Extract method to +// interpret it as a Flavor. +type GetResult struct { + commonResult +} + +// DeleteResult is the result from a Delete operation. Call its ExtractErr +// method to determine if the call succeeded or failed. +type DeleteResult struct { + gophercloud.ErrResult +} + +// Extract provides access to the individual Flavor returned by the Get and +// Create functions. +func (r commonResult) Extract() (*Flavor, error) { + var s struct { + Flavor *Flavor `json:"flavor"` + } + err := r.ExtractInto(&s) + return s.Flavor, err +} + +// Flavor represent (virtual) hardware configurations for server resources +// in a region. +type Flavor struct { + // ID is the flavor's unique ID. + ID string `json:"id"` + + // Disk is the amount of root disk, measured in GB. + Disk int `json:"disk"` + + // RAM is the amount of memory, measured in MB. + RAM int `json:"ram"` + + // Name is the name of the flavor. + Name string `json:"name"` + + // RxTxFactor describes bandwidth alterations of the flavor. + RxTxFactor float64 `json:"rxtx_factor"` + + // Swap is the amount of swap space, measured in MB. + Swap int `json:"-"` + + // VCPUs indicates how many (virtual) CPUs are available for this flavor. + VCPUs int `json:"vcpus"` + + // IsPublic indicates whether the flavor is public. + IsPublic bool `json:"os-flavor-access:is_public"` + + // Ephemeral is the amount of ephemeral disk space, measured in GB. + Ephemeral int `json:"OS-FLV-EXT-DATA:ephemeral"` +} + +func (r *Flavor) UnmarshalJSON(b []byte) error { + type tmp Flavor + var s struct { + tmp + Swap interface{} `json:"swap"` + } + err := json.Unmarshal(b, &s) + if err != nil { + return err + } + + *r = Flavor(s.tmp) + + switch t := s.Swap.(type) { + case float64: + r.Swap = int(t) + case string: + switch t { + case "": + r.Swap = 0 + default: + swap, err := strconv.ParseFloat(t, 64) + if err != nil { + return err + } + r.Swap = int(swap) + } + } + + return nil +} + +// FlavorPage contains a single page of all flavors from a ListDetails call. +type FlavorPage struct { + pagination.LinkedPageBase +} + +// IsEmpty determines if a FlavorPage contains any results. +func (page FlavorPage) IsEmpty() (bool, error) { + flavors, err := ExtractFlavors(page) + return len(flavors) == 0, err +} + +// NextPageURL uses the response's embedded link reference to navigate to the +// next page of results. +func (page FlavorPage) NextPageURL() (string, error) { + var s struct { + Links []gophercloud.Link `json:"flavors_links"` + } + err := page.ExtractInto(&s) + if err != nil { + return "", err + } + return gophercloud.ExtractNextURL(s.Links) +} + +// ExtractFlavors provides access to the list of flavors in a page acquired +// from the ListDetail operation. +func ExtractFlavors(r pagination.Page) ([]Flavor, error) { + var s struct { + Flavors []Flavor `json:"flavors"` + } + err := (r.(FlavorPage)).ExtractInto(&s) + return s.Flavors, err +} + +// AccessPage contains a single page of all FlavorAccess entries for a flavor. +type AccessPage struct { + pagination.SinglePageBase +} + +// IsEmpty indicates whether an AccessPage is empty. +func (page AccessPage) IsEmpty() (bool, error) { + v, err := ExtractAccesses(page) + return len(v) == 0, err +} + +// ExtractAccesses interprets a page of results as a slice of FlavorAccess. +func ExtractAccesses(r pagination.Page) ([]FlavorAccess, error) { + var s struct { + FlavorAccesses []FlavorAccess `json:"flavor_access"` + } + err := (r.(AccessPage)).ExtractInto(&s) + return s.FlavorAccesses, err +} + +type accessResult struct { + gophercloud.Result +} + +// AddAccessResult is the response of an AddAccess operation. Call its +// Extract method to interpret it as a slice of FlavorAccess. +type AddAccessResult struct { + accessResult +} + +// RemoveAccessResult is the response of a RemoveAccess operation. Call its +// Extract method to interpret it as a slice of FlavorAccess. +type RemoveAccessResult struct { + accessResult +} + +// Extract provides access to the result of an access create or delete. +// The result will be all accesses that the flavor has. +func (r accessResult) Extract() ([]FlavorAccess, error) { + var s struct { + FlavorAccesses []FlavorAccess `json:"flavor_access"` + } + err := r.ExtractInto(&s) + return s.FlavorAccesses, err +} + +// FlavorAccess represents an ACL of tenant access to a specific Flavor. +type FlavorAccess struct { + // FlavorID is the unique ID of the flavor. + FlavorID string `json:"flavor_id"` + + // TenantID is the unique ID of the tenant. + TenantID string `json:"tenant_id"` +} + +// Extract interprets any extraSpecsResult as ExtraSpecs, if possible. +func (r extraSpecsResult) Extract() (map[string]string, error) { + var s struct { + ExtraSpecs map[string]string `json:"extra_specs"` + } + err := r.ExtractInto(&s) + return s.ExtraSpecs, err +} + +// extraSpecsResult contains the result of a call for (potentially) multiple +// key-value pairs. Call its Extract method to interpret it as a +// map[string]interface. +type extraSpecsResult struct { + gophercloud.Result +} + +// ListExtraSpecsResult contains the result of a Get operation. Call its Extract +// method to interpret it as a map[string]interface. +type ListExtraSpecsResult struct { + extraSpecsResult +} + +// CreateExtraSpecResult contains the result of a Create operation. Call its +// Extract method to interpret it as a map[string]interface. +type CreateExtraSpecsResult struct { + extraSpecsResult +} + +// extraSpecResult contains the result of a call for individual a single +// key-value pair. +type extraSpecResult struct { + gophercloud.Result +} + +// GetExtraSpecResult contains the result of a Get operation. Call its Extract +// method to interpret it as a map[string]interface. +type GetExtraSpecResult struct { + extraSpecResult +} + +// UpdateExtraSpecResult contains the result of an Update operation. Call its +// Extract method to interpret it as a map[string]interface. +type UpdateExtraSpecResult struct { + extraSpecResult +} + +// DeleteExtraSpecResult contains the result of a Delete operation. Call its +// ExtractErr method to determine if the call succeeded or failed. +type DeleteExtraSpecResult struct { + gophercloud.ErrResult +} + +// Extract interprets any extraSpecResult as an ExtraSpec, if possible. +func (r extraSpecResult) Extract() (map[string]string, error) { + var s map[string]string + err := r.ExtractInto(&s) + return s, err +} diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/urls.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/urls.go new file mode 100644 index 000000000000..8620dd78ad0a --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/flavors/urls.go @@ -0,0 +1,49 @@ +package flavors + +import ( + "github.com/gophercloud/gophercloud" +) + +func getURL(client *gophercloud.ServiceClient, id string) string { + return client.ServiceURL("flavors", id) +} + +func listURL(client *gophercloud.ServiceClient) string { + return client.ServiceURL("flavors", "detail") +} + +func createURL(client *gophercloud.ServiceClient) string { + return client.ServiceURL("flavors") +} + +func deleteURL(client *gophercloud.ServiceClient, id string) string { + return client.ServiceURL("flavors", id) +} + +func accessURL(client *gophercloud.ServiceClient, id string) string { + return client.ServiceURL("flavors", id, "os-flavor-access") +} + +func accessActionURL(client *gophercloud.ServiceClient, id string) string { + return client.ServiceURL("flavors", id, "action") +} + +func extraSpecsListURL(client *gophercloud.ServiceClient, id string) string { + return client.ServiceURL("flavors", id, "os-extra_specs") +} + +func extraSpecsGetURL(client *gophercloud.ServiceClient, id, key string) string { + return client.ServiceURL("flavors", id, "os-extra_specs", key) +} + +func extraSpecsCreateURL(client *gophercloud.ServiceClient, id string) string { + return client.ServiceURL("flavors", id, "os-extra_specs") +} + +func extraSpecUpdateURL(client *gophercloud.ServiceClient, id, key string) string { + return client.ServiceURL("flavors", id, "os-extra_specs", key) +} + +func extraSpecDeleteURL(client *gophercloud.ServiceClient, id, key string) string { + return client.ServiceURL("flavors", id, "os-extra_specs", key) +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/doc.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/doc.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/doc.go rename to vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/doc.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/requests.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/requests.go rename to vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/requests.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/results.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/results.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/results.go rename to vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/results.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/urls.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/urls.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/urls.go rename to vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/images/urls.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/doc.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/doc.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/doc.go rename to vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/doc.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/errors.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/errors.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/errors.go rename to vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/errors.go diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go new file mode 100644 index 000000000000..a6530f8d6515 --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/requests.go @@ -0,0 +1,794 @@ +package servers + +import ( + "encoding/base64" + "encoding/json" + + "github.com/gophercloud/gophercloud" + "github.com/gophercloud/gophercloud/openstack/compute/v2/flavors" + "github.com/gophercloud/gophercloud/openstack/compute/v2/images" + "github.com/gophercloud/gophercloud/pagination" +) + +// ListOptsBuilder allows extensions to add additional parameters to the +// List request. +type ListOptsBuilder interface { + ToServerListQuery() (string, error) +} + +// ListOpts allows the filtering and sorting of paginated collections through +// the API. Filtering is achieved by passing in struct field values that map to +// the server attributes you want to see returned. Marker and Limit are used +// for pagination. +type ListOpts struct { + // ChangesSince is a time/date stamp for when the server last changed status. + ChangesSince string `q:"changes-since"` + + // Image is the name of the image in URL format. + Image string `q:"image"` + + // Flavor is the name of the flavor in URL format. + Flavor string `q:"flavor"` + + // Name of the server as a string; can be queried with regular expressions. + // Realize that ?name=bob returns both bob and bobb. If you need to match bob + // only, you can use a regular expression matching the syntax of the + // underlying database server implemented for Compute. + Name string `q:"name"` + + // Status is the value of the status of the server so that you can filter on + // "ACTIVE" for example. + Status string `q:"status"` + + // Host is the name of the host as a string. + Host string `q:"host"` + + // Marker is a UUID of the server at which you want to set a marker. + Marker string `q:"marker"` + + // Limit is an integer value for the limit of values to return. + Limit int `q:"limit"` + + // AllTenants is a bool to show all tenants. + AllTenants bool `q:"all_tenants"` + + // TenantID lists servers for a particular tenant. + // Setting "AllTenants = true" is required. + TenantID string `q:"tenant_id"` +} + +// ToServerListQuery formats a ListOpts into a query string. +func (opts ListOpts) ToServerListQuery() (string, error) { + q, err := gophercloud.BuildQueryString(opts) + return q.String(), err +} + +// List makes a request against the API to list servers accessible to you. +func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager { + url := listDetailURL(client) + if opts != nil { + query, err := opts.ToServerListQuery() + if err != nil { + return pagination.Pager{Err: err} + } + url += query + } + return pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page { + return ServerPage{pagination.LinkedPageBase{PageResult: r}} + }) +} + +// CreateOptsBuilder allows extensions to add additional parameters to the +// Create request. +type CreateOptsBuilder interface { + ToServerCreateMap() (map[string]interface{}, error) +} + +// Network is used within CreateOpts to control a new server's network +// attachments. +type Network struct { + // UUID of a network to attach to the newly provisioned server. + // Required unless Port is provided. + UUID string + + // Port of a neutron network to attach to the newly provisioned server. + // Required unless UUID is provided. + Port string + + // FixedIP specifies a fixed IPv4 address to be used on this network. + FixedIP string +} + +// Personality is an array of files that are injected into the server at launch. +type Personality []*File + +// File is used within CreateOpts and RebuildOpts to inject a file into the +// server at launch. +// File implements the json.Marshaler interface, so when a Create or Rebuild +// operation is requested, json.Marshal will call File's MarshalJSON method. +type File struct { + // Path of the file. + Path string + + // Contents of the file. Maximum content size is 255 bytes. + Contents []byte +} + +// MarshalJSON marshals the escaped file, base64 encoding the contents. +func (f *File) MarshalJSON() ([]byte, error) { + file := struct { + Path string `json:"path"` + Contents string `json:"contents"` + }{ + Path: f.Path, + Contents: base64.StdEncoding.EncodeToString(f.Contents), + } + return json.Marshal(file) +} + +// CreateOpts specifies server creation parameters. +type CreateOpts struct { + // Name is the name to assign to the newly launched server. + Name string `json:"name" required:"true"` + + // ImageRef [optional; required if ImageName is not provided] is the ID or + // full URL to the image that contains the server's OS and initial state. + // Also optional if using the boot-from-volume extension. + ImageRef string `json:"imageRef"` + + // ImageName [optional; required if ImageRef is not provided] is the name of + // the image that contains the server's OS and initial state. + // Also optional if using the boot-from-volume extension. + ImageName string `json:"-"` + + // FlavorRef [optional; required if FlavorName is not provided] is the ID or + // full URL to the flavor that describes the server's specs. + FlavorRef string `json:"flavorRef"` + + // FlavorName [optional; required if FlavorRef is not provided] is the name of + // the flavor that describes the server's specs. + FlavorName string `json:"-"` + + // SecurityGroups lists the names of the security groups to which this server + // should belong. + SecurityGroups []string `json:"-"` + + // UserData contains configuration information or scripts to use upon launch. + // Create will base64-encode it for you, if it isn't already. + UserData []byte `json:"-"` + + // AvailabilityZone in which to launch the server. + AvailabilityZone string `json:"availability_zone,omitempty"` + + // Networks dictates how this server will be attached to available networks. + // By default, the server will be attached to all isolated networks for the + // tenant. + Networks []Network `json:"-"` + + // Metadata contains key-value pairs (up to 255 bytes each) to attach to the + // server. + Metadata map[string]string `json:"metadata,omitempty"` + + // Personality includes files to inject into the server at launch. + // Create will base64-encode file contents for you. + Personality Personality `json:"personality,omitempty"` + + // ConfigDrive enables metadata injection through a configuration drive. + ConfigDrive *bool `json:"config_drive,omitempty"` + + // AdminPass sets the root user password. If not set, a randomly-generated + // password will be created and returned in the response. + AdminPass string `json:"adminPass,omitempty"` + + // AccessIPv4 specifies an IPv4 address for the instance. + AccessIPv4 string `json:"accessIPv4,omitempty"` + + // AccessIPv6 pecifies an IPv6 address for the instance. + AccessIPv6 string `json:"accessIPv6,omitempty"` + + // ServiceClient will allow calls to be made to retrieve an image or + // flavor ID by name. + ServiceClient *gophercloud.ServiceClient `json:"-"` +} + +// ToServerCreateMap assembles a request body based on the contents of a +// CreateOpts. +func (opts CreateOpts) ToServerCreateMap() (map[string]interface{}, error) { + sc := opts.ServiceClient + opts.ServiceClient = nil + b, err := gophercloud.BuildRequestBody(opts, "") + if err != nil { + return nil, err + } + + if opts.UserData != nil { + var userData string + if _, err := base64.StdEncoding.DecodeString(string(opts.UserData)); err != nil { + userData = base64.StdEncoding.EncodeToString(opts.UserData) + } else { + userData = string(opts.UserData) + } + b["user_data"] = &userData + } + + if len(opts.SecurityGroups) > 0 { + securityGroups := make([]map[string]interface{}, len(opts.SecurityGroups)) + for i, groupName := range opts.SecurityGroups { + securityGroups[i] = map[string]interface{}{"name": groupName} + } + b["security_groups"] = securityGroups + } + + if len(opts.Networks) > 0 { + networks := make([]map[string]interface{}, len(opts.Networks)) + for i, net := range opts.Networks { + networks[i] = make(map[string]interface{}) + if net.UUID != "" { + networks[i]["uuid"] = net.UUID + } + if net.Port != "" { + networks[i]["port"] = net.Port + } + if net.FixedIP != "" { + networks[i]["fixed_ip"] = net.FixedIP + } + } + b["networks"] = networks + } + + // If ImageRef isn't provided, check if ImageName was provided to ascertain + // the image ID. + if opts.ImageRef == "" { + if opts.ImageName != "" { + if sc == nil { + err := ErrNoClientProvidedForIDByName{} + err.Argument = "ServiceClient" + return nil, err + } + imageID, err := images.IDFromName(sc, opts.ImageName) + if err != nil { + return nil, err + } + b["imageRef"] = imageID + } + } + + // If FlavorRef isn't provided, use FlavorName to ascertain the flavor ID. + if opts.FlavorRef == "" { + if opts.FlavorName == "" { + err := ErrNeitherFlavorIDNorFlavorNameProvided{} + err.Argument = "FlavorRef/FlavorName" + return nil, err + } + if sc == nil { + err := ErrNoClientProvidedForIDByName{} + err.Argument = "ServiceClient" + return nil, err + } + flavorID, err := flavors.IDFromName(sc, opts.FlavorName) + if err != nil { + return nil, err + } + b["flavorRef"] = flavorID + } + + return map[string]interface{}{"server": b}, nil +} + +// Create requests a server to be provisioned to the user in the current tenant. +func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult) { + reqBody, err := opts.ToServerCreateMap() + if err != nil { + r.Err = err + return + } + _, r.Err = client.Post(listURL(client), reqBody, &r.Body, nil) + return +} + +// Delete requests that a server previously provisioned be removed from your +// account. +func Delete(client *gophercloud.ServiceClient, id string) (r DeleteResult) { + _, r.Err = client.Delete(deleteURL(client, id), nil) + return +} + +// ForceDelete forces the deletion of a server. +func ForceDelete(client *gophercloud.ServiceClient, id string) (r ActionResult) { + _, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"forceDelete": ""}, nil, nil) + return +} + +// Get requests details on a single server, by ID. +func Get(client *gophercloud.ServiceClient, id string) (r GetResult) { + _, r.Err = client.Get(getURL(client, id), &r.Body, &gophercloud.RequestOpts{ + OkCodes: []int{200, 203}, + }) + return +} + +// UpdateOptsBuilder allows extensions to add additional attributes to the +// Update request. +type UpdateOptsBuilder interface { + ToServerUpdateMap() (map[string]interface{}, error) +} + +// UpdateOpts specifies the base attributes that may be updated on an existing +// server. +type UpdateOpts struct { + // Name changes the displayed name of the server. + // The server host name will *not* change. + // Server names are not constrained to be unique, even within the same tenant. + Name string `json:"name,omitempty"` + + // AccessIPv4 provides a new IPv4 address for the instance. + AccessIPv4 string `json:"accessIPv4,omitempty"` + + // AccessIPv6 provides a new IPv6 address for the instance. + AccessIPv6 string `json:"accessIPv6,omitempty"` +} + +// ToServerUpdateMap formats an UpdateOpts structure into a request body. +func (opts UpdateOpts) ToServerUpdateMap() (map[string]interface{}, error) { + return gophercloud.BuildRequestBody(opts, "server") +} + +// Update requests that various attributes of the indicated server be changed. +func Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder) (r UpdateResult) { + b, err := opts.ToServerUpdateMap() + if err != nil { + r.Err = err + return + } + _, r.Err = client.Put(updateURL(client, id), b, &r.Body, &gophercloud.RequestOpts{ + OkCodes: []int{200}, + }) + return +} + +// ChangeAdminPassword alters the administrator or root password for a specified +// server. +func ChangeAdminPassword(client *gophercloud.ServiceClient, id, newPassword string) (r ActionResult) { + b := map[string]interface{}{ + "changePassword": map[string]string{ + "adminPass": newPassword, + }, + } + _, r.Err = client.Post(actionURL(client, id), b, nil, nil) + return +} + +// RebootMethod describes the mechanisms by which a server reboot can be requested. +type RebootMethod string + +// These constants determine how a server should be rebooted. +// See the Reboot() function for further details. +const ( + SoftReboot RebootMethod = "SOFT" + HardReboot RebootMethod = "HARD" + OSReboot = SoftReboot + PowerCycle = HardReboot +) + +// RebootOptsBuilder allows extensions to add additional parameters to the +// reboot request. +type RebootOptsBuilder interface { + ToServerRebootMap() (map[string]interface{}, error) +} + +// RebootOpts provides options to the reboot request. +type RebootOpts struct { + // Type is the type of reboot to perform on the server. + Type RebootMethod `json:"type" required:"true"` +} + +// ToServerRebootMap builds a body for the reboot request. +func (opts RebootOpts) ToServerRebootMap() (map[string]interface{}, error) { + return gophercloud.BuildRequestBody(opts, "reboot") +} + +/* + Reboot requests that a given server reboot. + + Two methods exist for rebooting a server: + + HardReboot (aka PowerCycle) starts the server instance by physically cutting + power to the machine, or if a VM, terminating it at the hypervisor level. + It's done. Caput. Full stop. + Then, after a brief while, power is rtored or the VM instance restarted. + + SoftReboot (aka OSReboot) simply tells the OS to restart under its own + procedure. + E.g., in Linux, asking it to enter runlevel 6, or executing + "sudo shutdown -r now", or by asking Windows to rtart the machine. +*/ +func Reboot(client *gophercloud.ServiceClient, id string, opts RebootOptsBuilder) (r ActionResult) { + b, err := opts.ToServerRebootMap() + if err != nil { + r.Err = err + return + } + _, r.Err = client.Post(actionURL(client, id), b, nil, nil) + return +} + +// RebuildOptsBuilder allows extensions to provide additional parameters to the +// rebuild request. +type RebuildOptsBuilder interface { + ToServerRebuildMap() (map[string]interface{}, error) +} + +// RebuildOpts represents the configuration options used in a server rebuild +// operation. +type RebuildOpts struct { + // AdminPass is the server's admin password + AdminPass string `json:"adminPass,omitempty"` + + // ImageID is the ID of the image you want your server to be provisioned on. + ImageID string `json:"imageRef"` + + // ImageName is readable name of an image. + ImageName string `json:"-"` + + // Name to set the server to + Name string `json:"name,omitempty"` + + // AccessIPv4 [optional] provides a new IPv4 address for the instance. + AccessIPv4 string `json:"accessIPv4,omitempty"` + + // AccessIPv6 [optional] provides a new IPv6 address for the instance. + AccessIPv6 string `json:"accessIPv6,omitempty"` + + // Metadata [optional] contains key-value pairs (up to 255 bytes each) + // to attach to the server. + Metadata map[string]string `json:"metadata,omitempty"` + + // Personality [optional] includes files to inject into the server at launch. + // Rebuild will base64-encode file contents for you. + Personality Personality `json:"personality,omitempty"` + + // ServiceClient will allow calls to be made to retrieve an image or + // flavor ID by name. + ServiceClient *gophercloud.ServiceClient `json:"-"` +} + +// ToServerRebuildMap formats a RebuildOpts struct into a map for use in JSON +func (opts RebuildOpts) ToServerRebuildMap() (map[string]interface{}, error) { + b, err := gophercloud.BuildRequestBody(opts, "") + if err != nil { + return nil, err + } + + // If ImageRef isn't provided, check if ImageName was provided to ascertain + // the image ID. + if opts.ImageID == "" { + if opts.ImageName != "" { + if opts.ServiceClient == nil { + err := ErrNoClientProvidedForIDByName{} + err.Argument = "ServiceClient" + return nil, err + } + imageID, err := images.IDFromName(opts.ServiceClient, opts.ImageName) + if err != nil { + return nil, err + } + b["imageRef"] = imageID + } + } + + return map[string]interface{}{"rebuild": b}, nil +} + +// Rebuild will reprovision the server according to the configuration options +// provided in the RebuildOpts struct. +func Rebuild(client *gophercloud.ServiceClient, id string, opts RebuildOptsBuilder) (r RebuildResult) { + b, err := opts.ToServerRebuildMap() + if err != nil { + r.Err = err + return + } + _, r.Err = client.Post(actionURL(client, id), b, &r.Body, nil) + return +} + +// ResizeOptsBuilder allows extensions to add additional parameters to the +// resize request. +type ResizeOptsBuilder interface { + ToServerResizeMap() (map[string]interface{}, error) +} + +// ResizeOpts represents the configuration options used to control a Resize +// operation. +type ResizeOpts struct { + // FlavorRef is the ID of the flavor you wish your server to become. + FlavorRef string `json:"flavorRef" required:"true"` +} + +// ToServerResizeMap formats a ResizeOpts as a map that can be used as a JSON +// request body for the Resize request. +func (opts ResizeOpts) ToServerResizeMap() (map[string]interface{}, error) { + return gophercloud.BuildRequestBody(opts, "resize") +} + +// Resize instructs the provider to change the flavor of the server. +// +// Note that this implies rebuilding it. +// +// Unfortunately, one cannot pass rebuild parameters to the resize function. +// When the resize completes, the server will be in VERIFY_RESIZE state. +// While in this state, you can explore the use of the new server's +// configuration. If you like it, call ConfirmResize() to commit the resize +// permanently. Otherwise, call RevertResize() to restore the old configuration. +func Resize(client *gophercloud.ServiceClient, id string, opts ResizeOptsBuilder) (r ActionResult) { + b, err := opts.ToServerResizeMap() + if err != nil { + r.Err = err + return + } + _, r.Err = client.Post(actionURL(client, id), b, nil, nil) + return +} + +// ConfirmResize confirms a previous resize operation on a server. +// See Resize() for more details. +func ConfirmResize(client *gophercloud.ServiceClient, id string) (r ActionResult) { + _, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"confirmResize": nil}, nil, &gophercloud.RequestOpts{ + OkCodes: []int{201, 202, 204}, + }) + return +} + +// RevertResize cancels a previous resize operation on a server. +// See Resize() for more details. +func RevertResize(client *gophercloud.ServiceClient, id string) (r ActionResult) { + _, r.Err = client.Post(actionURL(client, id), map[string]interface{}{"revertResize": nil}, nil, nil) + return +} + +// ResetMetadataOptsBuilder allows extensions to add additional parameters to +// the Reset request. +type ResetMetadataOptsBuilder interface { + ToMetadataResetMap() (map[string]interface{}, error) +} + +// MetadataOpts is a map that contains key-value pairs. +type MetadataOpts map[string]string + +// ToMetadataResetMap assembles a body for a Reset request based on the contents +// of a MetadataOpts. +func (opts MetadataOpts) ToMetadataResetMap() (map[string]interface{}, error) { + return map[string]interface{}{"metadata": opts}, nil +} + +// ToMetadataUpdateMap assembles a body for an Update request based on the +// contents of a MetadataOpts. +func (opts MetadataOpts) ToMetadataUpdateMap() (map[string]interface{}, error) { + return map[string]interface{}{"metadata": opts}, nil +} + +// ResetMetadata will create multiple new key-value pairs for the given server +// ID. +// Note: Using this operation will erase any already-existing metadata and +// create the new metadata provided. To keep any already-existing metadata, +// use the UpdateMetadatas or UpdateMetadata function. +func ResetMetadata(client *gophercloud.ServiceClient, id string, opts ResetMetadataOptsBuilder) (r ResetMetadataResult) { + b, err := opts.ToMetadataResetMap() + if err != nil { + r.Err = err + return + } + _, r.Err = client.Put(metadataURL(client, id), b, &r.Body, &gophercloud.RequestOpts{ + OkCodes: []int{200}, + }) + return +} + +// Metadata requests all the metadata for the given server ID. +func Metadata(client *gophercloud.ServiceClient, id string) (r GetMetadataResult) { + _, r.Err = client.Get(metadataURL(client, id), &r.Body, nil) + return +} + +// UpdateMetadataOptsBuilder allows extensions to add additional parameters to +// the Create request. +type UpdateMetadataOptsBuilder interface { + ToMetadataUpdateMap() (map[string]interface{}, error) +} + +// UpdateMetadata updates (or creates) all the metadata specified by opts for +// the given server ID. This operation does not affect already-existing metadata +// that is not specified by opts. +func UpdateMetadata(client *gophercloud.ServiceClient, id string, opts UpdateMetadataOptsBuilder) (r UpdateMetadataResult) { + b, err := opts.ToMetadataUpdateMap() + if err != nil { + r.Err = err + return + } + _, r.Err = client.Post(metadataURL(client, id), b, &r.Body, &gophercloud.RequestOpts{ + OkCodes: []int{200}, + }) + return +} + +// MetadatumOptsBuilder allows extensions to add additional parameters to the +// Create request. +type MetadatumOptsBuilder interface { + ToMetadatumCreateMap() (map[string]interface{}, string, error) +} + +// MetadatumOpts is a map of length one that contains a key-value pair. +type MetadatumOpts map[string]string + +// ToMetadatumCreateMap assembles a body for a Create request based on the +// contents of a MetadataumOpts. +func (opts MetadatumOpts) ToMetadatumCreateMap() (map[string]interface{}, string, error) { + if len(opts) != 1 { + err := gophercloud.ErrInvalidInput{} + err.Argument = "servers.MetadatumOpts" + err.Info = "Must have 1 and only 1 key-value pair" + return nil, "", err + } + metadatum := map[string]interface{}{"meta": opts} + var key string + for k := range metadatum["meta"].(MetadatumOpts) { + key = k + } + return metadatum, key, nil +} + +// CreateMetadatum will create or update the key-value pair with the given key +// for the given server ID. +func CreateMetadatum(client *gophercloud.ServiceClient, id string, opts MetadatumOptsBuilder) (r CreateMetadatumResult) { + b, key, err := opts.ToMetadatumCreateMap() + if err != nil { + r.Err = err + return + } + _, r.Err = client.Put(metadatumURL(client, id, key), b, &r.Body, &gophercloud.RequestOpts{ + OkCodes: []int{200}, + }) + return +} + +// Metadatum requests the key-value pair with the given key for the given +// server ID. +func Metadatum(client *gophercloud.ServiceClient, id, key string) (r GetMetadatumResult) { + _, r.Err = client.Get(metadatumURL(client, id, key), &r.Body, nil) + return +} + +// DeleteMetadatum will delete the key-value pair with the given key for the +// given server ID. +func DeleteMetadatum(client *gophercloud.ServiceClient, id, key string) (r DeleteMetadatumResult) { + _, r.Err = client.Delete(metadatumURL(client, id, key), nil) + return +} + +// ListAddresses makes a request against the API to list the servers IP +// addresses. +func ListAddresses(client *gophercloud.ServiceClient, id string) pagination.Pager { + return pagination.NewPager(client, listAddressesURL(client, id), func(r pagination.PageResult) pagination.Page { + return AddressPage{pagination.SinglePageBase(r)} + }) +} + +// ListAddressesByNetwork makes a request against the API to list the servers IP +// addresses for the given network. +func ListAddressesByNetwork(client *gophercloud.ServiceClient, id, network string) pagination.Pager { + return pagination.NewPager(client, listAddressesByNetworkURL(client, id, network), func(r pagination.PageResult) pagination.Page { + return NetworkAddressPage{pagination.SinglePageBase(r)} + }) +} + +// CreateImageOptsBuilder allows extensions to add additional parameters to the +// CreateImage request. +type CreateImageOptsBuilder interface { + ToServerCreateImageMap() (map[string]interface{}, error) +} + +// CreateImageOpts provides options to pass to the CreateImage request. +type CreateImageOpts struct { + // Name of the image/snapshot. + Name string `json:"name" required:"true"` + + // Metadata contains key-value pairs (up to 255 bytes each) to attach to + // the created image. + Metadata map[string]string `json:"metadata,omitempty"` +} + +// ToServerCreateImageMap formats a CreateImageOpts structure into a request +// body. +func (opts CreateImageOpts) ToServerCreateImageMap() (map[string]interface{}, error) { + return gophercloud.BuildRequestBody(opts, "createImage") +} + +// CreateImage makes a request against the nova API to schedule an image to be +// created of the server +func CreateImage(client *gophercloud.ServiceClient, id string, opts CreateImageOptsBuilder) (r CreateImageResult) { + b, err := opts.ToServerCreateImageMap() + if err != nil { + r.Err = err + return + } + resp, err := client.Post(actionURL(client, id), b, nil, &gophercloud.RequestOpts{ + OkCodes: []int{202}, + }) + r.Err = err + r.Header = resp.Header + return +} + +// IDFromName is a convienience function that returns a server's ID given its +// name. +func IDFromName(client *gophercloud.ServiceClient, name string) (string, error) { + count := 0 + id := "" + + listOpts := ListOpts{ + Name: name, + } + + allPages, err := List(client, listOpts).AllPages() + if err != nil { + return "", err + } + + all, err := ExtractServers(allPages) + if err != nil { + return "", err + } + + for _, f := range all { + if f.Name == name { + count++ + id = f.ID + } + } + + switch count { + case 0: + return "", gophercloud.ErrResourceNotFound{Name: name, ResourceType: "server"} + case 1: + return id, nil + default: + return "", gophercloud.ErrMultipleResourcesFound{Name: name, Count: count, ResourceType: "server"} + } +} + +// GetPassword makes a request against the nova API to get the encrypted +// administrative password. +func GetPassword(client *gophercloud.ServiceClient, serverId string) (r GetPasswordResult) { + _, r.Err = client.Get(passwordURL(client, serverId), &r.Body, nil) + return +} + +// ShowConsoleOutputOptsBuilder is the interface types must satisfy in order to be +// used as ShowConsoleOutput options +type ShowConsoleOutputOptsBuilder interface { + ToServerShowConsoleOutputMap() (map[string]interface{}, error) +} + +// ShowConsoleOutputOpts satisfies the ShowConsoleOutputOptsBuilder +type ShowConsoleOutputOpts struct { + // The number of lines to fetch from the end of console log. + // All lines will be returned if this is not specified. + Length int `json:"length,omitempty"` +} + +// ToServerShowConsoleOutputMap formats a ShowConsoleOutputOpts structure into a request body. +func (opts ShowConsoleOutputOpts) ToServerShowConsoleOutputMap() (map[string]interface{}, error) { + return gophercloud.BuildRequestBody(opts, "os-getConsoleOutput") +} + +// ShowConsoleOutput makes a request against the nova API to get console log from the server +func ShowConsoleOutput(client *gophercloud.ServiceClient, id string, opts ShowConsoleOutputOptsBuilder) (r ShowConsoleOutputResult) { + b, err := opts.ToServerShowConsoleOutputMap() + if err != nil { + r.Err = err + return + } + _, r.Err = client.Post(actionURL(client, id), b, &r.Body, &gophercloud.RequestOpts{ + OkCodes: []int{200}, + }) + return +} diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/results.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/results.go new file mode 100644 index 000000000000..f973d1ea0e1b --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/results.go @@ -0,0 +1,414 @@ +package servers + +import ( + "crypto/rsa" + "encoding/base64" + "encoding/json" + "fmt" + "net/url" + "path" + "time" + + "github.com/gophercloud/gophercloud" + "github.com/gophercloud/gophercloud/pagination" +) + +type serverResult struct { + gophercloud.Result +} + +// Extract interprets any serverResult as a Server, if possible. +func (r serverResult) Extract() (*Server, error) { + var s Server + err := r.ExtractInto(&s) + return &s, err +} + +func (r serverResult) ExtractInto(v interface{}) error { + return r.Result.ExtractIntoStructPtr(v, "server") +} + +func ExtractServersInto(r pagination.Page, v interface{}) error { + return r.(ServerPage).Result.ExtractIntoSlicePtr(v, "servers") +} + +// CreateResult is the response from a Create operation. Call its Extract +// method to interpret it as a Server. +type CreateResult struct { + serverResult +} + +// GetResult is the response from a Get operation. Call its Extract +// method to interpret it as a Server. +type GetResult struct { + serverResult +} + +// UpdateResult is the response from an Update operation. Call its Extract +// method to interpret it as a Server. +type UpdateResult struct { + serverResult +} + +// DeleteResult is the response from a Delete operation. Call its ExtractErr +// method to determine if the call succeeded or failed. +type DeleteResult struct { + gophercloud.ErrResult +} + +// RebuildResult is the response from a Rebuild operation. Call its Extract +// method to interpret it as a Server. +type RebuildResult struct { + serverResult +} + +// ActionResult represents the result of server action operations, like reboot. +// Call its ExtractErr method to determine if the action succeeded or failed. +type ActionResult struct { + gophercloud.ErrResult +} + +// CreateImageResult is the response from a CreateImage operation. Call its +// ExtractImageID method to retrieve the ID of the newly created image. +type CreateImageResult struct { + gophercloud.Result +} + +// ShowConsoleOutputResult represents the result of console output from a server +type ShowConsoleOutputResult struct { + gophercloud.Result +} + +// Extract will return the console output from a ShowConsoleOutput request. +func (r ShowConsoleOutputResult) Extract() (string, error) { + var s struct { + Output string `json:"output"` + } + + err := r.ExtractInto(&s) + return s.Output, err +} + +// GetPasswordResult represent the result of a get os-server-password operation. +// Call its ExtractPassword method to retrieve the password. +type GetPasswordResult struct { + gophercloud.Result +} + +// ExtractPassword gets the encrypted password. +// If privateKey != nil the password is decrypted with the private key. +// If privateKey == nil the encrypted password is returned and can be decrypted +// with: +// echo '' | base64 -D | openssl rsautl -decrypt -inkey +func (r GetPasswordResult) ExtractPassword(privateKey *rsa.PrivateKey) (string, error) { + var s struct { + Password string `json:"password"` + } + err := r.ExtractInto(&s) + if err == nil && privateKey != nil && s.Password != "" { + return decryptPassword(s.Password, privateKey) + } + return s.Password, err +} + +func decryptPassword(encryptedPassword string, privateKey *rsa.PrivateKey) (string, error) { + b64EncryptedPassword := make([]byte, base64.StdEncoding.DecodedLen(len(encryptedPassword))) + + n, err := base64.StdEncoding.Decode(b64EncryptedPassword, []byte(encryptedPassword)) + if err != nil { + return "", fmt.Errorf("Failed to base64 decode encrypted password: %s", err) + } + password, err := rsa.DecryptPKCS1v15(nil, privateKey, b64EncryptedPassword[0:n]) + if err != nil { + return "", fmt.Errorf("Failed to decrypt password: %s", err) + } + + return string(password), nil +} + +// ExtractImageID gets the ID of the newly created server image from the header. +func (r CreateImageResult) ExtractImageID() (string, error) { + if r.Err != nil { + return "", r.Err + } + // Get the image id from the header + u, err := url.ParseRequestURI(r.Header.Get("Location")) + if err != nil { + return "", err + } + imageID := path.Base(u.Path) + if imageID == "." || imageID == "/" { + return "", fmt.Errorf("Failed to parse the ID of newly created image: %s", u) + } + return imageID, nil +} + +// Server represents a server/instance in the OpenStack cloud. +type Server struct { + // ID uniquely identifies this server amongst all other servers, + // including those not accessible to the current tenant. + ID string `json:"id"` + + // TenantID identifies the tenant owning this server resource. + TenantID string `json:"tenant_id"` + + // UserID uniquely identifies the user account owning the tenant. + UserID string `json:"user_id"` + + // Name contains the human-readable name for the server. + Name string `json:"name"` + + // Updated and Created contain ISO-8601 timestamps of when the state of the + // server last changed, and when it was created. + Updated time.Time `json:"updated"` + Created time.Time `json:"created"` + + // HostID is the host where the server is located in the cloud. + HostID string `json:"hostid"` + + // Status contains the current operational status of the server, + // such as IN_PROGRESS or ACTIVE. + Status string `json:"status"` + + // Progress ranges from 0..100. + // A request made against the server completes only once Progress reaches 100. + Progress int `json:"progress"` + + // AccessIPv4 and AccessIPv6 contain the IP addresses of the server, + // suitable for remote access for administration. + AccessIPv4 string `json:"accessIPv4"` + AccessIPv6 string `json:"accessIPv6"` + + // Image refers to a JSON object, which itself indicates the OS image used to + // deploy the server. + Image map[string]interface{} `json:"-"` + + // Flavor refers to a JSON object, which itself indicates the hardware + // configuration of the deployed server. + Flavor map[string]interface{} `json:"flavor"` + + // Addresses includes a list of all IP addresses assigned to the server, + // keyed by pool. + Addresses map[string]interface{} `json:"addresses"` + + // Metadata includes a list of all user-specified key-value pairs attached + // to the server. + Metadata map[string]string `json:"metadata"` + + // Links includes HTTP references to the itself, useful for passing along to + // other APIs that might want a server reference. + Links []interface{} `json:"links"` + + // KeyName indicates which public key was injected into the server on launch. + KeyName string `json:"key_name"` + + // AdminPass will generally be empty (""). However, it will contain the + // administrative password chosen when provisioning a new server without a + // set AdminPass setting in the first place. + // Note that this is the ONLY time this field will be valid. + AdminPass string `json:"adminPass"` + + // SecurityGroups includes the security groups that this instance has applied + // to it. + SecurityGroups []map[string]interface{} `json:"security_groups"` + + // Fault contains failure information about a server. + Fault Fault `json:"fault"` +} + +type Fault struct { + Code int `json:"code"` + Created time.Time `json:"created"` + Details string `json:"details"` + Message string `json:"message"` +} + +func (r *Server) UnmarshalJSON(b []byte) error { + type tmp Server + var s struct { + tmp + Image interface{} `json:"image"` + } + err := json.Unmarshal(b, &s) + if err != nil { + return err + } + + *r = Server(s.tmp) + + switch t := s.Image.(type) { + case map[string]interface{}: + r.Image = t + case string: + switch t { + case "": + r.Image = nil + } + } + + return err +} + +// ServerPage abstracts the raw results of making a List() request against +// the API. As OpenStack extensions may freely alter the response bodies of +// structures returned to the client, you may only safely access the data +// provided through the ExtractServers call. +type ServerPage struct { + pagination.LinkedPageBase +} + +// IsEmpty returns true if a page contains no Server results. +func (r ServerPage) IsEmpty() (bool, error) { + s, err := ExtractServers(r) + return len(s) == 0, err +} + +// NextPageURL uses the response's embedded link reference to navigate to the +// next page of results. +func (r ServerPage) NextPageURL() (string, error) { + var s struct { + Links []gophercloud.Link `json:"servers_links"` + } + err := r.ExtractInto(&s) + if err != nil { + return "", err + } + return gophercloud.ExtractNextURL(s.Links) +} + +// ExtractServers interprets the results of a single page from a List() call, +// producing a slice of Server entities. +func ExtractServers(r pagination.Page) ([]Server, error) { + var s []Server + err := ExtractServersInto(r, &s) + return s, err +} + +// MetadataResult contains the result of a call for (potentially) multiple +// key-value pairs. Call its Extract method to interpret it as a +// map[string]interface. +type MetadataResult struct { + gophercloud.Result +} + +// GetMetadataResult contains the result of a Get operation. Call its Extract +// method to interpret it as a map[string]interface. +type GetMetadataResult struct { + MetadataResult +} + +// ResetMetadataResult contains the result of a Reset operation. Call its +// Extract method to interpret it as a map[string]interface. +type ResetMetadataResult struct { + MetadataResult +} + +// UpdateMetadataResult contains the result of an Update operation. Call its +// Extract method to interpret it as a map[string]interface. +type UpdateMetadataResult struct { + MetadataResult +} + +// MetadatumResult contains the result of a call for individual a single +// key-value pair. +type MetadatumResult struct { + gophercloud.Result +} + +// GetMetadatumResult contains the result of a Get operation. Call its Extract +// method to interpret it as a map[string]interface. +type GetMetadatumResult struct { + MetadatumResult +} + +// CreateMetadatumResult contains the result of a Create operation. Call its +// Extract method to interpret it as a map[string]interface. +type CreateMetadatumResult struct { + MetadatumResult +} + +// DeleteMetadatumResult contains the result of a Delete operation. Call its +// ExtractErr method to determine if the call succeeded or failed. +type DeleteMetadatumResult struct { + gophercloud.ErrResult +} + +// Extract interprets any MetadataResult as a Metadata, if possible. +func (r MetadataResult) Extract() (map[string]string, error) { + var s struct { + Metadata map[string]string `json:"metadata"` + } + err := r.ExtractInto(&s) + return s.Metadata, err +} + +// Extract interprets any MetadatumResult as a Metadatum, if possible. +func (r MetadatumResult) Extract() (map[string]string, error) { + var s struct { + Metadatum map[string]string `json:"meta"` + } + err := r.ExtractInto(&s) + return s.Metadatum, err +} + +// Address represents an IP address. +type Address struct { + Version int `json:"version"` + Address string `json:"addr"` +} + +// AddressPage abstracts the raw results of making a ListAddresses() request +// against the API. As OpenStack extensions may freely alter the response bodies +// of structures returned to the client, you may only safely access the data +// provided through the ExtractAddresses call. +type AddressPage struct { + pagination.SinglePageBase +} + +// IsEmpty returns true if an AddressPage contains no networks. +func (r AddressPage) IsEmpty() (bool, error) { + addresses, err := ExtractAddresses(r) + return len(addresses) == 0, err +} + +// ExtractAddresses interprets the results of a single page from a +// ListAddresses() call, producing a map of addresses. +func ExtractAddresses(r pagination.Page) (map[string][]Address, error) { + var s struct { + Addresses map[string][]Address `json:"addresses"` + } + err := (r.(AddressPage)).ExtractInto(&s) + return s.Addresses, err +} + +// NetworkAddressPage abstracts the raw results of making a +// ListAddressesByNetwork() request against the API. +// As OpenStack extensions may freely alter the response bodies of structures +// returned to the client, you may only safely access the data provided through +// the ExtractAddresses call. +type NetworkAddressPage struct { + pagination.SinglePageBase +} + +// IsEmpty returns true if a NetworkAddressPage contains no addresses. +func (r NetworkAddressPage) IsEmpty() (bool, error) { + addresses, err := ExtractNetworkAddresses(r) + return len(addresses) == 0, err +} + +// ExtractNetworkAddresses interprets the results of a single page from a +// ListAddressesByNetwork() call, producing a slice of addresses. +func ExtractNetworkAddresses(r pagination.Page) ([]Address, error) { + var s map[string][]Address + err := (r.(NetworkAddressPage)).ExtractInto(&s) + if err != nil { + return nil, err + } + + var key string + for k := range s { + key = k + } + + return s[key], err +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/urls.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/urls.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/urls.go rename to vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/urls.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/util.go b/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/util.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/util.go rename to vendor/github.com/gophercloud/gophercloud/openstack/compute/v2/servers/util.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/doc.go b/vendor/github.com/gophercloud/gophercloud/openstack/doc.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/doc.go rename to vendor/github.com/gophercloud/gophercloud/openstack/doc.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/endpoint_location.go b/vendor/github.com/gophercloud/gophercloud/openstack/endpoint_location.go similarity index 97% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/endpoint_location.go rename to vendor/github.com/gophercloud/gophercloud/openstack/endpoint_location.go index 070ea7cbef02..12c8aebcf77c 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/endpoint_location.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/endpoint_location.go @@ -84,7 +84,7 @@ func V3EndpointURL(catalog *tokens3.ServiceCatalog, opts gophercloud.EndpointOpt return "", err } if (opts.Availability == gophercloud.Availability(endpoint.Interface)) && - (opts.Region == "" || endpoint.Region == opts.Region) { + (opts.Region == "" || endpoint.Region == opts.Region || endpoint.RegionID == opts.Region) { endpoints = append(endpoints, endpoint) } } diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/errors.go b/vendor/github.com/gophercloud/gophercloud/openstack/errors.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/errors.go rename to vendor/github.com/gophercloud/gophercloud/openstack/errors.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/doc.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/doc.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/doc.go rename to vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/doc.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/requests.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/requests.go rename to vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/requests.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/results.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/results.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/results.go rename to vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/results.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/urls.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/urls.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/urls.go rename to vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tenants/urls.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/doc.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/doc.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/doc.go rename to vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/doc.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/requests.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/requests.go rename to vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/requests.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/results.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/results.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/results.go rename to vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/results.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/urls.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/urls.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/urls.go rename to vendor/github.com/gophercloud/gophercloud/openstack/identity/v2/tokens/urls.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/doc.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/doc.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/doc.go rename to vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/doc.go diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/requests.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/requests.go new file mode 100644 index 000000000000..6e99a793c53a --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/requests.go @@ -0,0 +1,153 @@ +package tokens + +import "github.com/gophercloud/gophercloud" + +// Scope allows a created token to be limited to a specific domain or project. +type Scope struct { + ProjectID string + ProjectName string + DomainID string + DomainName string +} + +// AuthOptionsBuilder provides the ability for extensions to add additional +// parameters to AuthOptions. Extensions must satisfy all required methods. +type AuthOptionsBuilder interface { + // ToTokenV3CreateMap assembles the Create request body, returning an error + // if parameters are missing or inconsistent. + ToTokenV3CreateMap(map[string]interface{}) (map[string]interface{}, error) + ToTokenV3ScopeMap() (map[string]interface{}, error) + CanReauth() bool +} + +// AuthOptions represents options for authenticating a user. +type AuthOptions struct { + // IdentityEndpoint specifies the HTTP endpoint that is required to work with + // the Identity API of the appropriate version. While it's ultimately needed + // by all of the identity services, it will often be populated by a + // provider-level function. + IdentityEndpoint string `json:"-"` + + // Username is required if using Identity V2 API. Consult with your provider's + // control panel to discover your account's username. In Identity V3, either + // UserID or a combination of Username and DomainID or DomainName are needed. + Username string `json:"username,omitempty"` + UserID string `json:"id,omitempty"` + + Password string `json:"password,omitempty"` + + // At most one of DomainID and DomainName must be provided if using Username + // with Identity V3. Otherwise, either are optional. + DomainID string `json:"-"` + DomainName string `json:"name,omitempty"` + + // AllowReauth should be set to true if you grant permission for Gophercloud + // to cache your credentials in memory, and to allow Gophercloud to attempt + // to re-authenticate automatically if/when your token expires. If you set + // it to false, it will not cache these settings, but re-authentication will + // not be possible. This setting defaults to false. + AllowReauth bool `json:"-"` + + // TokenID allows users to authenticate (possibly as another user) with an + // authentication token ID. + TokenID string `json:"-"` + + Scope Scope `json:"-"` +} + +// ToTokenV3CreateMap builds a request body from AuthOptions. +func (opts *AuthOptions) ToTokenV3CreateMap(scope map[string]interface{}) (map[string]interface{}, error) { + gophercloudAuthOpts := gophercloud.AuthOptions{ + Username: opts.Username, + UserID: opts.UserID, + Password: opts.Password, + DomainID: opts.DomainID, + DomainName: opts.DomainName, + AllowReauth: opts.AllowReauth, + TokenID: opts.TokenID, + } + + return gophercloudAuthOpts.ToTokenV3CreateMap(scope) +} + +// ToTokenV3CreateMap builds a scope request body from AuthOptions. +func (opts *AuthOptions) ToTokenV3ScopeMap() (map[string]interface{}, error) { + scope := gophercloud.AuthScope(opts.Scope) + + gophercloudAuthOpts := gophercloud.AuthOptions{ + Scope: &scope, + DomainID: opts.DomainID, + DomainName: opts.DomainName, + } + + return gophercloudAuthOpts.ToTokenV3ScopeMap() +} + +func (opts *AuthOptions) CanReauth() bool { + return opts.AllowReauth +} + +func subjectTokenHeaders(c *gophercloud.ServiceClient, subjectToken string) map[string]string { + return map[string]string{ + "X-Subject-Token": subjectToken, + } +} + +// Create authenticates and either generates a new token, or changes the Scope +// of an existing token. +func Create(c *gophercloud.ServiceClient, opts AuthOptionsBuilder) (r CreateResult) { + scope, err := opts.ToTokenV3ScopeMap() + if err != nil { + r.Err = err + return + } + + b, err := opts.ToTokenV3CreateMap(scope) + if err != nil { + r.Err = err + return + } + + resp, err := c.Post(tokenURL(c), b, &r.Body, &gophercloud.RequestOpts{ + MoreHeaders: map[string]string{"X-Auth-Token": ""}, + }) + r.Err = err + if resp != nil { + r.Header = resp.Header + } + return +} + +// Get validates and retrieves information about another token. +func Get(c *gophercloud.ServiceClient, token string) (r GetResult) { + resp, err := c.Get(tokenURL(c), &r.Body, &gophercloud.RequestOpts{ + MoreHeaders: subjectTokenHeaders(c, token), + OkCodes: []int{200, 203}, + }) + if resp != nil { + r.Err = err + r.Header = resp.Header + } + return +} + +// Validate determines if a specified token is valid or not. +func Validate(c *gophercloud.ServiceClient, token string) (bool, error) { + resp, err := c.Head(tokenURL(c), &gophercloud.RequestOpts{ + MoreHeaders: subjectTokenHeaders(c, token), + OkCodes: []int{200, 204, 404}, + }) + if err != nil { + return false, err + } + + return resp.StatusCode == 200 || resp.StatusCode == 204, nil +} + +// Revoke immediately makes specified token invalid. +func Revoke(c *gophercloud.ServiceClient, token string) (r RevokeResult) { + _, r.Err = c.Delete(tokenURL(c), &gophercloud.RequestOpts{ + MoreHeaders: subjectTokenHeaders(c, token), + }) + return +} diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/results.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/results.go new file mode 100644 index 000000000000..ebdca58f658f --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/results.go @@ -0,0 +1,171 @@ +package tokens + +import ( + "time" + + "github.com/gophercloud/gophercloud" +) + +// Endpoint represents a single API endpoint offered by a service. +// It matches either a public, internal or admin URL. +// If supported, it contains a region specifier, again if provided. +// The significance of the Region field will depend upon your provider. +type Endpoint struct { + ID string `json:"id"` + Region string `json:"region"` + RegionID string `json:"region_id"` + Interface string `json:"interface"` + URL string `json:"url"` +} + +// CatalogEntry provides a type-safe interface to an Identity API V3 service +// catalog listing. Each class of service, such as cloud DNS or block storage +// services, could have multiple CatalogEntry representing it (one by interface +// type, e.g public, admin or internal). +// +// Note: when looking for the desired service, try, whenever possible, to key +// off the type field. Otherwise, you'll tie the representation of the service +// to a specific provider. +type CatalogEntry struct { + // Service ID + ID string `json:"id"` + + // Name will contain the provider-specified name for the service. + Name string `json:"name"` + + // Type will contain a type string if OpenStack defines a type for the + // service. Otherwise, for provider-specific services, the provider may + // assign their own type strings. + Type string `json:"type"` + + // Endpoints will let the caller iterate over all the different endpoints that + // may exist for the service. + Endpoints []Endpoint `json:"endpoints"` +} + +// ServiceCatalog provides a view into the service catalog from a previous, +// successful authentication. +type ServiceCatalog struct { + Entries []CatalogEntry `json:"catalog"` +} + +// Domain provides information about the domain to which this token grants +// access. +type Domain struct { + ID string `json:"id"` + Name string `json:"name"` +} + +// User represents a user resource that exists in the Identity Service. +type User struct { + Domain Domain `json:"domain"` + ID string `json:"id"` + Name string `json:"name"` +} + +// Role provides information about roles to which User is authorized. +type Role struct { + ID string `json:"id"` + Name string `json:"name"` +} + +// Project provides information about project to which User is authorized. +type Project struct { + Domain Domain `json:"domain"` + ID string `json:"id"` + Name string `json:"name"` +} + +// commonResult is the response from a request. A commonResult has various +// methods which can be used to extract different details about the result. +type commonResult struct { + gophercloud.Result +} + +// Extract is a shortcut for ExtractToken. +// This function is deprecated and still present for backward compatibility. +func (r commonResult) Extract() (*Token, error) { + return r.ExtractToken() +} + +// ExtractToken interprets a commonResult as a Token. +func (r commonResult) ExtractToken() (*Token, error) { + var s Token + err := r.ExtractInto(&s) + if err != nil { + return nil, err + } + + // Parse the token itself from the stored headers. + s.ID = r.Header.Get("X-Subject-Token") + + return &s, err +} + +// ExtractServiceCatalog returns the ServiceCatalog that was generated along +// with the user's Token. +func (r commonResult) ExtractServiceCatalog() (*ServiceCatalog, error) { + var s ServiceCatalog + err := r.ExtractInto(&s) + return &s, err +} + +// ExtractUser returns the User that is the owner of the Token. +func (r commonResult) ExtractUser() (*User, error) { + var s struct { + User *User `json:"user"` + } + err := r.ExtractInto(&s) + return s.User, err +} + +// ExtractRoles returns Roles to which User is authorized. +func (r commonResult) ExtractRoles() ([]Role, error) { + var s struct { + Roles []Role `json:"roles"` + } + err := r.ExtractInto(&s) + return s.Roles, err +} + +// ExtractProject returns Project to which User is authorized. +func (r commonResult) ExtractProject() (*Project, error) { + var s struct { + Project *Project `json:"project"` + } + err := r.ExtractInto(&s) + return s.Project, err +} + +// CreateResult is the response from a Create request. Use ExtractToken() +// to interpret it as a Token, or ExtractServiceCatalog() to interpret it +// as a service catalog. +type CreateResult struct { + commonResult +} + +// GetResult is the response from a Get request. Use ExtractToken() +// to interpret it as a Token, or ExtractServiceCatalog() to interpret it +// as a service catalog. +type GetResult struct { + commonResult +} + +// RevokeResult is response from a Revoke request. +type RevokeResult struct { + commonResult +} + +// Token is a string that grants a user access to a controlled set of services +// in an OpenStack provider. Each Token is valid for a set length of time. +type Token struct { + // ID is the issued token. + ID string `json:"id"` + + // ExpiresAt is the timestamp at which this token will no longer be accepted. + ExpiresAt time.Time `json:"expires_at"` +} + +func (r commonResult) ExtractInto(v interface{}) error { + return r.ExtractIntoStructPtr(v, "token") +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/urls.go b/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/urls.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/urls.go rename to vendor/github.com/gophercloud/gophercloud/openstack/identity/v3/tokens/urls.go diff --git a/vendor/github.com/gophercloud/gophercloud/openstack/utils/base_endpoint.go b/vendor/github.com/gophercloud/gophercloud/openstack/utils/base_endpoint.go new file mode 100644 index 000000000000..40080f7af203 --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/openstack/utils/base_endpoint.go @@ -0,0 +1,28 @@ +package utils + +import ( + "net/url" + "regexp" + "strings" +) + +// BaseEndpoint will return a URL without the /vX.Y +// portion of the URL. +func BaseEndpoint(endpoint string) (string, error) { + u, err := url.Parse(endpoint) + if err != nil { + return "", err + } + + u.RawQuery, u.Fragment = "", "" + + path := u.Path + versionRe := regexp.MustCompile("v[0-9.]+/?") + + if version := versionRe.FindString(path); version != "" { + versionIndex := strings.Index(path, version) + u.Path = path[:versionIndex] + } + + return u.String(), nil +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/utils/choose_version.go b/vendor/github.com/gophercloud/gophercloud/openstack/utils/choose_version.go similarity index 77% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/utils/choose_version.go rename to vendor/github.com/gophercloud/gophercloud/openstack/utils/choose_version.go index c605d084444d..27da19f91a8d 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/openstack/utils/choose_version.go +++ b/vendor/github.com/gophercloud/gophercloud/openstack/utils/choose_version.go @@ -68,11 +68,6 @@ func ChooseVersion(client *gophercloud.ProviderClient, recognized []*Version) (* return nil, "", err } - byID := make(map[string]*Version) - for _, version := range recognized { - byID[version.ID] = version - } - var highest *Version var endpoint string @@ -84,20 +79,22 @@ func ChooseVersion(client *gophercloud.ProviderClient, recognized []*Version) (* } } - if matching, ok := byID[value.ID]; ok { - // Prefer a version that exactly matches the provided endpoint. - if href == identityEndpoint { - if href == "" { - return nil, "", fmt.Errorf("Endpoint missing in version %s response from %s", value.ID, client.IdentityBase) + for _, version := range recognized { + if strings.Contains(value.ID, version.ID) { + // Prefer a version that exactly matches the provided endpoint. + if href == identityEndpoint { + if href == "" { + return nil, "", fmt.Errorf("Endpoint missing in version %s response from %s", value.ID, client.IdentityBase) + } + return version, href, nil } - return matching, href, nil - } - // Otherwise, find the highest-priority version with a whitelisted status. - if goodStatus[strings.ToLower(value.Status)] { - if highest == nil || matching.Priority > highest.Priority { - highest = matching - endpoint = href + // Otherwise, find the highest-priority version with a whitelisted status. + if goodStatus[strings.ToLower(value.Status)] { + if highest == nil || version.Priority > highest.Priority { + highest = version + endpoint = href + } } } } diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/pagination/http.go b/vendor/github.com/gophercloud/gophercloud/pagination/http.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/pagination/http.go rename to vendor/github.com/gophercloud/gophercloud/pagination/http.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/pagination/linked.go b/vendor/github.com/gophercloud/gophercloud/pagination/linked.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/pagination/linked.go rename to vendor/github.com/gophercloud/gophercloud/pagination/linked.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/pagination/marker.go b/vendor/github.com/gophercloud/gophercloud/pagination/marker.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/pagination/marker.go rename to vendor/github.com/gophercloud/gophercloud/pagination/marker.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/pagination/pager.go b/vendor/github.com/gophercloud/gophercloud/pagination/pager.go similarity index 91% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/pagination/pager.go rename to vendor/github.com/gophercloud/gophercloud/pagination/pager.go index 6f1609ef2e3c..42c0b2dbe5b9 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/pagination/pager.go +++ b/vendor/github.com/gophercloud/gophercloud/pagination/pager.go @@ -22,7 +22,6 @@ var ( // Depending on the pagination strategy of a particular resource, there may be an additional subinterface that the result type // will need to implement. type Page interface { - // NextPageURL generates the URL for the page of data that follows this collection. // Return "" if no such page exists. NextPageURL() (string, error) @@ -42,6 +41,8 @@ type Pager struct { createPage func(r PageResult) Page + firstPage Page + Err error // Headers supplies additional HTTP headers to populate on each paged request. @@ -90,9 +91,18 @@ func (p Pager) EachPage(handler func(Page) (bool, error)) error { } currentURL := p.initialURL for { - currentPage, err := p.fetchNextPage(currentURL) - if err != nil { - return err + var currentPage Page + + // if first page has already been fetched, no need to fetch it again + if p.firstPage != nil { + currentPage = p.firstPage + p.firstPage = nil + } else { + var err error + currentPage, err = p.fetchNextPage(currentURL) + if err != nil { + return err + } } empty, err := currentPage.IsEmpty() @@ -129,23 +139,26 @@ func (p Pager) AllPages() (Page, error) { // body will contain the final concatenated Page body. var body reflect.Value - // Grab a test page to ascertain the page body type. - testPage, err := p.fetchNextPage(p.initialURL) + // Grab a first page to ascertain the page body type. + firstPage, err := p.fetchNextPage(p.initialURL) if err != nil { return nil, err } // Store the page type so we can use reflection to create a new mega-page of // that type. - pageType := reflect.TypeOf(testPage) + pageType := reflect.TypeOf(firstPage) - // if it's a single page, just return the testPage (first page) + // if it's a single page, just return the firstPage (first page) if _, found := pageType.FieldByName("SinglePageBase"); found { - return testPage, nil + return firstPage, nil } + // store the first page to avoid getting it twice + p.firstPage = firstPage + // Switch on the page body type. Recognized types are `map[string]interface{}`, // `[]byte`, and `[]interface{}`. - switch pb := testPage.GetBody().(type) { + switch pb := firstPage.GetBody().(type) { case map[string]interface{}: // key is the map key for the page body if the body type is `map[string]interface{}`. var key string diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/pagination/pkg.go b/vendor/github.com/gophercloud/gophercloud/pagination/pkg.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/pagination/pkg.go rename to vendor/github.com/gophercloud/gophercloud/pagination/pkg.go diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/pagination/single.go b/vendor/github.com/gophercloud/gophercloud/pagination/single.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/pagination/single.go rename to vendor/github.com/gophercloud/gophercloud/pagination/single.go diff --git a/vendor/github.com/gophercloud/gophercloud/params.go b/vendor/github.com/gophercloud/gophercloud/params.go new file mode 100644 index 000000000000..19b8cf7bf847 --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/params.go @@ -0,0 +1,475 @@ +package gophercloud + +import ( + "encoding/json" + "fmt" + "net/url" + "reflect" + "strconv" + "strings" + "time" +) + +/* +BuildRequestBody builds a map[string]interface from the given `struct`. If +parent is not an empty string, the final map[string]interface returned will +encapsulate the built one. For example: + + disk := 1 + createOpts := flavors.CreateOpts{ + ID: "1", + Name: "m1.tiny", + Disk: &disk, + RAM: 512, + VCPUs: 1, + RxTxFactor: 1.0, + } + + body, err := gophercloud.BuildRequestBody(createOpts, "flavor") + +The above example can be run as-is, however it is recommended to look at how +BuildRequestBody is used within Gophercloud to more fully understand how it +fits within the request process as a whole rather than use it directly as shown +above. +*/ +func BuildRequestBody(opts interface{}, parent string) (map[string]interface{}, error) { + optsValue := reflect.ValueOf(opts) + if optsValue.Kind() == reflect.Ptr { + optsValue = optsValue.Elem() + } + + optsType := reflect.TypeOf(opts) + if optsType.Kind() == reflect.Ptr { + optsType = optsType.Elem() + } + + optsMap := make(map[string]interface{}) + if optsValue.Kind() == reflect.Struct { + //fmt.Printf("optsValue.Kind() is a reflect.Struct: %+v\n", optsValue.Kind()) + for i := 0; i < optsValue.NumField(); i++ { + v := optsValue.Field(i) + f := optsType.Field(i) + + if f.Name != strings.Title(f.Name) { + //fmt.Printf("Skipping field: %s...\n", f.Name) + continue + } + + //fmt.Printf("Starting on field: %s...\n", f.Name) + + zero := isZero(v) + //fmt.Printf("v is zero?: %v\n", zero) + + // if the field has a required tag that's set to "true" + if requiredTag := f.Tag.Get("required"); requiredTag == "true" { + //fmt.Printf("Checking required field [%s]:\n\tv: %+v\n\tisZero:%v\n", f.Name, v.Interface(), zero) + // if the field's value is zero, return a missing-argument error + if zero { + // if the field has a 'required' tag, it can't have a zero-value + err := ErrMissingInput{} + err.Argument = f.Name + return nil, err + } + } + + if xorTag := f.Tag.Get("xor"); xorTag != "" { + //fmt.Printf("Checking `xor` tag for field [%s] with value %+v:\n\txorTag: %s\n", f.Name, v, xorTag) + xorField := optsValue.FieldByName(xorTag) + var xorFieldIsZero bool + if reflect.ValueOf(xorField.Interface()) == reflect.Zero(xorField.Type()) { + xorFieldIsZero = true + } else { + if xorField.Kind() == reflect.Ptr { + xorField = xorField.Elem() + } + xorFieldIsZero = isZero(xorField) + } + if !(zero != xorFieldIsZero) { + err := ErrMissingInput{} + err.Argument = fmt.Sprintf("%s/%s", f.Name, xorTag) + err.Info = fmt.Sprintf("Exactly one of %s and %s must be provided", f.Name, xorTag) + return nil, err + } + } + + if orTag := f.Tag.Get("or"); orTag != "" { + //fmt.Printf("Checking `or` tag for field with:\n\tname: %+v\n\torTag:%s\n", f.Name, orTag) + //fmt.Printf("field is zero?: %v\n", zero) + if zero { + orField := optsValue.FieldByName(orTag) + var orFieldIsZero bool + if reflect.ValueOf(orField.Interface()) == reflect.Zero(orField.Type()) { + orFieldIsZero = true + } else { + if orField.Kind() == reflect.Ptr { + orField = orField.Elem() + } + orFieldIsZero = isZero(orField) + } + if orFieldIsZero { + err := ErrMissingInput{} + err.Argument = fmt.Sprintf("%s/%s", f.Name, orTag) + err.Info = fmt.Sprintf("At least one of %s and %s must be provided", f.Name, orTag) + return nil, err + } + } + } + + jsonTag := f.Tag.Get("json") + if jsonTag == "-" { + continue + } + + if v.Kind() == reflect.Struct || (v.Kind() == reflect.Ptr && v.Elem().Kind() == reflect.Struct) { + if zero { + //fmt.Printf("value before change: %+v\n", optsValue.Field(i)) + if jsonTag != "" { + jsonTagPieces := strings.Split(jsonTag, ",") + if len(jsonTagPieces) > 1 && jsonTagPieces[1] == "omitempty" { + if v.CanSet() { + if !v.IsNil() { + if v.Kind() == reflect.Ptr { + v.Set(reflect.Zero(v.Type())) + } + } + //fmt.Printf("value after change: %+v\n", optsValue.Field(i)) + } + } + } + continue + } + + //fmt.Printf("Calling BuildRequestBody with:\n\tv: %+v\n\tf.Name:%s\n", v.Interface(), f.Name) + _, err := BuildRequestBody(v.Interface(), f.Name) + if err != nil { + return nil, err + } + } + } + + //fmt.Printf("opts: %+v \n", opts) + + b, err := json.Marshal(opts) + if err != nil { + return nil, err + } + + //fmt.Printf("string(b): %s\n", string(b)) + + err = json.Unmarshal(b, &optsMap) + if err != nil { + return nil, err + } + + //fmt.Printf("optsMap: %+v\n", optsMap) + + if parent != "" { + optsMap = map[string]interface{}{parent: optsMap} + } + //fmt.Printf("optsMap after parent added: %+v\n", optsMap) + return optsMap, nil + } + // Return an error if the underlying type of 'opts' isn't a struct. + return nil, fmt.Errorf("Options type is not a struct.") +} + +// EnabledState is a convenience type, mostly used in Create and Update +// operations. Because the zero value of a bool is FALSE, we need to use a +// pointer instead to indicate zero-ness. +type EnabledState *bool + +// Convenience vars for EnabledState values. +var ( + iTrue = true + iFalse = false + + Enabled EnabledState = &iTrue + Disabled EnabledState = &iFalse +) + +// IPVersion is a type for the possible IP address versions. Valid instances +// are IPv4 and IPv6 +type IPVersion int + +const ( + // IPv4 is used for IP version 4 addresses + IPv4 IPVersion = 4 + // IPv6 is used for IP version 6 addresses + IPv6 IPVersion = 6 +) + +// IntToPointer is a function for converting integers into integer pointers. +// This is useful when passing in options to operations. +func IntToPointer(i int) *int { + return &i +} + +/* +MaybeString is an internal function to be used by request methods in individual +resource packages. + +It takes a string that might be a zero value and returns either a pointer to its +address or nil. This is useful for allowing users to conveniently omit values +from an options struct by leaving them zeroed, but still pass nil to the JSON +serializer so they'll be omitted from the request body. +*/ +func MaybeString(original string) *string { + if original != "" { + return &original + } + return nil +} + +/* +MaybeInt is an internal function to be used by request methods in individual +resource packages. + +Like MaybeString, it accepts an int that may or may not be a zero value, and +returns either a pointer to its address or nil. It's intended to hint that the +JSON serializer should omit its field. +*/ +func MaybeInt(original int) *int { + if original != 0 { + return &original + } + return nil +} + +/* +func isUnderlyingStructZero(v reflect.Value) bool { + switch v.Kind() { + case reflect.Ptr: + return isUnderlyingStructZero(v.Elem()) + default: + return isZero(v) + } +} +*/ + +var t time.Time + +func isZero(v reflect.Value) bool { + //fmt.Printf("\n\nchecking isZero for value: %+v\n", v) + switch v.Kind() { + case reflect.Ptr: + if v.IsNil() { + return true + } + return false + case reflect.Func, reflect.Map, reflect.Slice: + return v.IsNil() + case reflect.Array: + z := true + for i := 0; i < v.Len(); i++ { + z = z && isZero(v.Index(i)) + } + return z + case reflect.Struct: + if v.Type() == reflect.TypeOf(t) { + if v.Interface().(time.Time).IsZero() { + return true + } + return false + } + z := true + for i := 0; i < v.NumField(); i++ { + z = z && isZero(v.Field(i)) + } + return z + } + // Compare other types directly: + z := reflect.Zero(v.Type()) + //fmt.Printf("zero type for value: %+v\n\n\n", z) + return v.Interface() == z.Interface() +} + +/* +BuildQueryString is an internal function to be used by request methods in +individual resource packages. + +It accepts a tagged structure and expands it into a URL struct. Field names are +converted into query parameters based on a "q" tag. For example: + + type struct Something { + Bar string `q:"x_bar"` + Baz int `q:"lorem_ipsum"` + } + + instance := Something{ + Bar: "AAA", + Baz: "BBB", + } + +will be converted into "?x_bar=AAA&lorem_ipsum=BBB". + +The struct's fields may be strings, integers, or boolean values. Fields left at +their type's zero value will be omitted from the query. +*/ +func BuildQueryString(opts interface{}) (*url.URL, error) { + optsValue := reflect.ValueOf(opts) + if optsValue.Kind() == reflect.Ptr { + optsValue = optsValue.Elem() + } + + optsType := reflect.TypeOf(opts) + if optsType.Kind() == reflect.Ptr { + optsType = optsType.Elem() + } + + params := url.Values{} + + if optsValue.Kind() == reflect.Struct { + for i := 0; i < optsValue.NumField(); i++ { + v := optsValue.Field(i) + f := optsType.Field(i) + qTag := f.Tag.Get("q") + + // if the field has a 'q' tag, it goes in the query string + if qTag != "" { + tags := strings.Split(qTag, ",") + + // if the field is set, add it to the slice of query pieces + if !isZero(v) { + loop: + switch v.Kind() { + case reflect.Ptr: + v = v.Elem() + goto loop + case reflect.String: + params.Add(tags[0], v.String()) + case reflect.Int: + params.Add(tags[0], strconv.FormatInt(v.Int(), 10)) + case reflect.Bool: + params.Add(tags[0], strconv.FormatBool(v.Bool())) + case reflect.Slice: + switch v.Type().Elem() { + case reflect.TypeOf(0): + for i := 0; i < v.Len(); i++ { + params.Add(tags[0], strconv.FormatInt(v.Index(i).Int(), 10)) + } + default: + for i := 0; i < v.Len(); i++ { + params.Add(tags[0], v.Index(i).String()) + } + } + case reflect.Map: + if v.Type().Key().Kind() == reflect.String && v.Type().Elem().Kind() == reflect.String { + var s []string + for _, k := range v.MapKeys() { + value := v.MapIndex(k).String() + s = append(s, fmt.Sprintf("'%s':'%s'", k.String(), value)) + } + params.Add(tags[0], fmt.Sprintf("{%s}", strings.Join(s, ", "))) + } + } + } else { + // if the field has a 'required' tag, it can't have a zero-value + if requiredTag := f.Tag.Get("required"); requiredTag == "true" { + return &url.URL{}, fmt.Errorf("Required query parameter [%s] not set.", f.Name) + } + } + } + } + + return &url.URL{RawQuery: params.Encode()}, nil + } + // Return an error if the underlying type of 'opts' isn't a struct. + return nil, fmt.Errorf("Options type is not a struct.") +} + +/* +BuildHeaders is an internal function to be used by request methods in +individual resource packages. + +It accepts an arbitrary tagged structure and produces a string map that's +suitable for use as the HTTP headers of an outgoing request. Field names are +mapped to header names based in "h" tags. + + type struct Something { + Bar string `h:"x_bar"` + Baz int `h:"lorem_ipsum"` + } + + instance := Something{ + Bar: "AAA", + Baz: "BBB", + } + +will be converted into: + + map[string]string{ + "x_bar": "AAA", + "lorem_ipsum": "BBB", + } + +Untagged fields and fields left at their zero values are skipped. Integers, +booleans and string values are supported. +*/ +func BuildHeaders(opts interface{}) (map[string]string, error) { + optsValue := reflect.ValueOf(opts) + if optsValue.Kind() == reflect.Ptr { + optsValue = optsValue.Elem() + } + + optsType := reflect.TypeOf(opts) + if optsType.Kind() == reflect.Ptr { + optsType = optsType.Elem() + } + + optsMap := make(map[string]string) + if optsValue.Kind() == reflect.Struct { + for i := 0; i < optsValue.NumField(); i++ { + v := optsValue.Field(i) + f := optsType.Field(i) + hTag := f.Tag.Get("h") + + // if the field has a 'h' tag, it goes in the header + if hTag != "" { + tags := strings.Split(hTag, ",") + + // if the field is set, add it to the slice of query pieces + if !isZero(v) { + switch v.Kind() { + case reflect.String: + optsMap[tags[0]] = v.String() + case reflect.Int: + optsMap[tags[0]] = strconv.FormatInt(v.Int(), 10) + case reflect.Bool: + optsMap[tags[0]] = strconv.FormatBool(v.Bool()) + } + } else { + // if the field has a 'required' tag, it can't have a zero-value + if requiredTag := f.Tag.Get("required"); requiredTag == "true" { + return optsMap, fmt.Errorf("Required header [%s] not set.", f.Name) + } + } + } + + } + return optsMap, nil + } + // Return an error if the underlying type of 'opts' isn't a struct. + return optsMap, fmt.Errorf("Options type is not a struct.") +} + +// IDSliceToQueryString takes a slice of elements and converts them into a query +// string. For example, if name=foo and slice=[]int{20, 40, 60}, then the +// result would be `?name=20&name=40&name=60' +func IDSliceToQueryString(name string, ids []int) string { + str := "" + for k, v := range ids { + if k == 0 { + str += "?" + } else { + str += "&" + } + str += fmt.Sprintf("%s=%s", name, strconv.Itoa(v)) + } + return str +} + +// IntWithinRange returns TRUE if an integer falls within a defined range, and +// FALSE if not. +func IntWithinRange(val, min, max int) bool { + return val > min && val < max +} diff --git a/vendor/github.com/gophercloud/gophercloud/provider_client.go b/vendor/github.com/gophercloud/gophercloud/provider_client.go new file mode 100644 index 000000000000..95fa11a78863 --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/provider_client.go @@ -0,0 +1,391 @@ +package gophercloud + +import ( + "bytes" + "encoding/json" + "io" + "io/ioutil" + "net/http" + "strings" + "sync" +) + +// DefaultUserAgent is the default User-Agent string set in the request header. +const DefaultUserAgent = "gophercloud/2.0.0" + +// UserAgent represents a User-Agent header. +type UserAgent struct { + // prepend is the slice of User-Agent strings to prepend to DefaultUserAgent. + // All the strings to prepend are accumulated and prepended in the Join method. + prepend []string +} + +// Prepend prepends a user-defined string to the default User-Agent string. Users +// may pass in one or more strings to prepend. +func (ua *UserAgent) Prepend(s ...string) { + ua.prepend = append(s, ua.prepend...) +} + +// Join concatenates all the user-defined User-Agend strings with the default +// Gophercloud User-Agent string. +func (ua *UserAgent) Join() string { + uaSlice := append(ua.prepend, DefaultUserAgent) + return strings.Join(uaSlice, " ") +} + +// ProviderClient stores details that are required to interact with any +// services within a specific provider's API. +// +// Generally, you acquire a ProviderClient by calling the NewClient method in +// the appropriate provider's child package, providing whatever authentication +// credentials are required. +type ProviderClient struct { + // IdentityBase is the base URL used for a particular provider's identity + // service - it will be used when issuing authenticatation requests. It + // should point to the root resource of the identity service, not a specific + // identity version. + IdentityBase string + + // IdentityEndpoint is the identity endpoint. This may be a specific version + // of the identity service. If this is the case, this endpoint is used rather + // than querying versions first. + IdentityEndpoint string + + // TokenID is the ID of the most recently issued valid token. + // NOTE: Aside from within a custom ReauthFunc, this field shouldn't be set by an application. + // To safely read or write this value, call `Token` or `SetToken`, respectively + TokenID string + + // EndpointLocator describes how this provider discovers the endpoints for + // its constituent services. + EndpointLocator EndpointLocator + + // HTTPClient allows users to interject arbitrary http, https, or other transit behaviors. + HTTPClient http.Client + + // UserAgent represents the User-Agent header in the HTTP request. + UserAgent UserAgent + + // ReauthFunc is the function used to re-authenticate the user if the request + // fails with a 401 HTTP response code. This a needed because there may be multiple + // authentication functions for different Identity service versions. + ReauthFunc func() error + + mut *sync.RWMutex + + reauthmut *reauthlock +} + +type reauthlock struct { + sync.RWMutex + reauthing bool +} + +// AuthenticatedHeaders returns a map of HTTP headers that are common for all +// authenticated service requests. +func (client *ProviderClient) AuthenticatedHeaders() (m map[string]string) { + if client.reauthmut != nil { + client.reauthmut.RLock() + if client.reauthmut.reauthing { + client.reauthmut.RUnlock() + return + } + client.reauthmut.RUnlock() + } + t := client.Token() + if t == "" { + return + } + return map[string]string{"X-Auth-Token": t} +} + +// UseTokenLock creates a mutex that is used to allow safe concurrent access to the auth token. +// If the application's ProviderClient is not used concurrently, this doesn't need to be called. +func (client *ProviderClient) UseTokenLock() { + client.mut = new(sync.RWMutex) + client.reauthmut = new(reauthlock) +} + +// Token safely reads the value of the auth token from the ProviderClient. Applications should +// call this method to access the token instead of the TokenID field +func (client *ProviderClient) Token() string { + if client.mut != nil { + client.mut.RLock() + defer client.mut.RUnlock() + } + return client.TokenID +} + +// SetToken safely sets the value of the auth token in the ProviderClient. Applications may +// use this method in a custom ReauthFunc +func (client *ProviderClient) SetToken(t string) { + if client.mut != nil { + client.mut.Lock() + defer client.mut.Unlock() + } + client.TokenID = t +} + +//Reauthenticate calls client.ReauthFunc in a thread-safe way. If this is +//called because of a 401 response, the caller may pass the previous token. In +//this case, the reauthentication can be skipped if another thread has already +//reauthenticated in the meantime. If no previous token is known, an empty +//string should be passed instead to force unconditional reauthentication. +func (client *ProviderClient) Reauthenticate(previousToken string) (err error) { + if client.ReauthFunc == nil { + return nil + } + + if client.mut == nil { + return client.ReauthFunc() + } + client.mut.Lock() + defer client.mut.Unlock() + + client.reauthmut.Lock() + client.reauthmut.reauthing = true + client.reauthmut.Unlock() + + if previousToken == "" || client.TokenID == previousToken { + err = client.ReauthFunc() + } + + client.reauthmut.Lock() + client.reauthmut.reauthing = false + client.reauthmut.Unlock() + return +} + +// RequestOpts customizes the behavior of the provider.Request() method. +type RequestOpts struct { + // JSONBody, if provided, will be encoded as JSON and used as the body of the HTTP request. The + // content type of the request will default to "application/json" unless overridden by MoreHeaders. + // It's an error to specify both a JSONBody and a RawBody. + JSONBody interface{} + // RawBody contains an io.Reader that will be consumed by the request directly. No content-type + // will be set unless one is provided explicitly by MoreHeaders. + RawBody io.Reader + // JSONResponse, if provided, will be populated with the contents of the response body parsed as + // JSON. + JSONResponse interface{} + // OkCodes contains a list of numeric HTTP status codes that should be interpreted as success. If + // the response has a different code, an error will be returned. + OkCodes []int + // MoreHeaders specifies additional HTTP headers to be provide on the request. If a header is + // provided with a blank value (""), that header will be *omitted* instead: use this to suppress + // the default Accept header or an inferred Content-Type, for example. + MoreHeaders map[string]string + // ErrorContext specifies the resource error type to return if an error is encountered. + // This lets resources override default error messages based on the response status code. + ErrorContext error +} + +var applicationJSON = "application/json" + +// Request performs an HTTP request using the ProviderClient's current HTTPClient. An authentication +// header will automatically be provided. +func (client *ProviderClient) Request(method, url string, options *RequestOpts) (*http.Response, error) { + var body io.Reader + var contentType *string + + // Derive the content body by either encoding an arbitrary object as JSON, or by taking a provided + // io.ReadSeeker as-is. Default the content-type to application/json. + if options.JSONBody != nil { + if options.RawBody != nil { + panic("Please provide only one of JSONBody or RawBody to gophercloud.Request().") + } + + rendered, err := json.Marshal(options.JSONBody) + if err != nil { + return nil, err + } + + body = bytes.NewReader(rendered) + contentType = &applicationJSON + } + + if options.RawBody != nil { + body = options.RawBody + } + + // Construct the http.Request. + req, err := http.NewRequest(method, url, body) + if err != nil { + return nil, err + } + + // Populate the request headers. Apply options.MoreHeaders last, to give the caller the chance to + // modify or omit any header. + if contentType != nil { + req.Header.Set("Content-Type", *contentType) + } + req.Header.Set("Accept", applicationJSON) + + // Set the User-Agent header + req.Header.Set("User-Agent", client.UserAgent.Join()) + + if options.MoreHeaders != nil { + for k, v := range options.MoreHeaders { + if v != "" { + req.Header.Set(k, v) + } else { + req.Header.Del(k) + } + } + } + + // get latest token from client + for k, v := range client.AuthenticatedHeaders() { + req.Header.Set(k, v) + } + + // Set connection parameter to close the connection immediately when we've got the response + req.Close = true + + prereqtok := req.Header.Get("X-Auth-Token") + + // Issue the request. + resp, err := client.HTTPClient.Do(req) + if err != nil { + return nil, err + } + + // Allow default OkCodes if none explicitly set + if options.OkCodes == nil { + options.OkCodes = defaultOkCodes(method) + } + + // Validate the HTTP response status. + var ok bool + for _, code := range options.OkCodes { + if resp.StatusCode == code { + ok = true + break + } + } + + if !ok { + body, _ := ioutil.ReadAll(resp.Body) + resp.Body.Close() + respErr := ErrUnexpectedResponseCode{ + URL: url, + Method: method, + Expected: options.OkCodes, + Actual: resp.StatusCode, + Body: body, + } + + errType := options.ErrorContext + switch resp.StatusCode { + case http.StatusBadRequest: + err = ErrDefault400{respErr} + if error400er, ok := errType.(Err400er); ok { + err = error400er.Error400(respErr) + } + case http.StatusUnauthorized: + if client.ReauthFunc != nil { + err = client.Reauthenticate(prereqtok) + if err != nil { + e := &ErrUnableToReauthenticate{} + e.ErrOriginal = respErr + return nil, e + } + if options.RawBody != nil { + if seeker, ok := options.RawBody.(io.Seeker); ok { + seeker.Seek(0, 0) + } + } + // make a new call to request with a nil reauth func in order to avoid infinite loop + reauthFunc := client.ReauthFunc + client.ReauthFunc = nil + resp, err = client.Request(method, url, options) + client.ReauthFunc = reauthFunc + if err != nil { + switch err.(type) { + case *ErrUnexpectedResponseCode: + e := &ErrErrorAfterReauthentication{} + e.ErrOriginal = err.(*ErrUnexpectedResponseCode) + return nil, e + default: + e := &ErrErrorAfterReauthentication{} + e.ErrOriginal = err + return nil, e + } + } + return resp, nil + } + err = ErrDefault401{respErr} + if error401er, ok := errType.(Err401er); ok { + err = error401er.Error401(respErr) + } + case http.StatusForbidden: + err = ErrDefault403{respErr} + if error403er, ok := errType.(Err403er); ok { + err = error403er.Error403(respErr) + } + case http.StatusNotFound: + err = ErrDefault404{respErr} + if error404er, ok := errType.(Err404er); ok { + err = error404er.Error404(respErr) + } + case http.StatusMethodNotAllowed: + err = ErrDefault405{respErr} + if error405er, ok := errType.(Err405er); ok { + err = error405er.Error405(respErr) + } + case http.StatusRequestTimeout: + err = ErrDefault408{respErr} + if error408er, ok := errType.(Err408er); ok { + err = error408er.Error408(respErr) + } + case 429: + err = ErrDefault429{respErr} + if error429er, ok := errType.(Err429er); ok { + err = error429er.Error429(respErr) + } + case http.StatusInternalServerError: + err = ErrDefault500{respErr} + if error500er, ok := errType.(Err500er); ok { + err = error500er.Error500(respErr) + } + case http.StatusServiceUnavailable: + err = ErrDefault503{respErr} + if error503er, ok := errType.(Err503er); ok { + err = error503er.Error503(respErr) + } + } + + if err == nil { + err = respErr + } + + return resp, err + } + + // Parse the response body as JSON, if requested to do so. + if options.JSONResponse != nil { + defer resp.Body.Close() + if err := json.NewDecoder(resp.Body).Decode(options.JSONResponse); err != nil { + return nil, err + } + } + + return resp, nil +} + +func defaultOkCodes(method string) []int { + switch { + case method == "GET": + return []int{200} + case method == "POST": + return []int{201, 202} + case method == "PUT": + return []int{201, 202} + case method == "PATCH": + return []int{200, 202, 204} + case method == "DELETE": + return []int{202, 204} + } + + return []int{} +} diff --git a/vendor/github.com/gophercloud/gophercloud/results.go b/vendor/github.com/gophercloud/gophercloud/results.go new file mode 100644 index 000000000000..30d3b15599c1 --- /dev/null +++ b/vendor/github.com/gophercloud/gophercloud/results.go @@ -0,0 +1,446 @@ +package gophercloud + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "net/http" + "reflect" + "strconv" + "time" +) + +/* +Result is an internal type to be used by individual resource packages, but its +methods will be available on a wide variety of user-facing embedding types. + +It acts as a base struct that other Result types, returned from request +functions, can embed for convenience. All Results capture basic information +from the HTTP transaction that was performed, including the response body, +HTTP headers, and any errors that happened. + +Generally, each Result type will have an Extract method that can be used to +further interpret the result's payload in a specific context. Extensions or +providers can then provide additional extraction functions to pull out +provider- or extension-specific information as well. +*/ +type Result struct { + // Body is the payload of the HTTP response from the server. In most cases, + // this will be the deserialized JSON structure. + Body interface{} + + // Header contains the HTTP header structure from the original response. + Header http.Header + + // Err is an error that occurred during the operation. It's deferred until + // extraction to make it easier to chain the Extract call. + Err error +} + +// ExtractInto allows users to provide an object into which `Extract` will extract +// the `Result.Body`. This would be useful for OpenStack providers that have +// different fields in the response object than OpenStack proper. +func (r Result) ExtractInto(to interface{}) error { + if r.Err != nil { + return r.Err + } + + if reader, ok := r.Body.(io.Reader); ok { + if readCloser, ok := reader.(io.Closer); ok { + defer readCloser.Close() + } + return json.NewDecoder(reader).Decode(to) + } + + b, err := json.Marshal(r.Body) + if err != nil { + return err + } + err = json.Unmarshal(b, to) + + return err +} + +func (r Result) extractIntoPtr(to interface{}, label string) error { + if label == "" { + return r.ExtractInto(&to) + } + + var m map[string]interface{} + err := r.ExtractInto(&m) + if err != nil { + return err + } + + b, err := json.Marshal(m[label]) + if err != nil { + return err + } + + toValue := reflect.ValueOf(to) + if toValue.Kind() == reflect.Ptr { + toValue = toValue.Elem() + } + + switch toValue.Kind() { + case reflect.Slice: + typeOfV := toValue.Type().Elem() + if typeOfV.Kind() == reflect.Struct { + if typeOfV.NumField() > 0 && typeOfV.Field(0).Anonymous { + newSlice := reflect.MakeSlice(reflect.SliceOf(typeOfV), 0, 0) + + for _, v := range m[label].([]interface{}) { + // For each iteration of the slice, we create a new struct. + // This is to work around a bug where elements of a slice + // are reused and not overwritten when the same copy of the + // struct is used: + // + // https://github.com/golang/go/issues/21092 + // https://github.com/golang/go/issues/24155 + // https://play.golang.org/p/NHo3ywlPZli + newType := reflect.New(typeOfV).Elem() + + b, err := json.Marshal(v) + if err != nil { + return err + } + + // This is needed for structs with an UnmarshalJSON method. + // Technically this is just unmarshalling the response into + // a struct that is never used, but it's good enough to + // trigger the UnmarshalJSON method. + for i := 0; i < newType.NumField(); i++ { + s := newType.Field(i).Addr().Interface() + + // Unmarshal is used rather than NewDecoder to also work + // around the above-mentioned bug. + err = json.Unmarshal(b, s) + if err != nil { + return err + } + } + + newSlice = reflect.Append(newSlice, newType) + } + + // "to" should now be properly modeled to receive the + // JSON response body and unmarshal into all the correct + // fields of the struct or composed extension struct + // at the end of this method. + toValue.Set(newSlice) + } + } + case reflect.Struct: + typeOfV := toValue.Type() + if typeOfV.NumField() > 0 && typeOfV.Field(0).Anonymous { + for i := 0; i < toValue.NumField(); i++ { + toField := toValue.Field(i) + if toField.Kind() == reflect.Struct { + s := toField.Addr().Interface() + err = json.NewDecoder(bytes.NewReader(b)).Decode(s) + if err != nil { + return err + } + } + } + } + } + + err = json.Unmarshal(b, &to) + return err +} + +// ExtractIntoStructPtr will unmarshal the Result (r) into the provided +// interface{} (to). +// +// NOTE: For internal use only +// +// `to` must be a pointer to an underlying struct type +// +// If provided, `label` will be filtered out of the response +// body prior to `r` being unmarshalled into `to`. +func (r Result) ExtractIntoStructPtr(to interface{}, label string) error { + if r.Err != nil { + return r.Err + } + + t := reflect.TypeOf(to) + if k := t.Kind(); k != reflect.Ptr { + return fmt.Errorf("Expected pointer, got %v", k) + } + switch t.Elem().Kind() { + case reflect.Struct: + return r.extractIntoPtr(to, label) + default: + return fmt.Errorf("Expected pointer to struct, got: %v", t) + } +} + +// ExtractIntoSlicePtr will unmarshal the Result (r) into the provided +// interface{} (to). +// +// NOTE: For internal use only +// +// `to` must be a pointer to an underlying slice type +// +// If provided, `label` will be filtered out of the response +// body prior to `r` being unmarshalled into `to`. +func (r Result) ExtractIntoSlicePtr(to interface{}, label string) error { + if r.Err != nil { + return r.Err + } + + t := reflect.TypeOf(to) + if k := t.Kind(); k != reflect.Ptr { + return fmt.Errorf("Expected pointer, got %v", k) + } + switch t.Elem().Kind() { + case reflect.Slice: + return r.extractIntoPtr(to, label) + default: + return fmt.Errorf("Expected pointer to slice, got: %v", t) + } +} + +// PrettyPrintJSON creates a string containing the full response body as +// pretty-printed JSON. It's useful for capturing test fixtures and for +// debugging extraction bugs. If you include its output in an issue related to +// a buggy extraction function, we will all love you forever. +func (r Result) PrettyPrintJSON() string { + pretty, err := json.MarshalIndent(r.Body, "", " ") + if err != nil { + panic(err.Error()) + } + return string(pretty) +} + +// ErrResult is an internal type to be used by individual resource packages, but +// its methods will be available on a wide variety of user-facing embedding +// types. +// +// It represents results that only contain a potential error and +// nothing else. Usually, if the operation executed successfully, the Err field +// will be nil; otherwise it will be stocked with a relevant error. Use the +// ExtractErr method +// to cleanly pull it out. +type ErrResult struct { + Result +} + +// ExtractErr is a function that extracts error information, or nil, from a result. +func (r ErrResult) ExtractErr() error { + return r.Err +} + +/* +HeaderResult is an internal type to be used by individual resource packages, but +its methods will be available on a wide variety of user-facing embedding types. + +It represents a result that only contains an error (possibly nil) and an +http.Header. This is used, for example, by the objectstorage packages in +openstack, because most of the operations don't return response bodies, but do +have relevant information in headers. +*/ +type HeaderResult struct { + Result +} + +// ExtractInto allows users to provide an object into which `Extract` will +// extract the http.Header headers of the result. +func (r HeaderResult) ExtractInto(to interface{}) error { + if r.Err != nil { + return r.Err + } + + tmpHeaderMap := map[string]string{} + for k, v := range r.Header { + if len(v) > 0 { + tmpHeaderMap[k] = v[0] + } + } + + b, err := json.Marshal(tmpHeaderMap) + if err != nil { + return err + } + err = json.Unmarshal(b, to) + + return err +} + +// RFC3339Milli describes a common time format used by some API responses. +const RFC3339Milli = "2006-01-02T15:04:05.999999Z" + +type JSONRFC3339Milli time.Time + +func (jt *JSONRFC3339Milli) UnmarshalJSON(data []byte) error { + b := bytes.NewBuffer(data) + dec := json.NewDecoder(b) + var s string + if err := dec.Decode(&s); err != nil { + return err + } + t, err := time.Parse(RFC3339Milli, s) + if err != nil { + return err + } + *jt = JSONRFC3339Milli(t) + return nil +} + +const RFC3339MilliNoZ = "2006-01-02T15:04:05.999999" + +type JSONRFC3339MilliNoZ time.Time + +func (jt *JSONRFC3339MilliNoZ) UnmarshalJSON(data []byte) error { + var s string + if err := json.Unmarshal(data, &s); err != nil { + return err + } + if s == "" { + return nil + } + t, err := time.Parse(RFC3339MilliNoZ, s) + if err != nil { + return err + } + *jt = JSONRFC3339MilliNoZ(t) + return nil +} + +type JSONRFC1123 time.Time + +func (jt *JSONRFC1123) UnmarshalJSON(data []byte) error { + var s string + if err := json.Unmarshal(data, &s); err != nil { + return err + } + if s == "" { + return nil + } + t, err := time.Parse(time.RFC1123, s) + if err != nil { + return err + } + *jt = JSONRFC1123(t) + return nil +} + +type JSONUnix time.Time + +func (jt *JSONUnix) UnmarshalJSON(data []byte) error { + var s string + if err := json.Unmarshal(data, &s); err != nil { + return err + } + if s == "" { + return nil + } + unix, err := strconv.ParseInt(s, 10, 64) + if err != nil { + return err + } + t = time.Unix(unix, 0) + *jt = JSONUnix(t) + return nil +} + +// RFC3339NoZ is the time format used in Heat (Orchestration). +const RFC3339NoZ = "2006-01-02T15:04:05" + +type JSONRFC3339NoZ time.Time + +func (jt *JSONRFC3339NoZ) UnmarshalJSON(data []byte) error { + var s string + if err := json.Unmarshal(data, &s); err != nil { + return err + } + if s == "" { + return nil + } + t, err := time.Parse(RFC3339NoZ, s) + if err != nil { + return err + } + *jt = JSONRFC3339NoZ(t) + return nil +} + +// RFC3339ZNoT is the time format used in Zun (Containers Service). +const RFC3339ZNoT = "2006-01-02 15:04:05-07:00" + +type JSONRFC3339ZNoT time.Time + +func (jt *JSONRFC3339ZNoT) UnmarshalJSON(data []byte) error { + var s string + if err := json.Unmarshal(data, &s); err != nil { + return err + } + if s == "" { + return nil + } + t, err := time.Parse(RFC3339ZNoT, s) + if err != nil { + return err + } + *jt = JSONRFC3339ZNoT(t) + return nil +} + +// RFC3339ZNoTNoZ is another time format used in Zun (Containers Service). +const RFC3339ZNoTNoZ = "2006-01-02 15:04:05" + +type JSONRFC3339ZNoTNoZ time.Time + +func (jt *JSONRFC3339ZNoTNoZ) UnmarshalJSON(data []byte) error { + var s string + if err := json.Unmarshal(data, &s); err != nil { + return err + } + if s == "" { + return nil + } + t, err := time.Parse(RFC3339ZNoTNoZ, s) + if err != nil { + return err + } + *jt = JSONRFC3339ZNoTNoZ(t) + return nil +} + +/* +Link is an internal type to be used in packages of collection resources that are +paginated in a certain way. + +It's a response substructure common to many paginated collection results that is +used to point to related pages. Usually, the one we care about is the one with +Rel field set to "next". +*/ +type Link struct { + Href string `json:"href"` + Rel string `json:"rel"` +} + +/* +ExtractNextURL is an internal function useful for packages of collection +resources that are paginated in a certain way. + +It attempts to extract the "next" URL from slice of Link structs, or +"" if no such URL is present. +*/ +func ExtractNextURL(links []Link) (string, error) { + var url string + + for _, l := range links { + if l.Rel == "next" { + url = l.Href + } + } + + if url == "" { + return "", nil + } + + return url, nil +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/service_client.go b/vendor/github.com/gophercloud/gophercloud/service_client.go similarity index 80% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/service_client.go rename to vendor/github.com/gophercloud/gophercloud/service_client.go index 1160fefa7c2c..2734510e1b45 100644 --- a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/service_client.go +++ b/vendor/github.com/gophercloud/gophercloud/service_client.go @@ -28,6 +28,10 @@ type ServiceClient struct { // The microversion of the service to use. Set this to use a particular microversion. Microversion string + + // MoreHeaders allows users (or Gophercloud) to set service-wide headers on requests. Put another way, + // values set in this field will be set on all the HTTP requests the service client sends. + MoreHeaders map[string]string } // ResourceBaseURL returns the base URL of any resources used by this service. It MUST end with a /. @@ -108,15 +112,39 @@ func (client *ServiceClient) Delete(url string, opts *RequestOpts) (*http.Respon return client.Request("DELETE", url, opts) } +// Head calls `Request` with the "HEAD" HTTP verb. +func (client *ServiceClient) Head(url string, opts *RequestOpts) (*http.Response, error) { + if opts == nil { + opts = new(RequestOpts) + } + client.initReqOpts(url, nil, nil, opts) + return client.Request("HEAD", url, opts) +} + func (client *ServiceClient) setMicroversionHeader(opts *RequestOpts) { switch client.Type { case "compute": opts.MoreHeaders["X-OpenStack-Nova-API-Version"] = client.Microversion case "sharev2": opts.MoreHeaders["X-OpenStack-Manila-API-Version"] = client.Microversion + case "volume": + opts.MoreHeaders["X-OpenStack-Volume-API-Version"] = client.Microversion } if client.Type != "" { opts.MoreHeaders["OpenStack-API-Version"] = client.Type + " " + client.Microversion } } + +// Request carries out the HTTP operation for the service client +func (client *ServiceClient) Request(method, url string, options *RequestOpts) (*http.Response, error) { + if len(client.MoreHeaders) > 0 { + if options == nil { + options = new(RequestOpts) + } + for k, v := range client.MoreHeaders { + options.MoreHeaders[k] = v + } + } + return client.ProviderClient.Request(method, url, options) +} diff --git a/vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/util.go b/vendor/github.com/gophercloud/gophercloud/util.go similarity index 100% rename from vendor/github.com/hashicorp/go-discover/provider/os/vendor/github.com/gophercloud/gophercloud/util.go rename to vendor/github.com/gophercloud/gophercloud/util.go diff --git a/vendor/github.com/gorilla/context/LICENSE b/vendor/github.com/gorilla/context/LICENSE deleted file mode 100644 index 0e5fb872800d..000000000000 --- a/vendor/github.com/gorilla/context/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2012 Rodrigo Moraes. 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/github.com/gorilla/context/README.md b/vendor/github.com/gorilla/context/README.md deleted file mode 100644 index 08f86693bcd8..000000000000 --- a/vendor/github.com/gorilla/context/README.md +++ /dev/null @@ -1,10 +0,0 @@ -context -======= -[![Build Status](https://travis-ci.org/gorilla/context.png?branch=master)](https://travis-ci.org/gorilla/context) - -gorilla/context is a general purpose registry for global request variables. - -> Note: gorilla/context, having been born well before `context.Context` existed, does not play well -> with the shallow copying of the request that [`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext) (added to net/http Go 1.7 onwards) performs. You should either use *just* gorilla/context, or moving forward, the new `http.Request.Context()`. - -Read the full documentation here: http://www.gorillatoolkit.org/pkg/context diff --git a/vendor/github.com/gorilla/context/context.go b/vendor/github.com/gorilla/context/context.go deleted file mode 100644 index 81cb128b19ca..000000000000 --- a/vendor/github.com/gorilla/context/context.go +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright 2012 The Gorilla 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 context - -import ( - "net/http" - "sync" - "time" -) - -var ( - mutex sync.RWMutex - data = make(map[*http.Request]map[interface{}]interface{}) - datat = make(map[*http.Request]int64) -) - -// Set stores a value for a given key in a given request. -func Set(r *http.Request, key, val interface{}) { - mutex.Lock() - if data[r] == nil { - data[r] = make(map[interface{}]interface{}) - datat[r] = time.Now().Unix() - } - data[r][key] = val - mutex.Unlock() -} - -// Get returns a value stored for a given key in a given request. -func Get(r *http.Request, key interface{}) interface{} { - mutex.RLock() - if ctx := data[r]; ctx != nil { - value := ctx[key] - mutex.RUnlock() - return value - } - mutex.RUnlock() - return nil -} - -// GetOk returns stored value and presence state like multi-value return of map access. -func GetOk(r *http.Request, key interface{}) (interface{}, bool) { - mutex.RLock() - if _, ok := data[r]; ok { - value, ok := data[r][key] - mutex.RUnlock() - return value, ok - } - mutex.RUnlock() - return nil, false -} - -// GetAll returns all stored values for the request as a map. Nil is returned for invalid requests. -func GetAll(r *http.Request) map[interface{}]interface{} { - mutex.RLock() - if context, ok := data[r]; ok { - result := make(map[interface{}]interface{}, len(context)) - for k, v := range context { - result[k] = v - } - mutex.RUnlock() - return result - } - mutex.RUnlock() - return nil -} - -// GetAllOk returns all stored values for the request as a map and a boolean value that indicates if -// the request was registered. -func GetAllOk(r *http.Request) (map[interface{}]interface{}, bool) { - mutex.RLock() - context, ok := data[r] - result := make(map[interface{}]interface{}, len(context)) - for k, v := range context { - result[k] = v - } - mutex.RUnlock() - return result, ok -} - -// Delete removes a value stored for a given key in a given request. -func Delete(r *http.Request, key interface{}) { - mutex.Lock() - if data[r] != nil { - delete(data[r], key) - } - mutex.Unlock() -} - -// Clear removes all values stored for a given request. -// -// This is usually called by a handler wrapper to clean up request -// variables at the end of a request lifetime. See ClearHandler(). -func Clear(r *http.Request) { - mutex.Lock() - clear(r) - mutex.Unlock() -} - -// clear is Clear without the lock. -func clear(r *http.Request) { - delete(data, r) - delete(datat, r) -} - -// Purge removes request data stored for longer than maxAge, in seconds. -// It returns the amount of requests removed. -// -// If maxAge <= 0, all request data is removed. -// -// This is only used for sanity check: in case context cleaning was not -// properly set some request data can be kept forever, consuming an increasing -// amount of memory. In case this is detected, Purge() must be called -// periodically until the problem is fixed. -func Purge(maxAge int) int { - mutex.Lock() - count := 0 - if maxAge <= 0 { - count = len(data) - data = make(map[*http.Request]map[interface{}]interface{}) - datat = make(map[*http.Request]int64) - } else { - min := time.Now().Unix() - int64(maxAge) - for r := range data { - if datat[r] < min { - clear(r) - count++ - } - } - } - mutex.Unlock() - return count -} - -// ClearHandler wraps an http.Handler and clears request values at the end -// of a request lifetime. -func ClearHandler(h http.Handler) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - defer Clear(r) - h.ServeHTTP(w, r) - }) -} diff --git a/vendor/github.com/gorilla/context/doc.go b/vendor/github.com/gorilla/context/doc.go deleted file mode 100644 index 448d1bfcac6e..000000000000 --- a/vendor/github.com/gorilla/context/doc.go +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2012 The Gorilla 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 context stores values shared during a request lifetime. - -Note: gorilla/context, having been born well before `context.Context` existed, -does not play well > with the shallow copying of the request that -[`http.Request.WithContext`](https://golang.org/pkg/net/http/#Request.WithContext) -(added to net/http Go 1.7 onwards) performs. You should either use *just* -gorilla/context, or moving forward, the new `http.Request.Context()`. - -For example, a router can set variables extracted from the URL and later -application handlers can access those values, or it can be used to store -sessions values to be saved at the end of a request. There are several -others common uses. - -The idea was posted by Brad Fitzpatrick to the go-nuts mailing list: - - http://groups.google.com/group/golang-nuts/msg/e2d679d303aa5d53 - -Here's the basic usage: first define the keys that you will need. The key -type is interface{} so a key can be of any type that supports equality. -Here we define a key using a custom int type to avoid name collisions: - - package foo - - import ( - "github.com/gorilla/context" - ) - - type key int - - const MyKey key = 0 - -Then set a variable. Variables are bound to an http.Request object, so you -need a request instance to set a value: - - context.Set(r, MyKey, "bar") - -The application can later access the variable using the same key you provided: - - func MyHandler(w http.ResponseWriter, r *http.Request) { - // val is "bar". - val := context.Get(r, foo.MyKey) - - // returns ("bar", true) - val, ok := context.GetOk(r, foo.MyKey) - // ... - } - -And that's all about the basic usage. We discuss some other ideas below. - -Any type can be stored in the context. To enforce a given type, make the key -private and wrap Get() and Set() to accept and return values of a specific -type: - - type key int - - const mykey key = 0 - - // GetMyKey returns a value for this package from the request values. - func GetMyKey(r *http.Request) SomeType { - if rv := context.Get(r, mykey); rv != nil { - return rv.(SomeType) - } - return nil - } - - // SetMyKey sets a value for this package in the request values. - func SetMyKey(r *http.Request, val SomeType) { - context.Set(r, mykey, val) - } - -Variables must be cleared at the end of a request, to remove all values -that were stored. This can be done in an http.Handler, after a request was -served. Just call Clear() passing the request: - - context.Clear(r) - -...or use ClearHandler(), which conveniently wraps an http.Handler to clear -variables at the end of a request lifetime. - -The Routers from the packages gorilla/mux and gorilla/pat call Clear() -so if you are using either of them you don't need to clear the context manually. -*/ -package context diff --git a/vendor/github.com/gorilla/mux/ISSUE_TEMPLATE.md b/vendor/github.com/gorilla/mux/ISSUE_TEMPLATE.md deleted file mode 100644 index 232be82e47a6..000000000000 --- a/vendor/github.com/gorilla/mux/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,11 +0,0 @@ -**What version of Go are you running?** (Paste the output of `go version`) - - -**What version of gorilla/mux are you at?** (Paste the output of `git rev-parse HEAD` inside `$GOPATH/src/github.com/gorilla/mux`) - - -**Describe your problem** (and what you have tried so far) - - -**Paste a minimal, runnable, reproduction of your issue below** (use backticks to format it) - diff --git a/vendor/github.com/gorilla/mux/README.md b/vendor/github.com/gorilla/mux/README.md index e424397ac4d0..35eea9f10635 100644 --- a/vendor/github.com/gorilla/mux/README.md +++ b/vendor/github.com/gorilla/mux/README.md @@ -1,12 +1,12 @@ # gorilla/mux [![GoDoc](https://godoc.org/github.com/gorilla/mux?status.svg)](https://godoc.org/github.com/gorilla/mux) -[![Build Status](https://travis-ci.org/gorilla/mux.svg?branch=master)](https://travis-ci.org/gorilla/mux) +[![CircleCI](https://circleci.com/gh/gorilla/mux.svg?style=svg)](https://circleci.com/gh/gorilla/mux) [![Sourcegraph](https://sourcegraph.com/github.com/gorilla/mux/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/mux?badge) -![Gorilla Logo](http://www.gorillatoolkit.org/static/images/gorilla-icon-64.png) +![Gorilla Logo](https://cloud-cdn.questionable.services/gorilla-icon-64.png) -http://www.gorillatoolkit.org/pkg/mux +https://www.gorillatoolkit.org/pkg/mux Package `gorilla/mux` implements a request router and dispatcher for matching incoming requests to their respective handler. @@ -25,10 +25,12 @@ The name mux stands for "HTTP request multiplexer". Like the standard `http.Serv * [Examples](#examples) * [Matching Routes](#matching-routes) * [Static Files](#static-files) +* [Serving Single Page Applications](#serving-single-page-applications) (e.g. React, Vue, Ember.js, etc.) * [Registered URLs](#registered-urls) * [Walking Routes](#walking-routes) * [Graceful Shutdown](#graceful-shutdown) * [Middleware](#middleware) +* [Handling CORS Requests](#handling-cors-requests) * [Testing Handlers](#testing-handlers) * [Full Example](#full-example) @@ -88,7 +90,7 @@ r := mux.NewRouter() // Only matches if domain is "www.example.com". r.Host("www.example.com") // Matches a dynamic subdomain. -r.Host("{subdomain:[a-z]+}.domain.com") +r.Host("{subdomain:[a-z]+}.example.com") ``` There are several other matchers that can be added. To match path prefixes: @@ -210,6 +212,93 @@ func main() { } ``` +### Serving Single Page Applications + +Most of the time it makes sense to serve your SPA on a separate web server from your API, +but sometimes it's desirable to serve them both from one place. It's possible to write a simple +handler for serving your SPA (for use with React Router's [BrowserRouter](https://reacttraining.com/react-router/web/api/BrowserRouter) for example), and leverage +mux's powerful routing for your API endpoints. + +```go +package main + +import ( + "encoding/json" + "log" + "net/http" + "os" + "path/filepath" + "time" + + "github.com/gorilla/mux" +) + +// spaHandler implements the http.Handler interface, so we can use it +// to respond to HTTP requests. The path to the static directory and +// path to the index file within that static directory are used to +// serve the SPA in the given static directory. +type spaHandler struct { + staticPath string + indexPath string +} + +// ServeHTTP inspects the URL path to locate a file within the static dir +// on the SPA handler. If a file is found, it will be served. If not, the +// file located at the index path on the SPA handler will be served. This +// is suitable behavior for serving an SPA (single page application). +func (h spaHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + // get the absolute path to prevent directory traversal + path, err := filepath.Abs(r.URL.Path) + if err != nil { + // if we failed to get the absolute path respond with a 400 bad request + // and stop + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + + // prepend the path with the path to the static directory + path = filepath.Join(h.staticPath, path) + + // check whether a file exists at the given path + _, err = os.Stat(path) + if os.IsNotExist(err) { + // file does not exist, serve index.html + http.ServeFile(w, r, filepath.Join(h.staticPath, h.indexPath)) + return + } else if err != nil { + // if we got an error (that wasn't that the file doesn't exist) stating the + // file, return a 500 internal server error and stop + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + + // otherwise, use http.FileServer to serve the static dir + http.FileServer(http.Dir(h.staticPath)).ServeHTTP(w, r) +} + +func main() { + router := mux.NewRouter() + + router.HandleFunc("/api/health", func(w http.ResponseWriter, r *http.Request) { + // an example API handler + json.NewEncoder(w).Encode(map[string]bool{"ok": true}) + }) + + spa := spaHandler{staticPath: "build", indexPath: "index.html"} + router.PathPrefix("/").Handler(spa) + + srv := &http.Server{ + Handler: router, + Addr: "127.0.0.1:8000", + // Good practice: enforce timeouts for servers you create! + WriteTimeout: 15 * time.Second, + ReadTimeout: 15 * time.Second, + } + + log.Fatal(srv.ListenAndServe()) +} +``` + ### Registered URLs Now let's see how to build registered URLs. @@ -238,13 +327,13 @@ This also works for host and query value variables: ```go r := mux.NewRouter() -r.Host("{subdomain}.domain.com"). +r.Host("{subdomain}.example.com"). Path("/articles/{category}/{id:[0-9]+}"). Queries("filter", "{filter}"). HandlerFunc(ArticleHandler). Name("article") -// url.String() will be "http://news.domain.com/articles/technology/42?filter=gorilla" +// url.String() will be "http://news.example.com/articles/technology/42?filter=gorilla" url, err := r.Get("article").URL("subdomain", "news", "category", "technology", "id", "42", @@ -264,7 +353,7 @@ r.HeadersRegexp("Content-Type", "application/(text|json)") There's also a way to build only the URL host or path for a route: use the methods `URLHost()` or `URLPath()` instead. For the previous route, we would do: ```go -// "http://news.domain.com/" +// "http://news.example.com/" host, err := r.Get("article").URLHost("subdomain", "news") // "/articles/technology/42" @@ -275,12 +364,12 @@ And if you use subrouters, host and path defined separately can be built as well ```go r := mux.NewRouter() -s := r.Host("{subdomain}.domain.com").Subrouter() +s := r.Host("{subdomain}.example.com").Subrouter() s.Path("/articles/{category}/{id:[0-9]+}"). HandlerFunc(ArticleHandler). Name("article") -// "http://news.domain.com/articles/technology/42" +// "http://news.example.com/articles/technology/42" url, err := r.Get("article").URL("subdomain", "news", "category", "technology", "id", "42") @@ -491,6 +580,73 @@ r.Use(amw.Middleware) Note: The handler chain will be stopped if your middleware doesn't call `next.ServeHTTP()` with the corresponding parameters. This can be used to abort a request if the middleware writer wants to. Middlewares _should_ write to `ResponseWriter` if they _are_ going to terminate the request, and they _should not_ write to `ResponseWriter` if they _are not_ going to terminate it. +### Handling CORS Requests + +[CORSMethodMiddleware](https://godoc.org/github.com/gorilla/mux#CORSMethodMiddleware) intends to make it easier to strictly set the `Access-Control-Allow-Methods` response header. + +* You will still need to use your own CORS handler to set the other CORS headers such as `Access-Control-Allow-Origin` +* The middleware will set the `Access-Control-Allow-Methods` header to all the method matchers (e.g. `r.Methods(http.MethodGet, http.MethodPut, http.MethodOptions)` -> `Access-Control-Allow-Methods: GET,PUT,OPTIONS`) on a route +* If you do not specify any methods, then: +> _Important_: there must be an `OPTIONS` method matcher for the middleware to set the headers. + +Here is an example of using `CORSMethodMiddleware` along with a custom `OPTIONS` handler to set all the required CORS headers: + +```go +package main + +import ( + "net/http" + "github.com/gorilla/mux" +) + +func main() { + r := mux.NewRouter() + + // IMPORTANT: you must specify an OPTIONS method matcher for the middleware to set CORS headers + r.HandleFunc("/foo", fooHandler).Methods(http.MethodGet, http.MethodPut, http.MethodPatch, http.MethodOptions) + r.Use(mux.CORSMethodMiddleware(r)) + + http.ListenAndServe(":8080", r) +} + +func fooHandler(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Access-Control-Allow-Origin", "*") + if r.Method == http.MethodOptions { + return + } + + w.Write([]byte("foo")) +} +``` + +And an request to `/foo` using something like: + +```bash +curl localhost:8080/foo -v +``` + +Would look like: + +```bash +* Trying ::1... +* TCP_NODELAY set +* Connected to localhost (::1) port 8080 (#0) +> GET /foo HTTP/1.1 +> Host: localhost:8080 +> User-Agent: curl/7.59.0 +> Accept: */* +> +< HTTP/1.1 200 OK +< Access-Control-Allow-Methods: GET,PUT,PATCH,OPTIONS +< Access-Control-Allow-Origin: * +< Date: Fri, 28 Jun 2019 20:13:30 GMT +< Content-Length: 3 +< Content-Type: text/plain; charset=utf-8 +< +* Connection #0 to host localhost left intact +foo +``` + ### Testing Handlers Testing handlers in a Go web application is straightforward, and _mux_ doesn't complicate this any further. Given two files: `endpoints.go` and `endpoints_test.go`, here's how we'd test an application using _mux_. @@ -503,8 +659,8 @@ package main func HealthCheckHandler(w http.ResponseWriter, r *http.Request) { // A very simple health check. - w.WriteHeader(http.StatusOK) w.Header().Set("Content-Type", "application/json") + w.WriteHeader(http.StatusOK) // In the future we could report back on the status of our DB, or our cache // (e.g. Redis) by performing a simple PING, and include them in the response. diff --git a/vendor/github.com/gorilla/mux/context_gorilla.go b/vendor/github.com/gorilla/mux/context_gorilla.go deleted file mode 100644 index d7adaa8fad4f..000000000000 --- a/vendor/github.com/gorilla/mux/context_gorilla.go +++ /dev/null @@ -1,26 +0,0 @@ -// +build !go1.7 - -package mux - -import ( - "net/http" - - "github.com/gorilla/context" -) - -func contextGet(r *http.Request, key interface{}) interface{} { - return context.Get(r, key) -} - -func contextSet(r *http.Request, key, val interface{}) *http.Request { - if val == nil { - return r - } - - context.Set(r, key, val) - return r -} - -func contextClear(r *http.Request) { - context.Clear(r) -} diff --git a/vendor/github.com/gorilla/mux/context_native.go b/vendor/github.com/gorilla/mux/context_native.go deleted file mode 100644 index 209cbea7d661..000000000000 --- a/vendor/github.com/gorilla/mux/context_native.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build go1.7 - -package mux - -import ( - "context" - "net/http" -) - -func contextGet(r *http.Request, key interface{}) interface{} { - return r.Context().Value(key) -} - -func contextSet(r *http.Request, key, val interface{}) *http.Request { - if val == nil { - return r - } - - return r.WithContext(context.WithValue(r.Context(), key, val)) -} - -func contextClear(r *http.Request) { - return -} diff --git a/vendor/github.com/gorilla/mux/doc.go b/vendor/github.com/gorilla/mux/doc.go index 38957deead3d..bd5a38b55d82 100644 --- a/vendor/github.com/gorilla/mux/doc.go +++ b/vendor/github.com/gorilla/mux/doc.go @@ -295,7 +295,7 @@ A more complex authentication middleware, which maps session token to users, cou r := mux.NewRouter() r.HandleFunc("/", handler) - amw := authenticationMiddleware{} + amw := authenticationMiddleware{tokenUsers: make(map[string]string)} amw.Populate() r.Use(amw.Middleware) diff --git a/vendor/github.com/gorilla/mux/go.mod b/vendor/github.com/gorilla/mux/go.mod index cfc8ede5818b..df170a399403 100644 --- a/vendor/github.com/gorilla/mux/go.mod +++ b/vendor/github.com/gorilla/mux/go.mod @@ -1 +1,3 @@ module github.com/gorilla/mux + +go 1.12 diff --git a/vendor/github.com/gorilla/mux/middleware.go b/vendor/github.com/gorilla/mux/middleware.go index ceb812cee284..cb51c565ebd3 100644 --- a/vendor/github.com/gorilla/mux/middleware.go +++ b/vendor/github.com/gorilla/mux/middleware.go @@ -32,37 +32,19 @@ func (r *Router) useInterface(mw middleware) { r.middlewares = append(r.middlewares, mw) } -// CORSMethodMiddleware sets the Access-Control-Allow-Methods response header -// on a request, by matching routes based only on paths. It also handles -// OPTIONS requests, by settings Access-Control-Allow-Methods, and then -// returning without calling the next http handler. +// CORSMethodMiddleware automatically sets the Access-Control-Allow-Methods response header +// on requests for routes that have an OPTIONS method matcher to all the method matchers on +// the route. Routes that do not explicitly handle OPTIONS requests will not be processed +// by the middleware. See examples for usage. func CORSMethodMiddleware(r *Router) MiddlewareFunc { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - var allMethods []string - - err := r.Walk(func(route *Route, _ *Router, _ []*Route) error { - for _, m := range route.matchers { - if _, ok := m.(*routeRegexp); ok { - if m.Match(req, &RouteMatch{}) { - methods, err := route.GetMethods() - if err != nil { - return err - } - - allMethods = append(allMethods, methods...) - } - break - } - } - return nil - }) - + allMethods, err := getAllMethodsForRoute(r, req) if err == nil { - w.Header().Set("Access-Control-Allow-Methods", strings.Join(append(allMethods, "OPTIONS"), ",")) - - if req.Method == "OPTIONS" { - return + for _, v := range allMethods { + if v == http.MethodOptions { + w.Header().Set("Access-Control-Allow-Methods", strings.Join(allMethods, ",")) + } } } @@ -70,3 +52,23 @@ func CORSMethodMiddleware(r *Router) MiddlewareFunc { }) } } + +// getAllMethodsForRoute returns all the methods from method matchers matching a given +// request. +func getAllMethodsForRoute(r *Router, req *http.Request) ([]string, error) { + var allMethods []string + + for _, route := range r.routes { + var match RouteMatch + if route.Match(req, &match) || match.MatchErr == ErrMethodMismatch { + methods, err := route.GetMethods() + if err != nil { + return nil, err + } + + allMethods = append(allMethods, methods...) + } + } + + return allMethods, nil +} diff --git a/vendor/github.com/gorilla/mux/mux.go b/vendor/github.com/gorilla/mux/mux.go index 4bbafa51da30..c9ba6470735b 100644 --- a/vendor/github.com/gorilla/mux/mux.go +++ b/vendor/github.com/gorilla/mux/mux.go @@ -5,6 +5,7 @@ package mux import ( + "context" "errors" "fmt" "net/http" @@ -22,7 +23,7 @@ var ( // NewRouter returns a new router instance. func NewRouter() *Router { - return &Router{namedRoutes: make(map[string]*Route), KeepContext: false} + return &Router{namedRoutes: make(map[string]*Route)} } // Router registers routes to be matched and dispatches a handler. @@ -50,24 +51,75 @@ type Router struct { // Configurable Handler to be used when the request method does not match the route. MethodNotAllowedHandler http.Handler - // Parent route, if this is a subrouter. - parent parentRoute // Routes to be matched, in order. routes []*Route + // Routes by name for URL building. namedRoutes map[string]*Route - // See Router.StrictSlash(). This defines the flag for new routes. - strictSlash bool - // See Router.SkipClean(). This defines the flag for new routes. - skipClean bool + // If true, do not clear the request context after handling the request. - // This has no effect when go1.7+ is used, since the context is stored - // on the request itself. + // + // Deprecated: No effect, since the context is stored on the request itself. KeepContext bool - // see Router.UseEncodedPath(). This defines a flag for all routes. - useEncodedPath bool + // Slice of middlewares to be called after a match is found middlewares []middleware + + // configuration shared with `Route` + routeConf +} + +// common route configuration shared between `Router` and `Route` +type routeConf struct { + // If true, "/path/foo%2Fbar/to" will match the path "/path/{var}/to" + useEncodedPath bool + + // If true, when the path pattern is "/path/", accessing "/path" will + // redirect to the former and vice versa. + strictSlash bool + + // If true, when the path pattern is "/path//to", accessing "/path//to" + // will not redirect + skipClean bool + + // Manager for the variables from host and path. + regexp routeRegexpGroup + + // List of matchers. + matchers []matcher + + // The scheme used when building URLs. + buildScheme string + + buildVarsFunc BuildVarsFunc +} + +// returns an effective deep copy of `routeConf` +func copyRouteConf(r routeConf) routeConf { + c := r + + if r.regexp.path != nil { + c.regexp.path = copyRouteRegexp(r.regexp.path) + } + + if r.regexp.host != nil { + c.regexp.host = copyRouteRegexp(r.regexp.host) + } + + c.regexp.queries = make([]*routeRegexp, 0, len(r.regexp.queries)) + for _, q := range r.regexp.queries { + c.regexp.queries = append(c.regexp.queries, copyRouteRegexp(q)) + } + + c.matchers = make([]matcher, len(r.matchers)) + copy(c.matchers, r.matchers) + + return c +} + +func copyRouteRegexp(r *routeRegexp) *routeRegexp { + c := *r + return &c } // Match attempts to match the given request against the router's registered routes. @@ -143,8 +195,8 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) { var handler http.Handler if r.Match(req, &match) { handler = match.Handler - req = setVars(req, match.Vars) - req = setCurrentRoute(req, match.Route) + req = requestWithVars(req, match.Vars) + req = requestWithRoute(req, match.Route) } if handler == nil && match.MatchErr == ErrMethodMismatch { @@ -155,22 +207,18 @@ func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) { handler = http.NotFoundHandler() } - if !r.KeepContext { - defer contextClear(req) - } - handler.ServeHTTP(w, req) } // Get returns a route registered with the given name. func (r *Router) Get(name string) *Route { - return r.getNamedRoutes()[name] + return r.namedRoutes[name] } // GetRoute returns a route registered with the given name. This method // was renamed to Get() and remains here for backwards compatibility. func (r *Router) GetRoute(name string) *Route { - return r.getNamedRoutes()[name] + return r.namedRoutes[name] } // StrictSlash defines the trailing slash behavior for new routes. The initial @@ -221,55 +269,24 @@ func (r *Router) UseEncodedPath() *Router { return r } -// ---------------------------------------------------------------------------- -// parentRoute -// ---------------------------------------------------------------------------- - -func (r *Router) getBuildScheme() string { - if r.parent != nil { - return r.parent.getBuildScheme() - } - return "" -} - -// getNamedRoutes returns the map where named routes are registered. -func (r *Router) getNamedRoutes() map[string]*Route { - if r.namedRoutes == nil { - if r.parent != nil { - r.namedRoutes = r.parent.getNamedRoutes() - } else { - r.namedRoutes = make(map[string]*Route) - } - } - return r.namedRoutes -} - -// getRegexpGroup returns regexp definitions from the parent route, if any. -func (r *Router) getRegexpGroup() *routeRegexpGroup { - if r.parent != nil { - return r.parent.getRegexpGroup() - } - return nil -} - -func (r *Router) buildVars(m map[string]string) map[string]string { - if r.parent != nil { - m = r.parent.buildVars(m) - } - return m -} - // ---------------------------------------------------------------------------- // Route factories // ---------------------------------------------------------------------------- // NewRoute registers an empty route. func (r *Router) NewRoute() *Route { - route := &Route{parent: r, strictSlash: r.strictSlash, skipClean: r.skipClean, useEncodedPath: r.useEncodedPath} + // initialize a route with a copy of the parent router's configuration + route := &Route{routeConf: copyRouteConf(r.routeConf), namedRoutes: r.namedRoutes} r.routes = append(r.routes, route) return route } +// Name registers a new route with a name. +// See Route.Name(). +func (r *Router) Name(name string) *Route { + return r.NewRoute().Name(name) +} + // Handle registers a new route with a matcher for the URL path. // See Route.Path() and Route.Handler(). func (r *Router) Handle(path string, handler http.Handler) *Route { @@ -409,7 +426,7 @@ const ( // Vars returns the route variables for the current request, if any. func Vars(r *http.Request) map[string]string { - if rv := contextGet(r, varsKey); rv != nil { + if rv := r.Context().Value(varsKey); rv != nil { return rv.(map[string]string) } return nil @@ -421,18 +438,20 @@ func Vars(r *http.Request) map[string]string { // after the handler returns, unless the KeepContext option is set on the // Router. func CurrentRoute(r *http.Request) *Route { - if rv := contextGet(r, routeKey); rv != nil { + if rv := r.Context().Value(routeKey); rv != nil { return rv.(*Route) } return nil } -func setVars(r *http.Request, val interface{}) *http.Request { - return contextSet(r, varsKey, val) +func requestWithVars(r *http.Request, vars map[string]string) *http.Request { + ctx := context.WithValue(r.Context(), varsKey, vars) + return r.WithContext(ctx) } -func setCurrentRoute(r *http.Request, val interface{}) *http.Request { - return contextSet(r, routeKey, val) +func requestWithRoute(r *http.Request, route *Route) *http.Request { + ctx := context.WithValue(r.Context(), routeKey, route) + return r.WithContext(ctx) } // ---------------------------------------------------------------------------- diff --git a/vendor/github.com/gorilla/mux/regexp.go b/vendor/github.com/gorilla/mux/regexp.go index 2b57e5627d54..96dd94ad1302 100644 --- a/vendor/github.com/gorilla/mux/regexp.go +++ b/vendor/github.com/gorilla/mux/regexp.go @@ -113,6 +113,13 @@ func newRouteRegexp(tpl string, typ regexpType, options routeRegexpOptions) (*ro if typ != regexpTypePrefix { pattern.WriteByte('$') } + + var wildcardHostPort bool + if typ == regexpTypeHost { + if !strings.Contains(pattern.String(), ":") { + wildcardHostPort = true + } + } reverse.WriteString(raw) if endSlash { reverse.WriteByte('/') @@ -131,13 +138,14 @@ func newRouteRegexp(tpl string, typ regexpType, options routeRegexpOptions) (*ro // Done! return &routeRegexp{ - template: template, - regexpType: typ, - options: options, - regexp: reg, - reverse: reverse.String(), - varsN: varsN, - varsR: varsR, + template: template, + regexpType: typ, + options: options, + regexp: reg, + reverse: reverse.String(), + varsN: varsN, + varsR: varsR, + wildcardHostPort: wildcardHostPort, }, nil } @@ -158,27 +166,36 @@ type routeRegexp struct { varsN []string // Variable regexps (validators). varsR []*regexp.Regexp + // Wildcard host-port (no strict port match in hostname) + wildcardHostPort bool } // Match matches the regexp against the URL host or path. func (r *routeRegexp) Match(req *http.Request, match *RouteMatch) bool { - if r.regexpType != regexpTypeHost { - if r.regexpType == regexpTypeQuery { - return r.matchQueryString(req) - } - path := req.URL.Path - if r.options.useEncodedPath { - path = req.URL.EscapedPath() + if r.regexpType == regexpTypeHost { + host := getHost(req) + if r.wildcardHostPort { + // Don't be strict on the port match + if i := strings.Index(host, ":"); i != -1 { + host = host[:i] + } } - return r.regexp.MatchString(path) + return r.regexp.MatchString(host) } - return r.regexp.MatchString(getHost(req)) + if r.regexpType == regexpTypeQuery { + return r.matchQueryString(req) + } + path := req.URL.Path + if r.options.useEncodedPath { + path = req.URL.EscapedPath() + } + return r.regexp.MatchString(path) } // url builds a URL part using the given values. func (r *routeRegexp) url(values map[string]string) (string, error) { - urlValues := make([]interface{}, len(r.varsN)) + urlValues := make([]interface{}, len(r.varsN), len(r.varsN)) for k, v := range r.varsN { value, ok := values[v] if !ok { @@ -213,14 +230,51 @@ func (r *routeRegexp) getURLQuery(req *http.Request) string { return "" } templateKey := strings.SplitN(r.template, "=", 2)[0] - for key, vals := range req.URL.Query() { - if key == templateKey && len(vals) > 0 { - return key + "=" + vals[0] - } + val, ok := findFirstQueryKey(req.URL.RawQuery, templateKey) + if ok { + return templateKey + "=" + val } return "" } +// findFirstQueryKey returns the same result as (*url.URL).Query()[key][0]. +// If key was not found, empty string and false is returned. +func findFirstQueryKey(rawQuery, key string) (value string, ok bool) { + query := []byte(rawQuery) + for len(query) > 0 { + foundKey := query + if i := bytes.IndexAny(foundKey, "&;"); i >= 0 { + foundKey, query = foundKey[:i], foundKey[i+1:] + } else { + query = query[:0] + } + if len(foundKey) == 0 { + continue + } + var value []byte + if i := bytes.IndexByte(foundKey, '='); i >= 0 { + foundKey, value = foundKey[:i], foundKey[i+1:] + } + if len(foundKey) < len(key) { + // Cannot possibly be key. + continue + } + keyString, err := url.QueryUnescape(string(foundKey)) + if err != nil { + continue + } + if keyString != key { + continue + } + valueString, err := url.QueryUnescape(string(value)) + if err != nil { + continue + } + return valueString, true + } + return "", false +} + func (r *routeRegexp) matchQueryString(req *http.Request) bool { return r.regexp.MatchString(r.getURLQuery(req)) } @@ -267,7 +321,7 @@ type routeRegexpGroup struct { } // setMatch extracts the variables from the URL once a route matches. -func (v *routeRegexpGroup) setMatch(req *http.Request, m *RouteMatch, r *Route) { +func (v routeRegexpGroup) setMatch(req *http.Request, m *RouteMatch, r *Route) { // Store host variables. if v.host != nil { host := getHost(req) @@ -296,7 +350,7 @@ func (v *routeRegexpGroup) setMatch(req *http.Request, m *RouteMatch, r *Route) } else { u.Path += "/" } - m.Handler = http.RedirectHandler(u.String(), 301) + m.Handler = http.RedirectHandler(u.String(), http.StatusMovedPermanently) } } } @@ -312,17 +366,13 @@ func (v *routeRegexpGroup) setMatch(req *http.Request, m *RouteMatch, r *Route) } // getHost tries its best to return the request host. +// According to section 14.23 of RFC 2616 the Host header +// can include the port number if the default value of 80 is not used. func getHost(r *http.Request) string { if r.URL.IsAbs() { return r.URL.Host } - host := r.Host - // Slice off any port information. - if i := strings.Index(host, ":"); i != -1 { - host = host[:i] - } - return host - + return r.Host } func extractVars(input string, matches []int, names []string, output map[string]string) { diff --git a/vendor/github.com/gorilla/mux/route.go b/vendor/github.com/gorilla/mux/route.go index c8bb5c7e3a0d..750afe570d05 100644 --- a/vendor/github.com/gorilla/mux/route.go +++ b/vendor/github.com/gorilla/mux/route.go @@ -15,24 +15,8 @@ import ( // Route stores information to match a request and build URLs. type Route struct { - // Parent where the route was registered (a Router). - parent parentRoute // Request handler for the route. handler http.Handler - // List of matchers. - matchers []matcher - // Manager for the variables from host and path. - regexp *routeRegexpGroup - // If true, when the path pattern is "/path/", accessing "/path" will - // redirect to the former and vice versa. - strictSlash bool - // If true, when the path pattern is "/path//to", accessing "/path//to" - // will not redirect - skipClean bool - // If true, "/path/foo%2Fbar/to" will match the path "/path/{var}/to" - useEncodedPath bool - // The scheme used when building URLs. - buildScheme string // If true, this route never matches: it is only used to build URLs. buildOnly bool // The name used to build URLs. @@ -40,7 +24,11 @@ type Route struct { // Error resulted from building a route. err error - buildVarsFunc BuildVarsFunc + // "global" reference to all named routes + namedRoutes map[string]*Route + + // config possibly passed in from `Router` + routeConf } // SkipClean reports whether path cleaning is enabled for this route via @@ -64,6 +52,18 @@ func (r *Route) Match(req *http.Request, match *RouteMatch) bool { matchErr = ErrMethodMismatch continue } + + // Ignore ErrNotFound errors. These errors arise from match call + // to Subrouters. + // + // This prevents subsequent matching subrouters from failing to + // run middleware. If not ignored, the middleware would see a + // non-nil MatchErr and be skipped, even when there was a + // matching route. + if match.MatchErr == ErrNotFound { + match.MatchErr = nil + } + matchErr = nil return false } @@ -74,7 +74,7 @@ func (r *Route) Match(req *http.Request, match *RouteMatch) bool { return false } - if match.MatchErr == ErrMethodMismatch { + if match.MatchErr == ErrMethodMismatch && r.handler != nil { // We found a route which matches request method, clear MatchErr match.MatchErr = nil // Then override the mis-matched handler @@ -93,9 +93,7 @@ func (r *Route) Match(req *http.Request, match *RouteMatch) bool { } // Set variables. - if r.regexp != nil { - r.regexp.setMatch(req, match, r) - } + r.regexp.setMatch(req, match, r) return true } @@ -145,7 +143,7 @@ func (r *Route) Name(name string) *Route { } if r.err == nil { r.name = name - r.getNamedRoutes()[name] = r + r.namedRoutes[name] = r } return r } @@ -177,7 +175,6 @@ func (r *Route) addRegexpMatcher(tpl string, typ regexpType) error { if r.err != nil { return r.err } - r.regexp = r.getRegexpGroup() if typ == regexpTypePath || typ == regexpTypePrefix { if len(tpl) > 0 && tpl[0] != '/' { return fmt.Errorf("mux: path must start with a slash, got %q", tpl) @@ -386,7 +383,7 @@ func (r *Route) PathPrefix(tpl string) *Route { // The above route will only match if the URL contains the defined queries // values, e.g.: ?foo=bar&id=42. // -// It the value is an empty string, it will match any value if the key is set. +// If the value is an empty string, it will match any value if the key is set. // // Variables can define an optional regexp pattern to be matched: // @@ -415,16 +412,35 @@ func (r *Route) Queries(pairs ...string) *Route { type schemeMatcher []string func (m schemeMatcher) Match(r *http.Request, match *RouteMatch) bool { - return matchInArray(m, r.URL.Scheme) + scheme := r.URL.Scheme + // https://golang.org/pkg/net/http/#Request + // "For [most] server requests, fields other than Path and RawQuery will be + // empty." + // Since we're an http muxer, the scheme is either going to be http or https + // though, so we can just set it based on the tls termination state. + if scheme == "" { + if r.TLS == nil { + scheme = "http" + } else { + scheme = "https" + } + } + return matchInArray(m, scheme) } // Schemes adds a matcher for URL schemes. // It accepts a sequence of schemes to be matched, e.g.: "http", "https". +// If the request's URL has a scheme set, it will be matched against. +// Generally, the URL scheme will only be set if a previous handler set it, +// such as the ProxyHeaders handler from gorilla/handlers. +// If unset, the scheme will be determined based on the request's TLS +// termination state. +// The first argument to Schemes will be used when constructing a route URL. func (r *Route) Schemes(schemes ...string) *Route { for k, v := range schemes { schemes[k] = strings.ToLower(v) } - if r.buildScheme == "" && len(schemes) > 0 { + if len(schemes) > 0 { r.buildScheme = schemes[0] } return r.addMatcher(schemeMatcher(schemes)) @@ -439,7 +455,15 @@ type BuildVarsFunc func(map[string]string) map[string]string // BuildVarsFunc adds a custom function to be used to modify build variables // before a route's URL is built. func (r *Route) BuildVarsFunc(f BuildVarsFunc) *Route { - r.buildVarsFunc = f + if r.buildVarsFunc != nil { + // compose the old and new functions + old := r.buildVarsFunc + r.buildVarsFunc = func(m map[string]string) map[string]string { + return f(old(m)) + } + } else { + r.buildVarsFunc = f + } return r } @@ -458,7 +482,8 @@ func (r *Route) BuildVarsFunc(f BuildVarsFunc) *Route { // Here, the routes registered in the subrouter won't be tested if the host // doesn't match. func (r *Route) Subrouter() *Router { - router := &Router{parent: r, strictSlash: r.strictSlash} + // initialize a subrouter with a copy of the parent route's configuration + router := &Router{routeConf: copyRouteConf(r.routeConf), namedRoutes: r.namedRoutes} r.addMatcher(router) return router } @@ -487,8 +512,8 @@ func (r *Route) Subrouter() *Router { // This also works for host variables: // // r := mux.NewRouter() -// r.Host("{subdomain}.domain.com"). -// HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler). +// r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler). +// Host("{subdomain}.domain.com"). // Name("article") // // // url.String() will be "http://news.domain.com/articles/technology/42" @@ -496,15 +521,19 @@ func (r *Route) Subrouter() *Router { // "category", "technology", // "id", "42") // +// The scheme of the resulting url will be the first argument that was passed to Schemes: +// +// // url.String() will be "https://example.com" +// r := mux.NewRouter() +// url, err := r.Host("example.com") +// .Schemes("https", "http").URL() +// // All variables defined in the route are required, and their values must // conform to the corresponding patterns. func (r *Route) URL(pairs ...string) (*url.URL, error) { if r.err != nil { return nil, r.err } - if r.regexp == nil { - return nil, errors.New("mux: route doesn't have a host or path") - } values, err := r.prepareVars(pairs...) if err != nil { return nil, err @@ -516,8 +545,8 @@ func (r *Route) URL(pairs ...string) (*url.URL, error) { return nil, err } scheme = "http" - if s := r.getBuildScheme(); s != "" { - scheme = s + if r.buildScheme != "" { + scheme = r.buildScheme } } if r.regexp.path != nil { @@ -547,7 +576,7 @@ func (r *Route) URLHost(pairs ...string) (*url.URL, error) { if r.err != nil { return nil, r.err } - if r.regexp == nil || r.regexp.host == nil { + if r.regexp.host == nil { return nil, errors.New("mux: route doesn't have a host") } values, err := r.prepareVars(pairs...) @@ -562,8 +591,8 @@ func (r *Route) URLHost(pairs ...string) (*url.URL, error) { Scheme: "http", Host: host, } - if s := r.getBuildScheme(); s != "" { - u.Scheme = s + if r.buildScheme != "" { + u.Scheme = r.buildScheme } return u, nil } @@ -575,7 +604,7 @@ func (r *Route) URLPath(pairs ...string) (*url.URL, error) { if r.err != nil { return nil, r.err } - if r.regexp == nil || r.regexp.path == nil { + if r.regexp.path == nil { return nil, errors.New("mux: route doesn't have a path") } values, err := r.prepareVars(pairs...) @@ -600,7 +629,7 @@ func (r *Route) GetPathTemplate() (string, error) { if r.err != nil { return "", r.err } - if r.regexp == nil || r.regexp.path == nil { + if r.regexp.path == nil { return "", errors.New("mux: route doesn't have a path") } return r.regexp.path.template, nil @@ -614,7 +643,7 @@ func (r *Route) GetPathRegexp() (string, error) { if r.err != nil { return "", r.err } - if r.regexp == nil || r.regexp.path == nil { + if r.regexp.path == nil { return "", errors.New("mux: route does not have a path") } return r.regexp.path.regexp.String(), nil @@ -629,10 +658,10 @@ func (r *Route) GetQueriesRegexp() ([]string, error) { if r.err != nil { return nil, r.err } - if r.regexp == nil || r.regexp.queries == nil { + if r.regexp.queries == nil { return nil, errors.New("mux: route doesn't have queries") } - var queries []string + queries := make([]string, 0, len(r.regexp.queries)) for _, query := range r.regexp.queries { queries = append(queries, query.regexp.String()) } @@ -648,10 +677,10 @@ func (r *Route) GetQueriesTemplates() ([]string, error) { if r.err != nil { return nil, r.err } - if r.regexp == nil || r.regexp.queries == nil { + if r.regexp.queries == nil { return nil, errors.New("mux: route doesn't have queries") } - var queries []string + queries := make([]string, 0, len(r.regexp.queries)) for _, query := range r.regexp.queries { queries = append(queries, query.template) } @@ -683,7 +712,7 @@ func (r *Route) GetHostTemplate() (string, error) { if r.err != nil { return "", r.err } - if r.regexp == nil || r.regexp.host == nil { + if r.regexp.host == nil { return "", errors.New("mux: route doesn't have a host") } return r.regexp.host.template, nil @@ -700,64 +729,8 @@ func (r *Route) prepareVars(pairs ...string) (map[string]string, error) { } func (r *Route) buildVars(m map[string]string) map[string]string { - if r.parent != nil { - m = r.parent.buildVars(m) - } if r.buildVarsFunc != nil { m = r.buildVarsFunc(m) } return m } - -// ---------------------------------------------------------------------------- -// parentRoute -// ---------------------------------------------------------------------------- - -// parentRoute allows routes to know about parent host and path definitions. -type parentRoute interface { - getBuildScheme() string - getNamedRoutes() map[string]*Route - getRegexpGroup() *routeRegexpGroup - buildVars(map[string]string) map[string]string -} - -func (r *Route) getBuildScheme() string { - if r.buildScheme != "" { - return r.buildScheme - } - if r.parent != nil { - return r.parent.getBuildScheme() - } - return "" -} - -// getNamedRoutes returns the map where named routes are registered. -func (r *Route) getNamedRoutes() map[string]*Route { - if r.parent == nil { - // During tests router is not always set. - r.parent = NewRouter() - } - return r.parent.getNamedRoutes() -} - -// getRegexpGroup returns regexp definitions from this route. -func (r *Route) getRegexpGroup() *routeRegexpGroup { - if r.regexp == nil { - if r.parent == nil { - // During tests router is not always set. - r.parent = NewRouter() - } - regexp := r.parent.getRegexpGroup() - if regexp == nil { - r.regexp = new(routeRegexpGroup) - } else { - // Copy. - r.regexp = &routeRegexpGroup{ - host: regexp.host, - path: regexp.path, - queries: regexp.queries, - } - } - } - return r.regexp -} diff --git a/vendor/github.com/gorilla/mux/test_helpers.go b/vendor/github.com/gorilla/mux/test_helpers.go index 32ecffde489f..5f5c496de012 100644 --- a/vendor/github.com/gorilla/mux/test_helpers.go +++ b/vendor/github.com/gorilla/mux/test_helpers.go @@ -15,5 +15,5 @@ import "net/http" // can be set by making a route that captures the required variables, // starting a server and sending the request to that server. func SetURLVars(r *http.Request, val map[string]string) *http.Request { - return setVars(r, val) + return requestWithVars(r, val) } diff --git a/vendor/github.com/gorilla/websocket/.gitignore b/vendor/github.com/gorilla/websocket/.gitignore new file mode 100644 index 000000000000..cd3fcd1ef72a --- /dev/null +++ b/vendor/github.com/gorilla/websocket/.gitignore @@ -0,0 +1,25 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe + +.idea/ +*.iml diff --git a/vendor/github.com/gorilla/websocket/README.md b/vendor/github.com/gorilla/websocket/README.md index 24696947e326..19aa2e75c824 100644 --- a/vendor/github.com/gorilla/websocket/README.md +++ b/vendor/github.com/gorilla/websocket/README.md @@ -1,14 +1,14 @@ # Gorilla WebSocket +[![GoDoc](https://godoc.org/github.com/gorilla/websocket?status.svg)](https://godoc.org/github.com/gorilla/websocket) +[![CircleCI](https://circleci.com/gh/gorilla/websocket.svg?style=svg)](https://circleci.com/gh/gorilla/websocket) + Gorilla WebSocket is a [Go](http://golang.org/) implementation of the [WebSocket](http://www.rfc-editor.org/rfc/rfc6455.txt) protocol. -[![Build Status](https://travis-ci.org/gorilla/websocket.svg?branch=master)](https://travis-ci.org/gorilla/websocket) -[![GoDoc](https://godoc.org/github.com/gorilla/websocket?status.svg)](https://godoc.org/github.com/gorilla/websocket) - ### Documentation -* [API Reference](http://godoc.org/github.com/gorilla/websocket) +* [API Reference](https://pkg.go.dev/github.com/gorilla/websocket?tab=doc) * [Chat example](https://github.com/gorilla/websocket/tree/master/examples/chat) * [Command example](https://github.com/gorilla/websocket/tree/master/examples/command) * [Client and server example](https://github.com/gorilla/websocket/tree/master/examples/echo) @@ -40,7 +40,7 @@ subdirectory](https://github.com/gorilla/websocket/tree/master/examples/autobahn RFC 6455 Features -Passes Autobahn Test SuiteYesNo +Passes Autobahn Test SuiteYesNo Receive fragmented messageYesNo, see note 1 Send close messageYesNo Send pings and receive pongsYesNo diff --git a/vendor/github.com/gorilla/websocket/conn.go b/vendor/github.com/gorilla/websocket/conn.go index 3848ab4a9ea0..ca46d2f793c2 100644 --- a/vendor/github.com/gorilla/websocket/conn.go +++ b/vendor/github.com/gorilla/websocket/conn.go @@ -244,8 +244,8 @@ type Conn struct { subprotocol string // Write fields - mu chan bool // used as mutex to protect write to conn - writeBuf []byte // frame is constructed in this buffer. + mu chan struct{} // used as mutex to protect write to conn + writeBuf []byte // frame is constructed in this buffer. writePool BufferPool writeBufSize int writeDeadline time.Time @@ -260,10 +260,12 @@ type Conn struct { newCompressionWriter func(io.WriteCloser, int) io.WriteCloser // Read fields - reader io.ReadCloser // the current reader returned to the application - readErr error - br *bufio.Reader - readRemaining int64 // bytes remaining in current frame. + reader io.ReadCloser // the current reader returned to the application + readErr error + br *bufio.Reader + // bytes remaining in current frame. + // set setReadRemaining to safely update this value and prevent overflow + readRemaining int64 readFinal bool // true the current message has more frames. readLength int64 // Message size. readLimit int64 // Maximum message size. @@ -300,8 +302,8 @@ func newConn(conn net.Conn, isServer bool, readBufferSize, writeBufferSize int, writeBuf = make([]byte, writeBufferSize) } - mu := make(chan bool, 1) - mu <- true + mu := make(chan struct{}, 1) + mu <- struct{}{} c := &Conn{ isServer: isServer, br: br, @@ -320,6 +322,17 @@ func newConn(conn net.Conn, isServer bool, readBufferSize, writeBufferSize int, return c } +// setReadRemaining tracks the number of bytes remaining on the connection. If n +// overflows, an ErrReadLimit is returned. +func (c *Conn) setReadRemaining(n int64) error { + if n < 0 { + return ErrReadLimit + } + + c.readRemaining = n + return nil +} + // Subprotocol returns the negotiated protocol for the connection. func (c *Conn) Subprotocol() string { return c.subprotocol @@ -364,7 +377,7 @@ func (c *Conn) read(n int) ([]byte, error) { func (c *Conn) write(frameType int, deadline time.Time, buf0, buf1 []byte) error { <-c.mu - defer func() { c.mu <- true }() + defer func() { c.mu <- struct{}{} }() c.writeErrMu.Lock() err := c.writeErr @@ -416,7 +429,7 @@ func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) er maskBytes(key, 0, buf[6:]) } - d := time.Hour * 1000 + d := 1000 * time.Hour if !deadline.IsZero() { d = deadline.Sub(time.Now()) if d < 0 { @@ -431,7 +444,7 @@ func (c *Conn) WriteControl(messageType int, data []byte, deadline time.Time) er case <-timer.C: return errWriteTimeout } - defer func() { c.mu <- true }() + defer func() { c.mu <- struct{}{} }() c.writeErrMu.Lock() err := c.writeErr @@ -708,10 +721,7 @@ func (w *messageWriter) Close() error { if w.err != nil { return w.err } - if err := w.flushFrame(true, nil); err != nil { - return err - } - return nil + return w.flushFrame(true, nil) } // WritePreparedMessage writes prepared message into connection. @@ -793,7 +803,7 @@ func (c *Conn) advanceFrame() (int, error) { final := p[0]&finalBit != 0 frameType := int(p[0] & 0xf) mask := p[1]&maskBit != 0 - c.readRemaining = int64(p[1] & 0x7f) + c.setReadRemaining(int64(p[1] & 0x7f)) c.readDecompress = false if c.newDecompressionReader != nil && (p[0]&rsv1Bit) != 0 { @@ -827,7 +837,17 @@ func (c *Conn) advanceFrame() (int, error) { return noFrame, c.handleProtocolError("unknown opcode " + strconv.Itoa(frameType)) } - // 3. Read and parse frame length. + // 3. Read and parse frame length as per + // https://tools.ietf.org/html/rfc6455#section-5.2 + // + // The length of the "Payload data", in bytes: if 0-125, that is the payload + // length. + // - If 126, the following 2 bytes interpreted as a 16-bit unsigned + // integer are the payload length. + // - If 127, the following 8 bytes interpreted as + // a 64-bit unsigned integer (the most significant bit MUST be 0) are the + // payload length. Multibyte length quantities are expressed in network byte + // order. switch c.readRemaining { case 126: @@ -835,13 +855,19 @@ func (c *Conn) advanceFrame() (int, error) { if err != nil { return noFrame, err } - c.readRemaining = int64(binary.BigEndian.Uint16(p)) + + if err := c.setReadRemaining(int64(binary.BigEndian.Uint16(p))); err != nil { + return noFrame, err + } case 127: p, err := c.read(8) if err != nil { return noFrame, err } - c.readRemaining = int64(binary.BigEndian.Uint64(p)) + + if err := c.setReadRemaining(int64(binary.BigEndian.Uint64(p))); err != nil { + return noFrame, err + } } // 4. Handle frame masking. @@ -864,6 +890,12 @@ func (c *Conn) advanceFrame() (int, error) { if frameType == continuationFrame || frameType == TextMessage || frameType == BinaryMessage { c.readLength += c.readRemaining + // Don't allow readLength to overflow in the presence of a large readRemaining + // counter. + if c.readLength < 0 { + return noFrame, ErrReadLimit + } + if c.readLimit > 0 && c.readLength > c.readLimit { c.WriteControl(CloseMessage, FormatCloseMessage(CloseMessageTooBig, ""), time.Now().Add(writeWait)) return noFrame, ErrReadLimit @@ -877,7 +909,7 @@ func (c *Conn) advanceFrame() (int, error) { var payload []byte if c.readRemaining > 0 { payload, err = c.read(int(c.readRemaining)) - c.readRemaining = 0 + c.setReadRemaining(0) if err != nil { return noFrame, err } @@ -950,6 +982,7 @@ func (c *Conn) NextReader() (messageType int, r io.Reader, err error) { c.readErr = hideTempErr(err) break } + if frameType == TextMessage || frameType == BinaryMessage { c.messageReader = &messageReader{c} c.reader = c.messageReader @@ -990,7 +1023,9 @@ func (r *messageReader) Read(b []byte) (int, error) { if c.isServer { c.readMaskPos = maskBytes(c.readMaskKey, c.readMaskPos, b[:n]) } - c.readRemaining -= int64(n) + rem := c.readRemaining + rem -= int64(n) + c.setReadRemaining(rem) if c.readRemaining > 0 && c.readErr == io.EOF { c.readErr = errUnexpectedEOF } diff --git a/vendor/github.com/gorilla/websocket/doc.go b/vendor/github.com/gorilla/websocket/doc.go index c6f4df8960ff..8db0cef95a29 100644 --- a/vendor/github.com/gorilla/websocket/doc.go +++ b/vendor/github.com/gorilla/websocket/doc.go @@ -187,9 +187,9 @@ // than the largest message do not provide any benefit. // // Depending on the distribution of message sizes, setting the buffer size to -// to a value less than the maximum expected message size can greatly reduce -// memory use with a small impact on performance. Here's an example: If 99% of -// the messages are smaller than 256 bytes and the maximum message size is 512 +// a value less than the maximum expected message size can greatly reduce memory +// use with a small impact on performance. Here's an example: If 99% of the +// messages are smaller than 256 bytes and the maximum message size is 512 // bytes, then a buffer size of 256 bytes will result in 1.01 more system calls // than a buffer size of 512 bytes. The memory savings is 50%. // diff --git a/vendor/github.com/gorilla/websocket/go.mod b/vendor/github.com/gorilla/websocket/go.mod index 93a9e924a777..1a7afd5028a7 100644 --- a/vendor/github.com/gorilla/websocket/go.mod +++ b/vendor/github.com/gorilla/websocket/go.mod @@ -1 +1,3 @@ module github.com/gorilla/websocket + +go 1.12 diff --git a/vendor/github.com/gorilla/websocket/go.sum b/vendor/github.com/gorilla/websocket/go.sum index cf4fbbaa07ac..e69de29bb2d1 100644 --- a/vendor/github.com/gorilla/websocket/go.sum +++ b/vendor/github.com/gorilla/websocket/go.sum @@ -1,2 +0,0 @@ -github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= diff --git a/vendor/github.com/gorilla/websocket/prepared.go b/vendor/github.com/gorilla/websocket/prepared.go index 74ec565d2c38..c854225e9676 100644 --- a/vendor/github.com/gorilla/websocket/prepared.go +++ b/vendor/github.com/gorilla/websocket/prepared.go @@ -73,8 +73,8 @@ func (pm *PreparedMessage) frame(key prepareKey) (int, []byte, error) { // Prepare a frame using a 'fake' connection. // TODO: Refactor code in conn.go to allow more direct construction of // the frame. - mu := make(chan bool, 1) - mu <- true + mu := make(chan struct{}, 1) + mu <- struct{}{} var nc prepareConn c := &Conn{ conn: &nc, diff --git a/vendor/github.com/gorilla/websocket/server.go b/vendor/github.com/gorilla/websocket/server.go index 3d4480a47764..887d558918c7 100644 --- a/vendor/github.com/gorilla/websocket/server.go +++ b/vendor/github.com/gorilla/websocket/server.go @@ -153,7 +153,7 @@ func (u *Upgrader) Upgrade(w http.ResponseWriter, r *http.Request, responseHeade challengeKey := r.Header.Get("Sec-Websocket-Key") if challengeKey == "" { - return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: `Sec-WebSocket-Key' header is missing or blank") + return u.returnError(w, r, http.StatusBadRequest, "websocket: not a websocket handshake: 'Sec-WebSocket-Key' header is missing or blank") } subprotocol := u.selectSubprotocol(r, responseHeader) 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 000000000000..364516251b93 --- /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/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/internal/BUILD.bazel new file mode 100644 index 000000000000..76cafe6ec7f7 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/internal/BUILD.bazel @@ -0,0 +1,22 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library") +load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library") + +package(default_visibility = ["//visibility:public"]) + +proto_library( + name = "internal_proto", + srcs = ["stream_chunk.proto"], + deps = ["@com_google_protobuf//:any_proto"], +) + +go_proto_library( + name = "internal_go_proto", + importpath = "github.com/grpc-ecosystem/grpc-gateway/internal", + proto = ":internal_proto", +) + +go_library( + name = "go_default_library", + embed = [":internal_go_proto"], + importpath = "github.com/grpc-ecosystem/grpc-gateway/internal", +) 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 000000000000..8858f069046f --- /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/internal/stream_chunk.proto b/vendor/github.com/grpc-ecosystem/grpc-gateway/internal/stream_chunk.proto new file mode 100644 index 000000000000..55f42ce63ec0 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/internal/stream_chunk.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package grpc.gateway.runtime; +option go_package = "internal"; + +import "google/protobuf/any.proto"; + +// StreamError is a response type which is returned when +// streaming rpc returns an error. +message StreamError { + int32 grpc_code = 1; + int32 http_code = 2; + string message = 3; + string http_status = 4; + repeated google.protobuf.Any details = 5; +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/BUILD.bazel new file mode 100644 index 000000000000..20862228ef87 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/BUILD.bazel @@ -0,0 +1,84 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +package(default_visibility = ["//visibility:public"]) + +go_library( + name = "go_default_library", + srcs = [ + "context.go", + "convert.go", + "doc.go", + "errors.go", + "fieldmask.go", + "handler.go", + "marshal_httpbodyproto.go", + "marshal_json.go", + "marshal_jsonpb.go", + "marshal_proto.go", + "marshaler.go", + "marshaler_registry.go", + "mux.go", + "pattern.go", + "proto2_convert.go", + "proto_errors.go", + "query.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/runtime", + deps = [ + "//internal:go_default_library", + "//utilities:go_default_library", + "@com_github_golang_protobuf//jsonpb:go_default_library_gen", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//protoc-gen-go/generator:go_default_library_gen", + "@go_googleapis//google/api:httpbody_go_proto", + "@io_bazel_rules_go//proto/wkt:any_go_proto", + "@io_bazel_rules_go//proto/wkt:duration_go_proto", + "@io_bazel_rules_go//proto/wkt:field_mask_go_proto", + "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", + "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", + "@org_golang_google_grpc//codes:go_default_library", + "@org_golang_google_grpc//grpclog:go_default_library", + "@org_golang_google_grpc//metadata:go_default_library", + "@org_golang_google_grpc//status:go_default_library", + ], +) + +go_test( + name = "go_default_test", + size = "small", + srcs = [ + "context_test.go", + "errors_test.go", + "fieldmask_test.go", + "handler_test.go", + "marshal_httpbodyproto_test.go", + "marshal_json_test.go", + "marshal_jsonpb_test.go", + "marshal_proto_test.go", + "marshaler_registry_test.go", + "mux_test.go", + "pattern_test.go", + "query_test.go", + ], + embed = [":go_default_library"], + deps = [ + "//examples/proto/examplepb:go_default_library", + "//internal:go_default_library", + "//utilities:go_default_library", + "@com_github_golang_protobuf//jsonpb:go_default_library_gen", + "@com_github_golang_protobuf//proto:go_default_library", + "@com_github_golang_protobuf//ptypes:go_default_library_gen", + "@go_googleapis//google/api:httpbody_go_proto", + "@go_googleapis//google/rpc:errdetails_go_proto", + "@io_bazel_rules_go//proto/wkt:duration_go_proto", + "@io_bazel_rules_go//proto/wkt:empty_go_proto", + "@io_bazel_rules_go//proto/wkt:field_mask_go_proto", + "@io_bazel_rules_go//proto/wkt:struct_go_proto", + "@io_bazel_rules_go//proto/wkt:timestamp_go_proto", + "@io_bazel_rules_go//proto/wkt:wrappers_go_proto", + "@org_golang_google_grpc//:go_default_library", + "@org_golang_google_grpc//codes:go_default_library", + "@org_golang_google_grpc//metadata:go_default_library", + "@org_golang_google_grpc//status:go_default_library", + ], +) 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 000000000000..896057e1e1e1 --- /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 000000000000..a5b3bd6a792c --- /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 000000000000..b6e5ddf7a9f1 --- /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 000000000000..41d54ef916aa --- /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 000000000000..e1cf7a91461f --- /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 000000000000..2af900650dcd --- /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 000000000000..f55285b5d6ca --- /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 000000000000..f9d3a585a4c0 --- /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 000000000000..2fbb26287275 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb.go @@ -0,0 +1,250 @@ +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: true} + 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: true} + 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") +} 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 000000000000..f65d1a2676b8 --- /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 000000000000..98fe6e88ac59 --- /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 000000000000..5cc53ae4f681 --- /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 000000000000..093373a204a1 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux.go @@ -0,0 +1,289 @@ +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 +} + +// 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 + } +} + +// 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) { + 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 000000000000..f16a84ad3892 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern.go @@ -0,0 +1,227 @@ +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 +} + +// 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) (Pattern, error) { + 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, + }, 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 { + return nil, ErrNotMatch + } + + 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 +} 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 000000000000..a3151e2a5528 --- /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 000000000000..ca76324efb1f --- /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 000000000000..bb9359f17c03 --- /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/utilities/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/BUILD.bazel new file mode 100644 index 000000000000..7109d7932318 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/BUILD.bazel @@ -0,0 +1,21 @@ +load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") + +package(default_visibility = ["//visibility:public"]) + +go_library( + name = "go_default_library", + srcs = [ + "doc.go", + "pattern.go", + "readerfactory.go", + "trie.go", + ], + importpath = "github.com/grpc-ecosystem/grpc-gateway/utilities", +) + +go_test( + name = "go_default_test", + size = "small", + srcs = ["trie_test.go"], + embed = [":go_default_library"], +) 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 000000000000..cf79a4d58860 --- /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 000000000000..dfe7de4864ab --- /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 000000000000..6dd3854665f1 --- /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 000000000000..c2b7b30dd917 --- /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/hashicorp/consul-template/CHANGELOG.md b/vendor/github.com/hashicorp/consul-template/CHANGELOG.md deleted file mode 100644 index 370762318c28..000000000000 --- a/vendor/github.com/hashicorp/consul-template/CHANGELOG.md +++ /dev/null @@ -1,1087 +0,0 @@ -## v0.24.1 (Jan 24, 2020) - -BUG FIXES: - -* Make user non-numeric to satisfy PSP [GH-1332](https://github.com/hashicorp/consul-template/pull/1332) -* fatal error: PowerRegisterSuspendResumeNotification failure on windows [GH-1335](https://github.com/hashicorp/consul-template/issues/1335) - -## v0.24.0 (Jan 08, 2020) - -BREAKING CHANGES: - -* Alpine Docker image no longer runs as root and so doesn't change ownership of the /consul-template/data and /consul-template/config directories to the consul-template user. See the [Docker Image Use](https://github.com/hashicorp/consul-template#docker-image-use) topic in the documentation for more. - -BUG FIXES: - -* arm builds are linked against wrong library [[GH-1317](https://github.com/hashicorp/consul-template/issues/1317), [GH-1326](https://github.com/hashicorp/consul-template/pull/1326)] -* consul-template container runs as root - breaks CISO compliance [[GH-1321](https://github.com/hashicorp/consul-template/issues/1321), [GH-1324](https://github.com/hashicorp/consul-template/pull/1324)] -* 'sockaddr' function returning whitespace after address [[GH-1314](https://github.com/hashicorp/consul-template/issues/1314), [GH-1315](https://github.com/hashicorp/consul-template/pull/1315)] -* runTemplate - DEBUG logging is needed to identify missing dependencies [[GH-1308](https://github.com/hashicorp/consul-template/issues/1308), [GH-1309](https://github.com/hashicorp/consul-template/pull/1309)] -* Remove code/logic for working with (long deprecated) Vault grace [[GH-1284](https://github.com/hashicorp/consul-template/pull/1284)] - -## v0.23.0 (Nov 13, 2019) - -IMPROVEMENTS: - -* Support Configuring Consul Connect Clients [[GH-1262](https://github.com/hashicorp/consul-template/issues/1262), [GH-1304](https://github.com/hashicorp/consul-template/pull/1304), [GH-1306](https://github.com/hashicorp/consul-template/pull/1306)] - -## v0.22.1 (Nov 08, 2019) - -SECURITY: - -* curl is vulnerable in the latest alpine docker image [[GH-1302](https://github.com/hashicorp/consul-template/issues/1302)] - -BUG FIXES: - -* fix breaking change for loop [[GH-1285](https://github.com/hashicorp/consul-template/issues/1285)] - -## v0.22.0 (September 10, 2019) - -IMPROVEMENTS: - -* Add rate limiting to consul api calls [[GH-1279](https://github.com/hashicorp/consul-template/pull/1279)] -* Add `byMeta` function [[GH-1237](https://github.com/hashicorp/consul-template/pull/1237)] -* Add support for : and = in service tag values [[GH-1149](https://github.com/hashicorp/consul-template/pull/1149), [GH-1049](https://github.com/hashicorp/consul-template/issues/1049)] -* Add `explodeMap` function [[GH-1148](https://github.com/hashicorp/consul-template/pull/1148)] -* Don't wait for splay when stopping child runner [[GH-1141](https://github.com/hashicorp/consul-template/pull/1141)] -* Add `safels` and `safetree` functions [[GH-1132](https://github.com/hashicorp/consul-template/pull/1132)] -* Support Vault certificates with no lease [[GH-1106](https://github.com/hashicorp/consul-template/pull/1106)] -* Add wrapper function for go-sockaddr templating [[GH-1087](https://github.com/hashicorp/consul-template/pull/1087)] -* Build binaries for arm64 platform [[GH-1251](https://github.com/hashicorp/consul-template/pull/1251)] - -BUG FIXES: - -* Fix arm/arm64 builds by enabling CGO and restricting builds to Linux [workaround for [go/issues/32912](https://github.com/golang/go/issues/32912)] - -## v0.21.3 (September 05, 2019) - -BUG FIXES: - -* Fix regression in non-renewable sleep [[GH-1277](https://github.com/hashicorp/consul-template/pull/1277), [GH-1272](https://github.com/hashicorp/consul-template/issues/1272), [GH-1276](https://github.com/hashicorp/consul-template/issues/1276)] - -## v0.21.2 (August 31, 2019) - -BUG FIXES: - -* Fix regression in backup [[GH-1271](https://github.com/hashicorp/consul-template/pull/1271), [GH-1270](https://github.com/hashicorp/consul-template/issues/1270)] - -## v0.21.1 (August 30, 2019) - -BUG FIXES: - -* Fixed issue in Vault call retry logic [[GH-1269](https://github.com/hashicorp/consul-template/pull/1269), [GH-1224](https://github.com/hashicorp/consul-template/issues/1224)] -* Fixed race in backup [[GH-1265](https://github.com/hashicorp/consul-template/pull/1265), [GH-1264](https://github.com/hashicorp/consul-template/issues/1264)] -* Fixed issue when reading deleted secret [[GH-1260](https://github.com/hashicorp/consul-template/pull/1260), [GH-1198](https://github.com/hashicorp/consul-template/issues/1198)] -* Fix issue with Vault writes [[GH-1257](https://github.com/hashicorp/consul-template/pull/1257), [GH-1252](https://github.com/hashicorp/consul-template/issues/1252)] -* Fix loop to work with template set integers [[GH-1255](https://github.com/hashicorp/consul-template/pull/1255), [GH-1143](https://github.com/hashicorp/consul-template/issues/1143)] - -## v0.21.0 (August 05, 2019) - -IMPROVEMENTS: - -* Migrated to use Go modules [[GH-1244](https://github.com/hashicorp/consul-template/pull/1244), [GH-1173](https://github.com/hashicorp/consul-template/issues/1173), [GH-1208](https://github.com/hashicorp/consul-template/pull/1208)[GH-1232](https://github.com/hashicorp/consul-template/pull/1232)] -* Template blacklist feature [[GH-1243](https://github.com/hashicorp/consul-template/pull/1243)] - -## v0.20.1 (July 30, 2019) - -BUG FIXES: - -* Fixed issue with exec running before template rendering when wait is set [[GH-1229](https://github.com/hashicorp/consul-template/issues/1229), [GH-1209](https://github.com/hashicorp/consul-template/issues/1209)] -* Fixed issue with templates not rendering with `-once` [[GH-1227](https://github.com/hashicorp/consul-template/pull/1227), [GH-1196](https://github.com/hashicorp/consul-template/issues/1196), [GH-1207](https://github.com/hashicorp/consul-template/issues/1207)] -* Fixed regression with ~/.vault-token and with vault_agent_token_file not respecting renew_token [[GH-1228](https://github.com/hashicorp/consul-template/issues/1228), [GH-1189](https://github.com/hashicorp/consul-template/issues/1189)] -* CA certificates missing from docker 'light' image [[GH-1200](https://github.com/hashicorp/consul-template/issues/1200)] -* Fixed issue with dedup data garbage in Consul KV [[GH-1158](https://github.com/hashicorp/consul-template/issues/1158), [GH-1168](https://github.com/hashicorp/consul-template/issues/1168)] -* Fixed bad case in import path [[GH-1139](https://github.com/hashicorp/consul-template/issues/1139)] -* Documented limits on using "." in service names [[GH-1205](https://github.com/hashicorp/consul-template/issues/1205)] - -## v0.20.0 (February 19, 2019) - -IMPROVEMENTS: - -* Support for Consul service metadata [GH-1113] -* Support for Vault's KV v2 secrets engine, including versioned secrets [GH-1180]. -* Support for Vault Enterprise's namespaces feature [GH-1181]. -* Support for a new config parameter, `vault_agent_token_file`, which supports loading the Vault token from the contents of a dynamically updated file. This is intended for use in environments like Kubernetes [GH-1185]. -* A template's destination file will now have its user and group permissions preserved on supported OSes (Linux/MacOS) [GH-1061]. - -BUG FIXES: - -* The indent function no longer panics on negative spaces variable [GH-1127] -* Fixed an issue that caused `exec` to not be called with multiple templates and `wait` configured [GH-1043] -* Fixed an issue where Consul Template did not wait for most of a non-renewable secret's lease before attempting to refresh the secret. [GH-1183] - -## v0.19.5 (June 12, 2018) - -BUG FIXES: - - * The de-duplication feature was incorrectly calculating the hash of dependency - values over an unstable encoding of the data. This meant that in most cases - the templates were being re-written to KV and on all watching template - instances every minimum update time (i.e. `wait { min = X }`). At best this - was a lot of wasted work, in some cases it caused 100% CPU usage when template - instance leadership was split. [GH-1099, GH-1095] - * Fixed an issue where we waited unnecessarily for a child process to exit [GH-1101] - -IMPROVEMENTS: - - * Initiating runner log level moved to DEBUG [GH-1088] - - -## v0.19.4 (October 30, 2017) - -BREAKING CHANGES: - - * The version of Consul Template is now taken into account when using - de-duplication mode. Without bundling the version, it's challenging to - upgrade existing clusters or run multiple versions of Consul Template on the - same cluster and template simultaneously. [GH-1025] - -BUG FIXES: - - * Remove references to unsupported `dump_signal` configuration - - * Update vendor libraries to support Consul 1.0.0 changes for better test - stability - - * Renew unwrapped Vault token (previously Consul Template) would try to renew - the wrapped token, which would not work. - - * Do not sort results when `~near` queries are used [GH-1027] - - * Handle integer overflow in exponential backoff calculations - [GH-1031, GH-1028] - - * Properly preserve existing file permissions [GH-1037] - -IMPROVEMENTS: - - * Compile with Go 1.9.2 - - * The Vault grace period in the config is now set to 15 seconds as the - default. This matches Vault's default configuration for consistency. - - * Add `indent` function for indenting blocks of text in templates - - * Allow additional colons in the template command on the CLI [GH-1026] - - * Add Vault Transit example for key exfiltration [GH-1014] - - * Add a new option for disabling recursive directory creation per template - [GH-1033] - - * Allow dots in node names [GH-977] - -## v0.19.3 (September 11, 2017) - -BUG FIXES: - - * Fix a bug that would cause once mode to not exit when the file pre-existed - on disk with the correct contents. [GH-1000] - -## v0.19.2 (September 1, 2017) - -BUG FIXES: - - * Fix a critical bug that would cause a hot loop for some TTL durations. - [GH-1004] - -## v0.19.1 (August 25, 2017) - -IMPROVEMENTS: - - * The runner's render event now includes the last-rendered template contents. - This is useful when embedding Consul Template as a library. [GH-974-975] - - * Use the new Golang API renewer [GH-978] - - * Compile and build with Go 1.9 - -BUG FIXES: - - * Add per-template option `error_on_missing_key`. This causes the template to - error when the user attempts to access a key in a map or field in a struct - that does not exist. Previous behavior was to print ``, which - might not be the desired behavior. This is opt-in behavior on a - per-template basis. There is no global option. A future version of - Consul Template will switch the default behavior to this safer format, but - that change will be clearly called out as a breaking change in the future. - Users should set `error_on_missing_key = false` in their configuration - files if they are relying on the current `` behavior. - [GH-973, GH-972] - * Ensure all templates are rendered before spawning commands [GH-991, GH-995] - -## v0.19.0 (June 29, 2017) - -BREAKING CHANGES: - - * All previous deprecation errors have been removed and associated configs or - CLI options are no longer valid. It is highly recommended that you run - v0.18.5 and resolve any deprecations before upgrading to this version! - -IMPROVEMENTS: - - * Add new configuration option `vault.grace`, which configures the grace - period between lease renewal and secret re-acquisition. When renewing a - secret, if the remaining lease is less than or equal to the configured - grace, Consul Template will request a new credential. This prevents Vault - from revoking the credential at expiration and Consul Template having a - stale credential. **If you set this to a value that is higher than your - default TTL or max TTL, Consul Template will always read a new secret!** - * Add a new option to `datacenters` to optionally ignore inaccessible - datacenters [GH-908]. - -BUG FIXES: - - * Use the logger as soon as its available for output [GH-947] - * Update Consul API library to fix a bug where custom CA configuration was - ignored [GH-965] - - -## v0.18.5 (May 25, 2017) - -BREAKING CHANGES: - - * Retry now has a sane maximum default. Previous versions of Consul Template - would retry indefinitely, potentially allowing the time between retries to - reach days, months, or years due to the exponential nature. Users wishing - to use the old behavior should set `max_backoff = 0` in their - configurations. [GH-940] - -IMPROVEMENTS: - - * Add support for `MaxBackoff` in Retry options [GH-938, GH-939] - * Compile with Go 1.8.3 - -## v0.18.4 (May 25, 2017) - -BUG FIXES: - - * Compile with go 1.8.2 for the security fix. The code is exactly the same as - v0.18.3. - -## v0.18.3 (May 9, 2017) - -IMPROVEMENTS: - - * Add support for local datacenter in node queries [GH-862, GH-927] - * Add support for service tags on health checks [Consul vendor update] - -BUG FIXES: - - * Seed the random generator for splay values - * Reset retries counter on successful contact [GH-931] - * Return a nil slice instead of an error for non-existent maps - [GH-906, GH-932] - * Do not return data in dedup mode if the template is unchanged - [GH-933 GH-698] - -NOTABLE: - - * Consul Template is now built with Go 1.8.1 - * Update internal library to Consul 0.8.2 - this should not affect any users - -## v0.18.2 (March 28, 2017) - -IMPROVEMENTS: - - * Add missing HTTP transport configuration options - * Add `modulo` function for performing modulo math - -BUG FIXES: - - * Default transport max idle connections based on `GOMAXPROCS` - * Read `VAULT_*` envvars before finalizing [GH-914, GH-916] - * Register `[]*KeyPair` as a gob [GH-893] - -## v0.18.1 (February 7, 2017) - -IMPROVEMENTS: - - * Add support for tagged addresses and metadata [GH-863] - * Add `.exe` extension to Windows binaries [GH-875] - * Add support for customizing the low-level transport details for Consul and - Vault [GH-880, GH-877] - * Read token from `~/.vault-token` if it exists [GH-878, GH-884] - -BUG FIXES: - - * Resolve an issue with filters on health service dependencies [GH-857] - * Restore ability to reload configurations from disk [GH-866] - * Move `env` back to a helper function [GH-882] - - This was causing a lot of issues for users, and it required many folks to - re-write their templates for the small benefit of people running in - de-duplicate mode who did not understand the trade-offs. The README is now - updated with the trade-offs of running in dedup mode and the expected `env` - behavior has been restored. - - * Do not loop indefinitely if the dedup manager is unable to acquire a lock - [GH-864] - - -## v0.18.0 (January 20, 2017) - -NEW FEATURES: - - * Add new template function `keyExists` for determining if a key is present. - See the breaking change notice before for more information about the - motivation for this change. - - * Add `scratch` for storing information across a template invocation. Scratch - is especially useful when saving a computed value to use it across a - template. Scratch values are not shared across multiple templates and are - not persisted between template invocations - - * Add support for controlling retry behavior for failed communications to - Consul or Vault. By default, Consul Template will now retry 5 times before - returning an error. The backoff timing and number of attempts can be tuned - using the CLI or a configuration file. - - * Add `executeTemplate` function for executing a defined template. - - * Add `base64Decode`, `base64Encode`, `base64URLDecode`, and `base64URLEncode` - functions for working with base64 encodings. - - * Add `containsAll`, `containsAny`, `containsNone`, and `containsNotAll` - functions for easy filtering of multiple tag selections. - -BREAKING CHANGES: - - * Consul Template now **blocks on `key` queries**. The previous behavior was - to always pass through, allowing users to use the existence of a key as - a source of control flow. This caused confusion among many users, so we - have restored the expected behavior of blocking on a `key` query, but have - added `keyExists` to check for the existence of a key. Note that the - `keyOrDefault` function remains unchanged and will not block if the value - is nil, as expected. - - * The `vault` template function has been removed. This has been deprecated - with a warning since v0.14.0. - - * A shell is no longer assumed for Template commands. Previous versions of - Consul Template assumed `/bin/sh` (`cmd` on Windows) as the parent - process for the template command. Due to user requests and a desire to - customize the shell, Consul Template no longer wraps the command in a - shell. For most commands, this change will be transparent. If you were - utilizing shell-specific functions like `&&`, `||`, or conditionals, you - will need to wrap you command in a shell, for example: - - ```shell - -template "in.tpl:out.tpl:/bin/bash -c 'echo a || b'" - ``` - - or - - ```hcl - template { - command = "/bin/bash -c 'echo a || b'" - } - ``` - - * The `env` function is now treated as a dependency instead of a helper. For - most users, there will be no impact. - - * This release is compiled with Golang v1.8. We do not expect this to cause - any issues, but it is worth calling out. - -DEPRECATIONS: - - * `.Tags.Contains` is deprecated. Templates should make use of the built-in - `in` and `contains` functions instead. For example: - - ```liquid - {{ if .Tags.Contains "foo" }} - ``` - - becomes: - - ```liquid - {{ if .Tags | contains "foo" }} - ``` - - or: - - ```liquid - {{ if "foo" | in .Tags }} - ``` - - * `key_or_default` has been renamed to `keyOrDefault` to better align with - Go's naming structure. The old method is aliased and will remain until a - future release. - - * Consul-specific CLI options are now prefixed with `-consul-`: - - * `-auth` is now `-consul-auth` - * `-ssl-(.*)` is now `-consul-ssl-$1` - * `-retry` is now `-consul-retry` and has been broken apart into more - specific CLI options. - - * Consul-specific configuration options are now nested under a stanza. For - example: - - ```hcl - auth { - username = "foo" - password = "bar" - } - ``` - - becomes: - - ```hcl - consul { - auth { - username = "foo" - password = "bar" - } - } - ``` - - This applies to the `auth`, `retry`, `ssl`, and `token` options. - -IMPROVEMENTS: - - * Add CLI support for all SSL configuration options for both Consul and Vault. - Vault options are identical to Consul but with `vault-` prefix. Includes - the addition of `ssl-ca-path` to be consistent with file-based configuration - options. - - * `ssl` `vault-ssl` (Enable) - * `ssl-verify` `vault-ssl-verify` - * `ssl-cert` `vault-ssl-cert` - * `ssl-key` `vault-ssl-key` - * `ssl-ca-cert` `vault-ssl-ca-cert` - * `ssl-ca-path` `vault-ssl-ca-path` - * `ssl-server-name` `vault-ssl-server-name` - - * Add `-consul-ssl-server-name` - * Add `-consul-ssl-ca-path` - * Add `-consul-retry` - * Add `-consul-retry-attempts` - * Add `-consul-retry-backoff` - * Add `-vault-retry` - * Add `-vault-retry-attempts` - * Add `-vault-retry-backoff` - * Add support for `server_name` option for TLS configurations to allow - specification of the expected certificate common name. - * Add `-vault-addr` CLI option for specifying the Vault server address - [GH-740, GH-747] - * Add tagged addresses to Node structs - * Add support for multiple `-config` flags [GH-773, GH-751] - * Add more control over template command execution - * Add a way to programatically track the dependencies a particular template - is blocked on [GH-799] - -BUG FIXES: - - * Fix `-renew-token` flag not begin honored on the CLI [GH-741, GH-745] - * Allow `*` in key names [GH-789, GH-755] - -## v0.16.0 (September 22, 2016) - -NEW FEATURES: - - * **Exec Mode!** Consul Template can now act as a faux-supervisor for - applications. Please see the [Exec Mode](README.md#exec-mode) - documentation for more information. - * **Vault Token Unwrapping!** Consul Template can now unwrap Vault tokens that - have been wrapped using Vault's cubbyhole response wrapping. Simply add - the `unwrap_token` option to your Vault configuration stanza or pass in - the `-vault-unwrap-token` command line flag. - -BREAKING CHANGES: - - * Consul Template no longer terminates on SIGTERM or SIGQUIT. Previous - versions were hard-coded to listen for SIGINT, SIGTERM, and SIGQUIT. This - value is now configurable, and the default is SIGINT. SIGQUIT will trigger - a core dump in accordance with similar programs. SIGTERM is no longer - listened. - * Consul Template now exits on irrecoverable Vault errors such as failing to - renew a token or lease. - -DEPRECATIONS: - - * The `vault.renew` option has been renamed to `vault.renew_token` for added - clarity. This is backwards-compatible for this release, but will be - removed in a future release, so please update your configurations - accordingly. - -IMPROVEMENTS: - - * Permit commas in key prefix names [GH-669] - * Add configurable kill and reload signals [GH-686] - * Add a command line flag for controlling whether a provided Vault token will - be renewed [GH-718] - -BUG FIXES: - - * Allow variadic template function for `secret` [GH-660, GH-662] - * Always log in UTC time - * Log milliseconds [GH-676, GH-674] - * Maintain template ordering [GH-683] - * Add `Service` address to catalog node response [GH-687] - * Do not require trailing slashes [GH-706, GH-713] - * Wait for all existing dedup acquire attempts to finish [GH-716, GH-677] - - -## v0.15.0.dev (June 9, 2016) - -BREAKING CHANGES: - - * **Removing reaping functionality** [GH-628] - -IMPROVEMENTS: - - * Allow specifying per-template delimiters [GH-615, GH-389] - * Allow specifying per-template wait parameters [GH-589, GH-618] - * Switch to actually vendoring dependencies - * Add support for writing data [GH-652, GH-492] - -BUG FIXES: - - * Close open connections when reloading configuration [GH-591, GH-595] - * Do not share catalog nodes [GH-611, GH-572, GH-603] - * Properly handle empty string in ParseUint [GH-610, GH-609] - * Cache Vault's _original_ lease duration [5b955a8] - * Use decimal division for calculating Vault lease durations [87d61d9] - * Load VAULT_TOKEN environment variable [2431448] - * Properly clean up quiescence timers when using multiple templates [GH-616] - * Print a nice error if K/V cannot be exploded [GH-617, GH-596] - * Update documentation about symlinks [GH-579] - * Properly parse file permissions in mapstructure [GH-626] - -## v0.14.0 (March 7, 2016) - -DEPRECATIONS: - - * The `vault` template API function has been renamed to `secret` to be in line - with other tooling. The `vault` API function will continue to work but will - print a warning to the log file. A future release of Consul Template will - remove the `vault` API. - -NEW FEATURES: - - * Add `secrets` template API for listing secrets in Vault. Please note this - requires Vault 0.5+ and the secret backend must support listing. Please see - the Vault documentation for more information [GH-270] - -IMPROVEMENTS: - - * Allow passing any kind of object to `toJSON` in the template. Previously - this was restricted to key-value maps, but that restriction is now removed. - [GH-553] - -BUG FIXES: - - * Parse file permissions as a string in JSON [GH-548] - * Document how to reload config with signals [GH-522] - * Stop all dependencies when reloading the running/watcher [GH-534, GH-568] - -## v0.13.0 (February 18, 2016) - -BUG FIXES: - - * Compile with go1.6 to avoid race [GH-442] - * Switch to using a pooled transport [GH-546] - -## v0.12.2 (January 15, 2016) - -BUG FIXES: - - * Fixed an issue when running as PID 1 in a Docker container where Consul - Template could consume CPU and spuriously think its spwaned sub-processes - had failed [GH-511] - -## v0.12.1 (January 7, 2016) - -IMPROVEMENTS: - - * Add support for math operations on uint types [GH-483, GH-484] - * Make check information available through health service [GH-490] - -BUG FIXES: - - * Store vault data on the dependency and handle an error where a failed - lease renewal would result in `` in the rendered template. Please - note, there is a bug in Vault 0.4 with respect to lease renewals that makes - it inoperable with Consul Template. Please either use Vault 0.3 or wait - until Vault 0.5 is released (the bug has already been fixed on master). - [GH-468, GH-493, GH-504] - - -## v0.12.0 (December 10, 2015) - -BREAKING CHANGES: - - * Add support for checking if a node is in maintenance mode [GH-477, GH-455] - - Previously, Consul Template would report nodes in maintenance mode as - "critical". They will now report as "maintenance" so users can perform more - detailed filtering. It is unlikely, but if you were filtering critical - services, nodes/services in maintenance mode will no longer be included. - - -FEATURES: - - * Add support for de-duplication mode. In de-duplication mode, Consul Template - uses leader election to elect one Consul Template process to render a - template. The results of this template are rendered into Consul's key-value - store, and other templates pull from the pre-rendered template. This option - is off by default, but it is highly recommended that the option is enabled - for clusters with a high load factor (number of templates x number of - dependencies per template). [GH-465] - * Add support for automatically reaping child processes. This is very useful - when running Consul Template as PID 1 (like in a Docker container) when no - init system is present. The option is configurable, but it defaults to "on" - when the Consul Template process is PID 1. [GH-428, GH-479] - - -IMPROVEMENTS: - - * Use the `renew-self` endpoint instead of `renew` for renewing the token - [GH-450] - * Allow existing templates to be backed up before writing the new one [GH-464] - * Add support for TLS/SSL mutual authentication [GH-448] - * Add support for checking if a node is in maintenance mode [GH-477, GH-455] - - -## v0.11.1 (October 26, 2015) - -FEATURES: - - * Accept "unix" as an argument to `timestamp` to generate a unix - timestamp [GH-422] - -IMPROVEMENTS: - - * Make `Path` a public field on the vault secret dependency so other libraries - can access it - -BUG FIXES: - - * Ensure there is a newline at the end of the version output - * Update README development instructions [GH-423] - * Adjust error messages so that data does not always "come from Consul" - * Fix race conditions in tests - * Update the `LastContact` value for non-Consul dependencies to always - return 0 [GH-432, GH-433] - * Always use `DefaultConfig()` in tests to find issues - * Fix broken math functions - previously add, subtract, multiply, and divide - for integers would perform the operation on only the first operand - [GH-430, GH-435] - * Renew the vault token based off of the auth, not the secret [GH-443] - * Remove noisy log message [GH-445] - - -## v0.11.0 (October 9, 2015) - -BREAKING CHANGES: - - * Allow configuration of destination file permissions [GH-415, GH-358] - - Previously, Consul Template would inspect the file at the destination path - and mirror those file permissions, if a file existed. If a file did not - exist, Consul Template would render the file with 0644 permissions. This was - acceptable behavior in a pre-Vault world, but now that Consul Template is - capable of rendering secrets, there is a desire for increased security. As - such, Consul Template **no longer mirrors existing destination file - permissions**. Instead, users can specify the file permissions in the - configuration file. Please see the README for examples. If you were - previously relying on an existing file's file permissions to enfore the - destination file permissions, you must switch to specifying the file - permissions in the configuration file. If you were not dependent on this - behavior, nothing has changed; the default value is still 0644. - -FEATURES: - - * Add `in` and `contains` functions for checking if a slice or array contains - a given value [GH-366] - * Add `add` function for calculating the sum of integers/floats - * Add `subtract` function for calculating the difference of integers/floats - * Add `multiply` function for calculating the product of integers/floats - * Add `divide` function for calculating the division of integers/floats - -IMPROVEMENTS: - - * Sort serivces by ID as well - * Add a mechanism for renewing the given Vault token [GH-359, GH-367] - * Default max-stale to 1s - this severely reduces the load on the Consul - leader by allowing followers to respond to API requests [GH-386, GH-397] - * Add GPG signing for SHASUMS on new releases - * Push watcher errors down to the client in `once` mode [GH-361, GH-418] - -BUG FIXES: - - * Set ssl in the CLI [GH-321] - * **Regression** - Reload configuration on SIGHUP [GH-332] - * Remove port option from `service` query and documentation - it was unused - and legacy, but was causing issues and confusion [GH-333] - * Return the empty value when no parsable value is given [GH-353] - * Start with a blank configuration when reloading via SIGHUP [GH-393, GH-394] - * Use an int64 instead of an int to loop function [GH-401, GH-402] - * Do not remove the Windows file if it exists [GH-378] - -## v0.10.0 (June 9, 2015) - -FEATURES: - - * Add `plugin` and plugin ecosystem - * Add `parseBool` function for parsing strings into booleans (GH-312) - * Add `parseFloat` function for parsing strings into float64 (GH-312) - * Add `parseInt` function for parsing strings into int64 (GH-312) - * Add `parseUint` function for parsing strings into uint64 (GH-312) - * Add `explode` function for exploding the result of `tree` or `ls` into a - deeply nested hash (GH-311) - * Add `toJSON` and `toJSONPretty` function for exporting the result of `tree` - or `ls` into a JSON hash (GH-311) - * Add `toYAML` function for exporting the result of `tree` or `ls` into a - YAML document (GH-311) - * Add `node` function for querying nodes (GH-306, GH-309) - * Add `split` function for splitting a string on a separator (GH-285) - * Add `join` function for joining a string slice on a given key (GH-285) - * Add `pid_file` configuration and command line option for specifying the - location of a pid file on disk (GH-281, GH-286) - -IMPROVEMENTS: - - * Allow setting log_level via the configuration file (CLI still take - precedence if specified) - * Improve error reporting when loading multiple configs by including the path - on the configuration file that had an error (GH-275) - * Add a timeout around command execution to prevent hanging (GH-283) - * Read Vault/Consul environment variables for the config (GH-307, GH-308) - -BUG FIXES: - - * Properly merge "default" config values with user-supplied values (GH-271) - - -## v0.9.0 (April 29, 2015) - -FEATURES: - - * Add Vault functionality for querying secrets from Vault (GH-264) - * Add `regexMatch` template helper to determine if a result matches the given - regular expressions (GH-246) - * Add support for `ssl-cert` and `ss-ca-cert` options (GH-255) - -IMPROVEMENTS: - - * Expand `byTag` to accept catalog services as well (GH-249, GH-250) - * Allow catalog service tags to use the `.Contains` function (GH-261) - -BUG FIXES: - - * Send the standard error of commands back over the standard error of - Consul Template (GH-253, GH-254) - * Allow specifying `-v` in addition to `-version` to get the version output - -## v0.8.0 (March 30, 2015) - -FEATURES: - - * Add `.Size()` so the watcher can report its size (GH-206) - * Add `byKey` template helper to group the results of a `tree` function by - their containing directory (GH-207, GH-209, GH-241) - * Add `timestamp` template function for returning the current timestamp with - the ability to add custom formatting (GH-225, GH-230) - * Add `loop` template function for iteration (GH-238, GH-221) - -IMPROVEMENTS: - - * Expose `LastIndex` and `ReceivedData` from the Watcher - * Add unimplemented KV fields (GH-203) - * Warn the user if there are a large number of dependencies (GH-205) - * Extend documentation on how health service dependencies are downloaded from - Consul (GH-212) - * Allow empty configuration directories (GH-217) - * Document caveats around using `parseJSON` during multi-evaluation - * Print the final configuration as JSON in debug mode (GH-231) - * Export certain environment variables when executing commands that are read - by other Consul tooling or in your scripts (GH-232) - see the README for - more information - * Adjust logging to be less noisy without compromising information (GH-242) - -BUG FIXES: - - * Properly filter services by their type (GH-210, GH-212) - * Return an error if extra arguments are given on the command line (GH-227) - * Do not overwrite given configuration with the default options (GH-228, GH-219) - * Check for the correct conditions when using basic authentication (GH-220) - * Remove unused code paths for clarity (GH-242) - * Remove race condition in templates when called concurrently (GH-242) - * Remove race condition in test suite (GH-242) - * Force a refresh if Consul's WaitIndex is less than our current value (GH-242) - * Avoid pushing data onto the watcher when the view has been stopped (GH-242) - * Do not accept data in the runner for an unwatched dependency (GH-198, GH-242) - -## v0.7.0 (February 19, 2015) - -BREAKING CHANGES: - - * Remove `ssl` configuration option from templates - use an `ssl` - configuration block with `enabled = true` instead - * Remove `ssl_no_verify` configuration option from templates - use an `ssl` - configuration block with `verify = false` instead - * Restructure CLI `-ssl-no-verify` to `-ssl-verify` - to disable SSL - certification validation on the command line, use `-ssl-verify=false` - * Remove `auth` configuration option from templates - use an `auth` - configuration block with `enabled = true` combined with `username = ...` and - `password = ...` inside the block instead - -FEATURES: - - * Add support for logging to syslog (GH-163) - * Add `log_level` as a configuration file option - * Add `-log-level` as a CLI option - -IMPROVEMENTS: - - * Use a default retry interval of 5s (GH-190) - this value has been (and will - remain) configurable since v0.5.0, but the default value has changed from 0 - to 5s - * Use a service's reported address if given (GH-185, GH-186) - * Add new `NodeAddress` field to health services to always include the node's - address - * Return errors up the watcher's error channel so other libraries can - determine what to do with the error instead of swallowing it (GH-196) - * Move SSL and authentication options into their own configuration blocks in - the HCL - * Add new `watch.WaitVar` for parsing Wait structs via Go's flag parsing - library. - * Extract logging components into their own library for sharing (GH-199) - -BUG FIXES: - - * Return errors instead of nil in catalog nodes and key prefix dependencies - (GH-192) - * Allow Consul Template to exit when running in `once` mode and templates have - not changed (GH-188) - * Raise an error when specifying a non-existent option in the configuration - file (GH-197) - * Use an RWLock when accessing information in the Brain to improve performance - * Improve debugging output and consistency - * Remove unused Brain functions - * Remove unused documentation items - * Use the correct default values for `-ssl` and `-retry` on the CLI - -## v0.6.5 (February 5, 2015) - -FEATURES: - - * Add `-max-stale` to specify Consul Template may talk to non-leader Consul - nodes if they are less than the maximum stale value (GH-183) - -BUG FIXES: - - * Fix a concurrency bug in the Brain (GH-180) - * Add a better queue-draining mechanism for templates that have a large number - of dependencies (GH-184) - -## v0.6.1 (February 2, 2015) - -IMPROVEMENTS: - - * Allow watcher to use buffered channels so we do not block when multiple - dependencies return data (GH-176) - * Buffer results from the watcher to reduce the number of CPU cycles (GH-168 - and GH-178) - -BUG FIXES: - - * Handle the case where reloading via SIGHUP would cause an error (GH-175 and - GH-177) - * Return errors to the template when parsing a key fails (GH-170) - * Expand the list of possible values for keys to non-ASCII fields (the `@` is - still a restricted character because it denotes the datacenter) (GH-170) - * Diff missing dependencies during the template render to avoid creating - extra watchers (GH-169) - * Improve debugging output (GH-169) - -## v0.6.0 (January 20, 2015) - -FEATURES: - - * Implement n-pass evaluation (GH-64) - templates are now evaluated N+1 times - to properly accumulate dependencies and build the graph properly - -BREAKING CHANGES: - - * Remove `storeKeyPrefix` template function - it has been replaced with `ls` - and/or `tree` and was deprecated in 0.2.0 - * Remove `Key()` from dependency interface - -IMPROVEMENTS: - - * Switch to using `hashicorp/consul/api` instead of `armon/consul-api` - * Add support for communicating with Consul via HTTPS/SSL (GH-143) - * Add support for communicating with Consul via BasicAuth (GH-147) - * Quiesce on a per-template basis - -BUG FIXES: - - * Reduce memory footprint when running with a large number of templates by - using a single context instead of separate template contexts for each - template - * Improve test coverage - * Improve debugging output - * Correct tag deep copy that could result in 2N-1 tags (GH-155) - * Return an empty slice when parsing an empty JSON file - * Update README documentation - -## v0.5.1 (December 25, 2014) - -BUG FIXES: - - * Parse Retry values in the config (GH-136) - * Remove `util` package as it is a code smell and separate `Watcher` and - `Dependency` structs and functions into their own packages for re-use - (GH-137) - -## v0.5.0 (December 19, 2014) - -FEATURES: - - * Reload configuration on `SIGHUP` - * Add `services` template function for listing all services and associated - tags in the Consul catalog (GH-77) - -BUG FIXES: - - * Do not execute the same command more than once in one run (GH-112) - * Do not exit when Consul is unavailable (GH-103) - * Accept configuration files as a valid option to `-config` (GH-126) - * Accept Windows drive letters in template paths (GH-78) - * Deep copy and sort data returned from Consul API (specifically tags) - * Run commands even if not all templates have received data (GH-119) - -IMPROVEMENTS: - - * Add support for more complex service health filtering (GH-116) - * Add support for specifying a `-retry` interval for Consul timeouts and - connection errors (GH-22) - * Use official HashiCorp multierror package for errors - * Gracefully stop watchers on interrupt - * Add support for Go 1.4 - * Improve test coverage around retrying failures - -## v0.4.0 (December 10, 2014) - -FEATURES: - - * Add `env` template function for reading an environment variable in the - current process into the template - * Add `regexReplaceAll` template function - -BUG FIXES: - - * Fix documentation examples - * Fix `golint` and `go vet` errors - * Fix a panic when Consul returned empty query metadata - * Allow colons in key prefixes (`ls` and `tree` receive this by proxy) - * Allow `parseJSON` to handle top-level JSON objects - * Filter empty keys in `tree` and `ls` (folder nodes) - -IMPROVEMENTS: - - * Merge multiple configuration template definitions when a configuration - directory is specified - -## v0.3.1 (November 24, 2014) - -BUG FIXES: - - * Allow colons in key names (GH-67) - * Fix a documentation bug in the README in the Varnish example (GH-82) - * Attempt to render templates before starting the watcher - this fixes an - issue where a template that declared no Consul dependencies would never be - rendered (GH-85) - * Update inline Go documentation for better clarity - -IMPROVEMENTS: - - * Fix all issues raised by `go vet` - * Update packaging script to fix ZSHisms and use awk for clarity - -## v0.3.0 (November 13, 2014) - -FEATURES: - - * Added a `Contains` method to `Service.Tags` - * Added support for specifying a configuration directory in `-config`, in - addition to a file - * Added support for querying all nodes in Consul's catalog with the `nodes` - template function - -BUG FIXES: - - * Update README documentation to clarify that `service` dependencies default - to the current datacenter if one is not explicitly given - * Ignore empty keys that are returned from an `ls` call (GH-54) - * When writing a file atomicly, ensure the drive is the same (GH-58) - * Run all commands before exiting - previously if a single command failed in - a multi-template environment, the other commands would not execute, but - Consul Template would return - -IMPROVEMENTS: - - * Added support for querying all `service` nodes by passing an additional - parameter to `service` - -## v0.2.0 (November 4, 2014) - -FEATURES: - - * Added helper for decoding a result as JSON using the `parseJSON` pipe - function - * Added support for reading and watching changes from a file using the `file` - template function - * Added helper for sorting service entires by a particular tag - * Added helper function `toLower()` for converting a string to lowercase - * Added helper function `toTitle()` for converting a string to titlecase - * Added helper function `toUpper()` for converting a string to uppercase - * Added helper function `replaceAll()` for replacing occurrences of a - substring with a new string - * Added `tree` function for returning all key prefixes recursively - * Added `ls` function for returning all keys in the top-level prefix (but not - deeply nested ones) - -BUG FIXES: - - * Remove prefixes from paths when querying a key prefix - -IMPROVEMENTS: - - * Moved shareable functions into a util module so other libraries can benefit - * Make Path a public field on Template - * Added more examples and documentation to the README - -DEPRECATIONS: - - * `keyPrefix` is deprecated in favor or `tree` and `ls` and will be removed in - the next major release - - -## v0.1.1 (October 28, 2014) - -BUG FIXES: - - * Fixed an issue where help output was displayed twice when specifying the - `-h` flag - * Added support for specifyiny forward slashes (`/`) in service names - * Added support for specifying underscores (`_`) in service names - * Added support for specifying dots (`.`) in tag names - -IMPROVEMENTS: - - * Added support for Travis CI - * Fixed numerous typographical errors - * Added more documentation, including an FAQ in the README - * Do not return an error when a template has no dependencies. See GH-31 for - more background and information - * Do not render templates if they have the same content - * Do not execute commands if the template on disk would not be changed - -## v0.1.0 (October 21, 2014) - - * Initial release diff --git a/vendor/github.com/hashicorp/consul-template/Makefile b/vendor/github.com/hashicorp/consul-template/Makefile deleted file mode 100644 index 32cbdd4b26e6..000000000000 --- a/vendor/github.com/hashicorp/consul-template/Makefile +++ /dev/null @@ -1,253 +0,0 @@ -# Metadata about this makefile and position -MKFILE_PATH := $(lastword $(MAKEFILE_LIST)) -CURRENT_DIR := $(patsubst %/,%,$(dir $(realpath $(MKFILE_PATH)))) - -# Ensure GOPATH -GOPATH ?= $(shell go env GOPATH) -# assume last entry in GOPATH is home to project -GOPATH := $(lastword $(subst :, ,${GOPATH})) - -# Tags specific for building -GOTAGS ?= - -# Number of procs to use -GOMAXPROCS ?= 4 - -# Get the project metadata -GO_DOCKER_VERSION ?= 1.13 -PROJECT := $(shell go list -m -mod=vendor) -OWNER := "hashicorp" -NAME := $(notdir $(PROJECT)) -GIT_COMMIT ?= $(shell git rev-parse --short HEAD || echo release) -VERSION := $(shell awk -F\" '/Version/ { print $$2; exit }' "${CURRENT_DIR}/version/version.go") - -# Current system information -GOOS ?= $(shell go env GOOS) -GOARCH ?= $(shell go env GOARCH) - -# Default os-arch combination to build -XC_OS ?= darwin freebsd linux netbsd openbsd solaris windows -XC_ARCH ?= 386 amd64 arm arm64 -# XC_EXCLUDE "arm64" entries excludes both arm and arm64 -XC_EXCLUDE ?= darwin/arm64 freebsd/arm64 netbsd/arm64 openbsd/arm64 solaris/arm64 windows/arm64 solaris/386 - -# GPG Signing key (blank by default, means no GPG signing) -GPG_KEY ?= - -# List of ldflags -LD_FLAGS ?= \ - -s \ - -w \ - -X ${PROJECT}/version.Name=${NAME} \ - -X ${PROJECT}/version.GitCommit=${GIT_COMMIT} - -# List of Docker targets to build -DOCKER_TARGETS ?= alpine light scratch - -# Create a cross-compile target for every os-arch pairing. This will generate -# a make target for each os/arch like "make linux/amd64" as well as generate a -# meta target (build) for compiling everything. -define make-xc-target - $1/$2: - ifneq (,$(findstring ${1}/${2},$(XC_EXCLUDE))) - @printf "%s%20s %s\n" "-->" "${1}/${2}:" "${PROJECT} (excluded)" - else - @printf "%s%20s %s\n" "-->" "${1}/${2}:" "${PROJECT}" - case "$2" in \ - arm) export CGO_ENABLED="1" ; \ - export GOARM=6 \ - export CC="arm-linux-gnueabihf-gcc" ;; \ - arm64) export CGO_ENABLED="1" ; \ - export CC="aarch64-linux-gnu-gcc" ;; \ - *) export CGO_ENABLED="0" ;; \ - esac ; \ - env \ - GOOS="${1}" \ - GOARCH="${2}" \ - go build \ - -a \ - -o="pkg/${1}_${2}/${NAME}${3}" \ - -ldflags "${LD_FLAGS}" \ - -tags "${GOTAGS}" - endif - .PHONY: $1/$2 - - $1:: $1/$2 - .PHONY: $1 - - build:: $1/$2 - .PHONY: build -endef -$(foreach goarch,$(XC_ARCH),$(foreach goos,$(XC_OS),$(eval $(call make-xc-target,$(goos),$(goarch),$(if $(findstring windows,$(goos)),.exe,))))) - -# Use docker to create pristine builds for release -# First build image w/ arm build requirements, then build all binaries -pristine: - @docker build \ - --rm \ - --force-rm \ - --no-cache \ - --compress \ - --file="docker/pristine/Dockerfile" \ - --build-arg="GOVERSION=${GO_DOCKER_VERSION}" \ - --tag="pristine-builder" . - @docker run \ - --interactive \ - --user $$(id -u):$$(id -g) \ - --rm \ - --dns="8.8.8.8" \ - --volume="${CURRENT_DIR}:/go/src/${PROJECT}" \ - --volume="${GOPATH}/pkg/mod:/go/pkg/mod" \ - --workdir="/go/src/${PROJECT}" \ - --env=GO111MODULE=on \ - "pristine-builder" \ - env GOCACHE=/tmp make -j4 build - -# dev builds and installs the project locally. -dev: - @echo "==> Installing ${NAME} for ${GOOS}/${GOARCH}" - @rm -f "${GOPATH}/pkg/${GOOS}_${GOARCH}/${PROJECT}/version.a" # ldflags change and go doesn't detect - @env \ - CGO_ENABLED="0" \ - go install \ - -ldflags "${LD_FLAGS}" \ - -tags "${GOTAGS}" -.PHONY: dev - -# dist builds the binaries and then signs and packages them for distribution -dist: - @$(MAKE) -f "${MKFILE_PATH}" _cleanup - @$(MAKE) -f "${MKFILE_PATH}" pristine - @$(MAKE) -f "${MKFILE_PATH}" _compress _checksum -.PHONY: dist - -release: dist -ifndef GPG_KEY - @echo "==> ERROR: No GPG key specified! Without a GPG key, this release cannot" - @echo " be signed. Set the environment variable GPG_KEY to the ID of" - @echo " the GPG key to continue." - @exit 127 -else - @$(MAKE) -f "${MKFILE_PATH}" _sign -endif -.PHONY: release - -# Create a docker compile and push target for each container. This will create -# docker-build/scratch, docker-push/scratch, etc. It will also create two meta -# targets: docker-build and docker-push, which will build and push all -# configured Docker containers. Each container must have a folder in docker/ -# named after itself with a Dockerfile (docker/alpine/Dockerfile). -define make-docker-target - docker-build/$1: - @echo "==> Building ${1} Docker container for ${PROJECT}" - @go mod vendor - @docker build \ - --rm \ - --force-rm \ - --no-cache \ - --compress \ - --file="docker/${1}/Dockerfile" \ - --build-arg="LD_FLAGS=${LD_FLAGS}" \ - --build-arg="GOTAGS=${GOTAGS}" \ - --build-arg="GOVERSION=${GO_DOCKER_VERSION}" \ - $(if $(filter $1,scratch),--tag="${OWNER}/${NAME}",) \ - --tag="${OWNER}/${NAME}:${1}" \ - --tag="${OWNER}/${NAME}:${VERSION}-${1}" \ - "${CURRENT_DIR}" - @rm -rf "${CURRENT_DIR}/vendor/" - .PHONY: docker-build/$1 - - docker-build:: docker-build/$1 - .PHONY: docker-build - - docker-push/$1: - @echo "==> Pushing ${1} to Docker registry" - $(if $(filter $1,scratch),@docker push "${OWNER}/${NAME}",) - @docker push "${OWNER}/${NAME}:${1}" - @docker push "${OWNER}/${NAME}:${VERSION}-${1}" - .PHONY: docker-push/$1 - - docker-push:: docker-push/$1 - .PHONY: docker-push -endef -$(foreach target,$(DOCKER_TARGETS),$(eval $(call make-docker-target,$(target)))) - -# test runs the test suite. -test: - @echo "==> Testing ${NAME}" - @go test -count=1 -timeout=30s -parallel=20 -failfast -tags="${GOTAGS}" ./... ${TESTARGS} -.PHONY: test - -# test-race runs the test suite. -test-race: - @echo "==> Testing ${NAME} (race)" - @go test -timeout=60s -race -tags="${GOTAGS}" ./... ${TESTARGS} -.PHONY: test-race - -# _cleanup removes any previous binaries -_cleanup: - @rm -rf "${CURRENT_DIR}/pkg/" - @rm -rf "${CURRENT_DIR}/bin/" -.PHONY: _cleanup - -clean: _cleanup -.PHONY: clean - -# _compress compresses all the binaries in pkg/* as tarball and zip. -_compress: - @mkdir -p "${CURRENT_DIR}/pkg/dist" - @for platform in $$(find ./pkg -mindepth 1 -maxdepth 1 -type d); do \ - osarch=$$(basename "$$platform"); \ - if [ "$$osarch" = "dist" ]; then \ - continue; \ - fi; \ - \ - ext=""; \ - if test -z "$${osarch##*windows*}"; then \ - ext=".exe"; \ - fi; \ - cd "$$platform"; \ - tar -czf "${CURRENT_DIR}/pkg/dist/${NAME}_${VERSION}_$${osarch}.tgz" "${NAME}$${ext}"; \ - zip -q "${CURRENT_DIR}/pkg/dist/${NAME}_${VERSION}_$${osarch}.zip" "${NAME}$${ext}"; \ - cd - >/dev/null; \ - done -.PHONY: _compress - -# _checksum produces the checksums for the binaries in pkg/dist -_checksum: - @cd "${CURRENT_DIR}/pkg/dist" && \ - shasum --algorithm 256 * > ${CURRENT_DIR}/pkg/dist/${NAME}_${VERSION}_SHA256SUMS && \ - cd - >/dev/null -.PHONY: _checksum - -# _sign signs the binaries using the given GPG_KEY. This should not be called -# as a separate function. -_sign: - @echo "==> Signing ${PROJECT} at v${VERSION}" - @gpg \ - --default-key "${GPG_KEY}" \ - --detach-sig "${CURRENT_DIR}/pkg/dist/${NAME}_${VERSION}_SHA256SUMS" - @git commit \ - --allow-empty \ - --gpg-sign="${GPG_KEY}" \ - --message "Release v${VERSION}" \ - --quiet \ - --signoff - @git tag \ - --annotate \ - --create-reflog \ - --local-user "${GPG_KEY}" \ - --message "Version ${VERSION}" \ - --sign \ - "v${VERSION}" master - @echo "--> Do not forget to run:" - @echo "" - @echo " git push && git push --tags" - @echo "" - @echo "And then upload the binaries in dist/!" -.PHONY: _sign - -# Add/Update the "Table Of Contents" in the README.md -toc: - @./scripts/readme-toc.sh -.PHONY: toc diff --git a/vendor/github.com/hashicorp/consul-template/README.md b/vendor/github.com/hashicorp/consul-template/README.md deleted file mode 100644 index f98b6e1e8e29..000000000000 --- a/vendor/github.com/hashicorp/consul-template/README.md +++ /dev/null @@ -1,2572 +0,0 @@ -# Consul Template - -[![CircleCI](https://circleci.com/gh/hashicorp/consul-template.svg?style=svg)](https://circleci.com/gh/hashicorp/consul-template) -[![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://godoc.org/github.com/hashicorp/consul-template) - -This project provides a convenient way to populate values from [Consul][consul] -into the file system using the `consul-template` daemon. - -The daemon `consul-template` queries a [Consul][consul] or [Vault][vault] -cluster and updates any number of specified templates on the file system. As an -added bonus, it can optionally run arbitrary commands when the update process -completes. Please see the [examples folder][examples] for some scenarios where -this functionality might prove useful. - ---- - -**The documentation in this README corresponds to the master branch of Consul Template. It may contain unreleased features or different APIs than the most recently released version.** - -**Please see the [Git tag](https://github.com/hashicorp/consul-template/releases) that corresponds to your version of Consul Template for the proper documentation.** - ---- - -## Table of Contents - -- [Community Support](#community-support) -- [Installation](#installation) -- [Quick Example](#quick-example) -- [Usage](#usage) - - [Command Line Flags](#command-line-flags) - - [Configuration File Format](#configuration-file-format) - - [Templating Language](#templating-language) - - [API Functions](#api-functions) - - [caLeaf](#caleaf) - - [caRoot](#caroot) - - [connect](#connect) - - [datacenters](#datacenters) - - [file](#file) - - [key](#key) - - [keyExists](#keyexists) - - [keyOrDefault](#keyordefault) - - [ls](#ls) - - [safeLs](#safels) - - [node](#node) - - [nodes](#nodes) - - [secret](#secret) - - [secrets](#secrets) - - [service](#service) - - [services](#services) - - [tree](#tree) - - [safeTree](#safetree) - - [Scratch](#scratch) - - [scratch.Key](#scratchkey) - - [scratch.Get](#scratchget) - - [scratch.Set](#scratchset) - - [scratch.SetX](#scratchsetx) - - [scratch.MapSet](#scratchmapset) - - [scratch.MapSetX](#scratchmapsetx) - - [scratch.MapValues](#scratchmapvalues) - - [Helper Functions](#helper-functions) - - [base64Decode](#base64decode) - - [base64Encode](#base64encode) - - [base64URLDecode](#base64urldecode) - - [base64URLEncode](#base64urlencode) - - [byKey](#bykey) - - [byTag](#bytag) - - [byMeta](#bymeta) - - [contains](#contains) - - [containsAll](#containsall) - - [containsAny](#containsany) - - [containsNone](#containsnone) - - [containsNotAll](#containsnotall) - - [env](#env) - - [executeTemplate](#executetemplate) - - [explode](#explode) - - [explodeMap](#explodemap) - - [indent](#indent) - - [in](#in) - - [loop](#loop) - - [join](#join) - - [trimSpace](#trimspace) - - [parseBool](#parsebool) - - [parseFloat](#parsefloat) - - [parseInt](#parseint) - - [parseJSON](#parsejson) - - [parseUint](#parseuint) - - [plugin](#plugin) - - [regexMatch](#regexmatch) - - [regexReplaceAll](#regexreplaceall) - - [replaceAll](#replaceall) - - [split](#split) - - [timestamp](#timestamp) - - [toJSON](#tojson) - - [toJSONPretty](#tojsonpretty) - - [toLower](#tolower) - - [toTitle](#totitle) - - [toTOML](#totoml) - - [toUpper](#toupper) - - [toYAML](#toyaml) - - [sockaddr](#sockaddr) - - [Math Functions](#math-functions) - - [add](#add) - - [subtract](#subtract) - - [multiply](#multiply) - - [divide](#divide) - - [modulo](#modulo) -- [Plugins](#plugins) - - [Authoring Plugins](#authoring-plugins) - - [Important Notes](#important-notes) -- [Caveats](#caveats) - - [Dots in Service Names](#dots-in-service-names) - - [Once Mode](#once-mode) - - [Exec Mode](#exec-mode) - - [De-Duplication Mode](#de-duplication-mode) - - [Termination on Error](#termination-on-error) - - [Command Environment](#command-environment) - - [Multi-phase Execution](#multi-phase-execution) -- [Running and Process Lifecycle](#running-and-process-lifecycle) -- [Debugging](#debugging) -- [FAQ](#faq) -- [Contributing](#contributing) - - -## Community Support - -If you have questions about how consul-template works, its capabilities or -anything other than a bug or feature request (use github's issue tracker for -those), please see our community support resources. - -Community portal: https://discuss.hashicorp.com/c/consul - -Other resources: https://www.consul.io/community.html - -Additionally, for issues and pull requests, we'll be using the :+1: reactions -as a rough voting system to help gauge community priorities. So please add :+1: -to any issue or pull request you'd like to see worked on. Thanks. - - -## Installation - -1. Download a pre-compiled, released version from the [Consul Template releases page][releases]. - -1. Extract the binary using `unzip` or `tar`. - -1. Move the binary into `$PATH`. - -To compile from source, please see the instructions in the -[contributing section](#contributing). - -## Quick Example - -This short example assumes Consul is installed locally. - -1. Start a Consul cluster in dev mode: - - ```shell - $ consul agent -dev - ``` - -1. Author a template `in.tpl` to query the kv store: - - ```liquid - {{ key "foo" }} - ``` - -1. Start Consul Template: - - ```shell - $ consul-template -template "in.tpl:out.txt" -once - ``` - -1. Write data to the key in Consul: - - ```shell - $ consul kv put foo bar - ``` - -1. Observe Consul Template has written the file `out.txt`: - - ```shell - $ cat out.txt - bar - ``` - -For more examples and use cases, please see the [examples folder][examples] in -this repository. - -## Usage - -For the full list of options: - -```shell -$ consul-template -h -``` - -### Command Line Flags - -The CLI interface supports all options in the configuration file and vice-versa. Here are a few examples of common integrations on the command line. - -Render the template on disk at `/tmp/template.ctmpl` to `/tmp/result`: - -```shell -$ consul-template \ - -template "/tmp/template.ctmpl:/tmp/result" -``` - -Render multiple templates in the same process. The optional third argument to -the template is a command that will execute each time the template changes. - -```shell -$ consul-template \ - -template "/tmp/nginx.ctmpl:/var/nginx/nginx.conf:nginx -s reload" \ - -template "/tmp/redis.ctmpl:/var/redis/redis.conf:service redis restart" \ - -template "/tmp/haproxy.ctmpl:/var/haproxy/haproxy.conf" -``` - -Render a template using a custom Consul and Vault address: - -```shell -$ consul-template \ - -consul-addr "10.4.4.6:8500" \ - -vault-addr "https://10.5.32.5:8200" -``` - -Render all templates and then spawn and monitor a child process as a supervisor: - -```shell -$ consul-template \ - -template "/tmp/in.ctmpl:/tmp/result" \ - -exec "/sbin/my-server" -``` - -For more information on supervising, please see the -[Consul Template Exec Mode documentation](#exec-mode). - -### Configuration File Format - -Configuration files are written in the [HashiCorp Configuration Language][hcl]. -By proxy, this means the configuration is also JSON compatible. - -```hcl -# This denotes the start of the configuration section for Consul. All values -# contained in this section pertain to Consul. -consul { - # This block specifies the basic authentication information to pass with the - # request. For more information on authentication, please see the Consul - # documentation. - auth { - enabled = true - username = "test" - password = "test" - } - - # This is the address of the Consul agent. By default, this is - # 127.0.0.1:8500, which is the default bind and port for a local Consul - # agent. It is not recommended that you communicate directly with a Consul - # server, and instead communicate with the local Consul agent. There are many - # reasons for this, most importantly the Consul agent is able to multiplex - # connections to the Consul server and reduce the number of open HTTP - # connections. Additionally, it provides a "well-known" IP address for which - # clients can connect. - address = "127.0.0.1:8500" - - # This is the ACL token to use when connecting to Consul. If you did not - # enable ACLs on your Consul cluster, you do not need to set this option. - # - # This option is also available via the environment variable CONSUL_TOKEN. - token = "abcd1234" - - # This controls the retry behavior when an error is returned from Consul. - # Consul Template is highly fault tolerant, meaning it does not exit in the - # face of failure. Instead, it uses exponential back-off and retry functions - # to wait for the cluster to become available, as is customary in distributed - # systems. - retry { - # This enabled retries. Retries are enabled by default, so this is - # redundant. - enabled = true - - # This specifies the number of attempts to make before giving up. Each - # attempt adds the exponential backoff sleep time. Setting this to - # zero will implement an unlimited number of retries. - attempts = 12 - - # This is the base amount of time to sleep between retry attempts. Each - # retry sleeps for an exponent of 2 longer than this base. For 5 retries, - # the sleep times would be: 250ms, 500ms, 1s, 2s, then 4s. - backoff = "250ms" - - # This is the maximum amount of time to sleep between retry attempts. - # When max_backoff is set to zero, there is no upper limit to the - # exponential sleep between retry attempts. - # If max_backoff is set to 10s and backoff is set to 1s, sleep times - # would be: 1s, 2s, 4s, 8s, 10s, 10s, ... - max_backoff = "1m" - } - - # This block configures the SSL options for connecting to the Consul server. - ssl { - # This enables SSL. Specifying any option for SSL will also enable it. - enabled = true - - # This enables SSL peer verification. The default value is "true", which - # will check the global CA chain to make sure the given certificates are - # valid. If you are using a self-signed certificate that you have not added - # to the CA chain, you may want to disable SSL verification. However, please - # understand this is a potential security vulnerability. - verify = false - - # This is the path to the certificate to use to authenticate. If just a - # certificate is provided, it is assumed to contain both the certificate and - # the key to convert to an X509 certificate. If both the certificate and - # key are specified, Consul Template will automatically combine them into an - # X509 certificate for you. - cert = "/path/to/client/cert" - key = "/path/to/client/key" - - # This is the path to the certificate authority to use as a CA. This is - # useful for self-signed certificates or for organizations using their own - # internal certificate authority. - ca_cert = "/path/to/ca" - - # This is the path to a directory of PEM-encoded CA cert files. If both - # `ca_cert` and `ca_path` is specified, `ca_cert` is preferred. - ca_path = "path/to/certs/" - - # This sets the SNI server name to use for validation. - server_name = "my-server.com" - } -} - -# This is the signal to listen for to trigger a reload event. The default -# value is shown below. Setting this value to the empty string will cause CT -# to not listen for any reload signals. -reload_signal = "SIGHUP" - -# This is the signal to listen for to trigger a graceful stop. The default -# value is shown below. Setting this value to the empty string will cause CT -# to not listen for any graceful stop signals. -kill_signal = "SIGINT" - -# This is the maximum interval to allow "stale" data. By default, only the -# Consul leader will respond to queries; any requests to a follower will -# forward to the leader. In large clusters with many requests, this is not as -# scalable, so this option allows any follower to respond to a query, so long -# as the last-replicated data is within these bounds. Higher values result in -# less cluster load, but are more likely to have outdated data. -max_stale = "10m" - -# This is the log level. If you find a bug in Consul Template, please enable -# debug logs so we can help identify the issue. This is also available as a -# command line flag. -log_level = "warn" - -# This is the path to store a PID file which will contain the process ID of the -# Consul Template process. This is useful if you plan to send custom signals -# to the process. -pid_file = "/path/to/pid" - -# This is the quiescence timers; it defines the minimum and maximum amount of -# time to wait for the cluster to reach a consistent state before rendering a -# template. This is useful to enable in systems that have a lot of flapping, -# because it will reduce the the number of times a template is rendered. -wait { - min = "5s" - max = "10s" -} - -# This denotes the start of the configuration section for Vault. All values -# contained in this section pertain to Vault. -vault { - # This is the address of the Vault leader. The protocol (http(s)) portion - # of the address is required. - address = "https://vault.service.consul:8200" - - # This is a Vault Enterprise namespace to use for reading/writing secrets. - # - # This value can also be specified via the environment variable VAULT_NAMESPACE. - namespace = "foo" - - # This is the token to use when communicating with the Vault server. - # Like other tools that integrate with Vault, Consul Template makes the - # assumption that you provide it with a Vault token; it does not have the - # incorporated logic to generate tokens via Vault's auth methods. - # - # This value can also be specified via the environment variable VAULT_TOKEN. - # When using a token from Vault Agent, the vault_agent_token_file setting - # should be used instead, as that will take precedence over this field. - token = "abcd1234" - - # This tells Consul Template to load the Vault token from the contents of a file. - # If this field is specified: - # - by default Consul Template will not try to renew the Vault token, if you want it - # to renew you will nee dto specify renew_token = true as below. - # - Consul Template will periodically stat the file and update the token if it has - # changed. - # vault_agent_token_file = "/tmp/vault/agent/token" - - # This tells Consul Template that the provided token is actually a wrapped - # token that should be unwrapped using Vault's cubbyhole response wrapping - # before being used. Please see Vault's cubbyhole response wrapping - # documentation for more information. - unwrap_token = true - - # This option tells Consul Template to automatically renew the Vault token - # given. If you are unfamiliar with Vault's architecture, Vault requires - # tokens be renewed at some regular interval or they will be revoked. Consul - # Template will automatically renew the token at half the lease duration of - # the token. The default value is true, but this option can be disabled if - # you want to renew the Vault token using an out-of-band process. - # - # Note that secrets specified in a template (using {{secret}} for example) - # are always renewed, even if this option is set to false. This option only - # applies to the top-level Vault token itself. - renew_token = true - - # This section details the retry options for connecting to Vault. Please see - # the retry options in the Consul section for more information (they are the - # same). - retry { - # ... - } - - # This section details the SSL options for connecting to the Vault server. - # Please see the SSL options in the Consul section for more information (they - # are the same). - ssl { - # ... - } -} - -# This block defines the configuration for connecting to a syslog server for -# logging. -syslog { - # This enables syslog logging. Specifying any other option also enables - # syslog logging. - enabled = true - - # This is the name of the syslog facility to log to. - facility = "LOCAL5" -} - -# This block defines the configuration for de-duplication mode. Please see the -# de-duplication mode documentation later in the README for more information -# on how de-duplication mode operates. -deduplicate { - # This enables de-duplication mode. Specifying any other options also enables - # de-duplication mode. - enabled = true - - # This is the prefix to the path in Consul's KV store where de-duplication - # templates will be pre-rendered and stored. - prefix = "consul-template/dedup/" -} - -# This block defines the configuration for exec mode. Please see the exec mode -# documentation at the bottom of this README for more information on how exec -# mode operates and the caveats of this mode. -exec { - # This is the command to exec as a child process. There can be only one - # command per Consul Template process. - command = "/usr/bin/app" - - # This is a random splay to wait before killing the command. The default - # value is 0 (no wait), but large clusters should consider setting a splay - # value to prevent all child processes from reloading at the same time when - # data changes occur. When this value is set to non-zero, Consul Template - # will wait a random period of time up to the splay value before reloading - # or killing the child process. This can be used to prevent the thundering - # herd problem on applications that do not gracefully reload. - splay = "5s" - - env { - # This specifies if the child process should not inherit the parent - # process's environment. By default, the child will have full access to the - # environment variables of the parent. Setting this to true will send only - # the values specified in `custom_env` to the child process. - pristine = false - - # This specifies additional custom environment variables in the form shown - # below to inject into the child's runtime environment. If a custom - # environment variable shares its name with a system environment variable, - # the custom environment variable takes precedence. Even if pristine, - # whitelist, or blacklist is specified, all values in this option - # are given to the child process. - custom = ["PATH=$PATH:/etc/myapp/bin"] - - # This specifies a list of environment variables to exclusively include in - # the list of environment variables exposed to the child process. If - # specified, only those environment variables matching the given patterns - # are exposed to the child process. These strings are matched using Go's - # glob function, so wildcards are permitted. - whitelist = ["CONSUL_*"] - - # This specifies a list of environment variables to exclusively prohibit in - # the list of environment variables exposed to the child process. If - # specified, any environment variables matching the given patterns will not - # be exposed to the child process, even if they are whitelisted. The values - # in this option take precedence over the values in the whitelist. - # These strings are matched using Go's glob function, so wildcards are - # permitted. - blacklist = ["VAULT_*"] - } - - # This defines the signal that will be sent to the child process when a - # change occurs in a watched template. The signal will only be sent after the - # process is started, and the process will only be started after all - # dependent templates have been rendered at least once. The default value is - # nil, which tells Consul Template to stop the child process and spawn a new - # one instead of sending it a signal. This is useful for legacy applications - # or applications that cannot properly reload their configuration without a - # full reload. - reload_signal = "" - - # This defines the signal sent to the child process when Consul Template is - # gracefully shutting down. The application should begin a graceful cleanup. - # If the application does not terminate before the `kill_timeout`, it will - # be terminated (effectively "kill -9"). The default value is "SIGINT". - kill_signal = "SIGINT" - - # This defines the amount of time to wait for the child process to gracefully - # terminate when Consul Template exits. After this specified time, the child - # process will be force-killed (effectively "kill -9"). The default value is - # "30s". - kill_timeout = "2s" -} - -# This block defines the configuration for a template. Unlike other blocks, -# this block may be specified multiple times to configure multiple templates. -# It is also possible to configure templates via the CLI directly. -template { - # This is the source file on disk to use as the input template. This is often - # called the "Consul Template template". This option is required if not using - # the `contents` option. - source = "/path/on/disk/to/template.ctmpl" - - # This is the destination path on disk where the source template will render. - # If the parent directories do not exist, Consul Template will attempt to - # create them, unless create_dest_dirs is false. - destination = "/path/on/disk/where/template/will/render.txt" - - # This options tells Consul Template to create the parent directories of the - # destination path if they do not exist. The default value is true. - create_dest_dirs = true - - # This option allows embedding the contents of a template in the configuration - # file rather then supplying the `source` path to the template file. This is - # useful for short templates. This option is mutually exclusive with the - # `source` option. - contents = "{{ keyOrDefault \"service/redis/maxconns@east-aws\" \"5\" }}" - - # This is the optional command to run when the template is rendered. The - # command will only run if the resulting template changes. The command must - # return within 30s (configurable), and it must have a successful exit code. - # Consul Template is not a replacement for a process monitor or init system. - command = "restart service foo" - - # This is the maximum amount of time to wait for the optional command to - # return. Default is 30s. - command_timeout = "60s" - - # Exit with an error when accessing a struct or map field/key that does not - # exist. The default behavior will print "" when accessing a field - # that does not exist. It is highly recommended you set this to "true" when - # retrieving secrets from Vault. - error_on_missing_key = false - - # This is the permission to render the file. If this option is left - # unspecified, Consul Template will attempt to match the permissions of the - # file that already exists at the destination path. If no file exists at that - # path, the permissions are 0644. - perms = 0600 - - # This option backs up the previously rendered template at the destination - # path before writing a new one. It keeps exactly one backup. This option is - # useful for preventing accidental changes to the data without having a - # rollback strategy. - backup = true - - # These are the delimiters to use in the template. The default is "{{" and - # "}}", but for some templates, it may be easier to use a different delimiter - # that does not conflict with the output file itself. - left_delimiter = "{{" - right_delimiter = "}}" - - # These are functions that are not permitted in the template. If a template - # includes one of these functions, it will exit with an error. - function_blacklist = [] - - # If a sandbox path is provided, any path provided to the `file` function is - # checked that it falls within the sandbox path. Relative paths that try to - # traverse outside the sandbox path will exit with an error. - sandbox_path = "" - - # This is the `minimum(:maximum)` to wait before rendering a new template to - # disk and triggering a command, separated by a colon (`:`). If the optional - # maximum value is omitted, it is assumed to be 4x the required minimum value. - # This is a numeric time with a unit suffix ("5s"). There is no default value. - # The wait value for a template takes precedence over any globally-configured - # wait. - wait { - min = "2s" - max = "10s" - } -} - -``` - -Note that not all fields are required. If you are not retrieving secrets from -Vault, you do not need to specify a Vault configuration section. Similarly, if -you are not logging to syslog, you do not need to specify a syslog -configuration. - -For additional security, tokens may also be read from the environment using the -`CONSUL_TOKEN` or `VAULT_TOKEN` environment variables respectively. It is highly -recommended that you do not put your tokens in plain-text in a configuration -file. - -Instruct Consul Template to use a configuration file with the `-config` flag: - -```shell -$ consul-template -config "/my/config.hcl" -``` - -This argument may be specified multiple times to load multiple configuration -files. The right-most configuration takes the highest precedence. If the path to -a directory is provided (as opposed to the path to a file), all of the files in -the given directory will be merged in -[lexical order](http://golang.org/pkg/path/filepath/#Walk), recursively. Please -note that symbolic links are _not_ followed. - -**Commands specified on the CLI take precedence over a config file!** - -### Templating Language - -Consul Template parses files authored in the [Go Template][text-template] -format. If you are not familiar with the syntax, please read Go's documentation -and examples. In addition to the Go-provided template functions, Consul Template -provides the following functions: - -#### API Functions - -API functions interact with remote API calls, communicating with external -services like [Consul][consul] and [Vault][vault]. - -##### `caLeaf` - -Query [Consul][consul] for the leaf certificate representing a single service. - -```liquid -{{ caLeaf "" }} -``` - -For example: -```liquid -{{ with caLeaf "proxy" }}{{ .CertPEM }}{{ end }} -``` - -renders -```text ------BEGIN CERTIFICATE----- -MIICizCCAjGgAwIBAgIBCDAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtDb25zdWwg -... -lXcQzfKlIYeFWvcAv4cA4W258gTtqaFRDRJ2i720eQ== ------END CERTIFICATE----- -``` - -The two most useful fields are `.CertPEM` and `.PrivateKeyPEM`. For a complete -list of available fields, see consul's documentation on -[LeafCert](https://godoc.org/github.com/hashicorp/consul/api#LeafCert). - -##### `caRoot` - -Query [Consul][consul] for all [connect][connect] trusted certificate authority -(CA) root certificates. - -```liquid -{{ caRoots }} -``` - -For example: -```liquid -{{ range caRoots }}{{ .RootCertPEM }}{{ end }} -``` - -renders -```text ------BEGIN CERTIFICATE----- -MIICWDCCAf+gAwIBAgIBBzAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtDb25zdWwg -... -bcA+Su3r8qSRppTlc6D0UOYOWc1ykQKQOK7mIg== ------END CERTIFICATE----- - -``` - -The most useful field is `.RootCertPEM`. For a complete list of available -fields, see consul's documentation on -[CARootList](https://godoc.org/github.com/hashicorp/consul/api#CARootList). - - -##### `connect` - -Query [Consul][consul] for [connect][connect]-capable services based on their -health. - -```liquid -{{ connect ".@~|" }} -``` - -Syntax is exactly the same as for the [service](#service) function below. - - -```liquid -{{ range connect "web" }} -server {{ .Name }} {{ .Address }}:{{ .Port }}{{ end }} -``` - -renders the IP addresses of all _healthy_ nodes with a logical -[connect][connect]-capable service named "web": - -```text -server web01 10.5.2.45:21000 -server web02 10.2.6.61:21000 -``` - - -##### `datacenters` - -Query [Consul][consul] for all datacenters in its catalog. - -```liquid -{{ datacenters }} -``` - -For example: - -```liquid -{{ range datacenters }} -{{ . }}{{ end }} -``` - -renders - -```text -dc1 -dc2 -``` - -An optional boolean can be specified which instructs Consul Template to ignore -datacenters which are inaccessible or do not have a current leader. Enabling -this option requires an O(N+1) operation and therefore is not recommended in -environments where performance is a factor. - -```liquid -// Ignores datacenters which are inaccessible -{{ datacenters true }} -``` - -##### `file` - -Read and output the contents of a local file on disk. If the file cannot be -read, an error will occur. When the file changes, Consul Template will pick up -the change and re-render the template. - -```liquid -{{ file "" }} -``` - -For example: - -```liquid -{{ file "/path/to/my/file" }} -``` - -renders - -```text -file contents -``` - -This does not process nested templates. See -[`executeTemplate`](#executeTemplate) for a way to render nested templates. - -##### `key` - -Query [Consul][consul] for the value at the given key path. If the key does not -exist, Consul Template will block rendering until the key is present. To avoid -blocking, use `keyOrDefault` or `keyExists`. - -```liquid -{{ key "@" }} -``` - -The `` attribute is optional; if omitted, the local datacenter is -used. - -For example: - -```liquid -{{ key "service/redis/maxconns" }} -``` - -renders - -```text -15 -``` - -##### `keyExists` - -Query [Consul][consul] for the value at the given key path. If the key exists, -this will return true, false otherwise. Unlike `key`, this function will not -block if the key does not exist. This is useful for controlling flow. - -```liquid -{{ keyExists "@" }} -``` - -The `` attribute is optional; if omitted, the local datacenter is -used. - -For example: - -```liquid -{{ if keyExists "app/beta_active" }} - # ... -{{ else }} - # ... -{{ end }} -``` - -##### `keyOrDefault` - -Query [Consul][consul] for the value at the given key path. If the key does not -exist, the default value will be used instead. Unlike `key`, this function will -not block if the key does not exist. - -```liquid -{{ keyOrDefault "@" "" }} -``` - -The `` attribute is optional; if omitted, the local datacenter is -used. - -For example: - -```liquid -{{ keyOrDefault "service/redis/maxconns" "5" }} -``` - -renders - -```text -5 -``` - -Note that Consul Template uses a [multi-phase -execution](#multi-phase-execution). During the first phase of evaluation, Consul -Template will have no data from Consul and thus will _always_ fall back to the -default value. Subsequent reads from Consul will pull in the real value from -Consul (if the key exists) on the next template pass. This is important because -it means that Consul Template will never "block" the rendering of a template due -to a missing key from a `keyOrDefault`. Even if the key exists, if Consul has -not yet returned data for the key, the default value will be used instead. - -##### `ls` - -Query [Consul][consul] for all top-level kv pairs at the given key path. - -```liquid -{{ ls "@" }} -``` - -The `` attribute is optional; if omitted, the local datacenter is -used. - -For example: - -```liquid -{{ range ls "service/redis" }} -{{ .Key }}:{{ .Value }}{{ end }} -``` - -renders - -```text -maxconns:15 -minconns:5 -``` - -##### `safeLs` - -Same as [ls](#ls), but refuse to render template, if the KV prefix query return blank/empty data. - -This is especially useful, for rendering mission critical files, that are being populated by consul-template. - -For example: - -```text -/root/.ssh/authorized_keys -/etc/sysconfig/iptables -``` - -Using `safeLs` on empty prefixes will result in template output not being rendered at all. - -To learn how `safeLs` was born see [CT-1131](https://github.com/hashicorp/consul-template/issues/1131) [C-3975](https://github.com/hashicorp/consul/issues/3975) and [CR-82](https://github.com/hashicorp/consul-replicate/issues/82). - -##### `node` - -Query [Consul][consul] for a node in the catalog. - -```liquid -{{node "@"}} -``` - -The `` attribute is optional; if omitted, the local agent node is used. - -The `` attribute is optional; if omitted, the local datacenter is -used. - -For example: - -```liquid -{{ with node }} -{{ .Node.Address }}{{ end }} -``` - -renders - -```text -10.5.2.6 -``` - -To query a different node: - -```liquid -{{ with node "node1@dc2" }} -{{ .Node.Address }}{{ end }} -``` - -renders - -```text -10.4.2.6 -``` - -To access map data such as `TaggedAddresses` or `Meta`, use -[Go's text/template][text-template] map indexing. - -##### `nodes` - -Query [Consul][consul] for all nodes in the catalog. - -```liquid -{{ nodes "@~" }} -``` - -The `` attribute is optional; if omitted, the local datacenter is -used. - -The `` attribute is optional; if omitted, results are specified in lexical -order. If provided a node name, results are ordered by shortest round-trip time -to the provided node. If provided `_agent`, results are ordered by shortest -round-trip time to the local agent. - -For example: - -```liquid -{{ range nodes }} -{{ .Address }}{{ end }} -``` - -renders - -```text -10.4.2.13 -10.46.2.5 -``` - -To query a different data center and order by shortest trip time to ourselves: - -```liquid -{{ range nodes "@dc2~_agent" }} -{{ .Address }}{{ end }} -``` - -To access map data such as `TaggedAddresses` or `Meta`, use -[Go's text/template][text-template] map indexing. - -##### `secret` - -Query [Vault][vault] for the secret at the given path. - -```liquid -{{ secret "" "" }} -``` - -The `` attribute is optional; if omitted, the request will be a `vault -read` (HTTP GET) request. If provided, the request will be a `vault write` (HTTP -PUT/POST) request. - -For example: - -```liquid -{{ with secret "secret/passwords" }} -{{ .Data.wifi }}{{ end }} -``` - -renders - -```text -FORWARDSoneword -``` - -To access a versioned secret value (for the K/V version 2 backend): - -```liquid -{{ with secret "secret/passwords?version=1" }} -{{ .Data.data.wifi }}{{ end }} -``` - -When omitting the `?version` parameter, the latest version of the secret will be -fetched. Note the nested `.Data.data` syntax when referencing the secret value. -For more information about using the K/V v2 backend, see the -[Vault Documentation](https://www.vaultproject.io/docs/secrets/kv/kv-v2.html). - -When using Vault versions 0.10.0/0.10.1, the secret path will have to be prefixed -with "data", i.e. `secret/data/passwords` for the example above. This is not -necessary for Vault versions after 0.10.1, as consul-template will detect the KV -backend version being used. The version 2 KV backend did not exist prior to 0.10.0, -so these are the only affected versions. - -An example using write to generate PKI certificates: - -```liquid -{{ with secret "pki/issue/my-domain-dot-com" "common_name=foo.example.com" }} -{{ .Data.certificate }}{{ end }} -``` - -The parameters must be `key=value` pairs, and each pair must be its own argument -to the function: - -Please always consider the security implications of having the contents of a -secret in plain-text on disk. If an attacker is able to get access to the file, -they will have access to plain-text secrets. - -Please note that Vault does not support blocking queries. As a result, Consul -Template will not immediately reload in the event a secret is changed as it -does with Consul's key-value store. Consul Template will renew the secret with -Vault's [Renewer API](https://godoc.org/github.com/hashicorp/vault/api#Renewer). -The Renew API tries to use most of the time the secret is good, renewing at -around 90% of the lease time (as set by Vault). - -Also consider enabling `error_on_missing_key` when working with templates that -will interact with Vault. By default, Consul Template uses Go's templating -language. When accessing a struct field or map key that does not exist, it -defaults to printing ``. This may not be the desired behavior, -especially when working with passwords or other data. As such, it is recommended -you set: - -```hcl -template { - error_on_missing_key = true -} -``` - -You can also guard against empty values using `if` or `with` blocks. - -```liquid -{{ with secret "secret/foo"}} -{{ if .Data.password }} -password = "{{ .Data.password }}" -{{ end }} -{{ end }} -``` - -##### `secrets` - -Query [Vault][vault] for the list of secrets at the given path. Not all -endpoints support listing. - -```liquid -{{ secrets "" }} -``` - -For example: - -```liquid -{{ range secrets "secret/" }} -{{ . }}{{ end }} -``` - -renders - -```text -bar -foo -zip -``` - -To iterate and list over every secret in the generic secret backend in Vault: - -```liquid -{{ range secrets "secret/" }} -{{ with secret (printf "secret/%s" .) }}{{ range $k, $v := .Data }} -{{ $k }}: {{ $v }} -{{ end }}{{ end }}{{ end }} -``` - -You should probably never do this. - -Please also note that Vault does not support -blocking queries. To understand the implications, please read the note at the -end of the `secret` function. - -##### `service` - -Query [Consul][consul] for services based on their health. - -```liquid -{{ service ".@~|" }} -``` - -The `` attribute is optional; if omitted, all nodes will be queried. - -The `` attribute is optional; if omitted, the local datacenter is -used. - -The `` attribute is optional; if omitted, results are specified in lexical -order. If provided a node name, results are ordered by shortest round-trip time -to the provided node. If provided `_agent`, results are ordered by shortest -round-trip time to the local agent. - -The `` attribute is optional; if omitted, only health services are -returned. Providing a filter allows for client-side filtering of services. - -For example: - -The example above is querying Consul for healthy "web" services, in the "east-aws" data center. The tag and data center attributes are optional. To query all nodes of the "web" service (regardless of tag) for the current data center: - -```liquid -{{ range service "web" }} -server {{ .Name }} {{ .Address }}:{{ .Port }}{{ end }} -``` - -renders the IP addresses of all _healthy_ nodes with a logical service named -"web": - -```text -server web01 10.5.2.45:2492 -server web02 10.2.6.61:2904 -``` - -To access map data such as `NodeTaggedAddresses` or `NodeMeta`, use -[Go's text/template][text-template] map indexing. - -By default only healthy services are returned. To list all services, pass the -"any" filter: - -```liquid -{{ service "web|any" }} -``` - -This will return all services registered to the agent, regardless of their -status. - -To filter services by a specific set of healths, specify a comma-separated list -of health statuses: - -```liquid -{{ service "web|passing,warning" }} -``` - -This will returns services which are deemed "passing" or "warning" according to -their node and service-level checks defined in Consul. Please note that the -comma implies an "or", not an "and". - -**Note:** Due to the use of dot `.` to delimit TAG, the `service` command will -not recognize service names containing dots. - -**Note:** There is an architectural difference between the following: - -```liquid -{{ service "web" }} -{{ service "web|passing" }} -``` - -The former will return all services which Consul considers "healthy" and -passing. The latter will return all services registered with the Consul agent -and perform client-side filtering. As a general rule, do not use the "passing" -argument alone if you want only healthy services - simply omit the second -argument instead. - - -##### `services` - -Query [Consul][consul] for all services in the catalog. - -```liquid -{{ services "@" }} -``` - -The `` attribute is optional; if omitted, the local datacenter is -used. - -For example: - -```liquid -{{ range services }} -{{ .Name }}: {{ .Tags | join "," }}{{ end }} -``` - -renders - -```text -node01 tag1,tag2,tag3 -``` - -##### `tree` - -Query [Consul][consul] for all kv pairs at the given key path. - -```liquid -{{ tree "@" }} -``` - -The `` attribute is optional; if omitted, the local datacenter is -used. - -For example: - -```liquid -{{ range tree "service/redis" }} -{{ .Key }}:{{ .Value }}{{ end }} -``` -renders - -```text -minconns 2 -maxconns 12 -nested/config/value "value" -``` - -Unlike `ls`, `tree` returns **all** keys under the prefix, just like the Unix -`tree` command. - -##### `safeTree` - -Same as [tree](#tree), but refuse to render template, if the KV prefix query return blank/empty data. - -This is especially useful, for rendering mission critical files, that are being populated by consul-template. - -For example: - -```text -/root/.ssh/authorized_keys -/etc/sysconfig/iptables -``` - -Using `safeTree` on empty prefixes will result in template output not being rendered at all. - -To learn how `safeTree` was born see [CT-1131](https://github.com/hashicorp/consul-template/issues/1131) [C-3975](https://github.com/hashicorp/consul/issues/3975) and [CR-82](https://github.com/hashicorp/consul-replicate/issues/82). - ---- - -#### Scratch - -The scratchpad (or "scratch" for short) is available within the context of a -template to store temporary data or computations. Scratch data is not shared -between templates and is not cached between invocations. - -##### `scratch.Key` - -Returns a boolean if data exists in the scratchpad at the named key. Even if the -data at that key is "nil", this still returns true. - -```liquid -{{ scratch.Key "foo" }} -``` - -##### `scratch.Get` - -Returns the value in the scratchpad at the named key. If the data does not -exist, this will return "nil". - -```liquid -{{ scratch.Get "foo" }} -``` - -##### `scratch.Set` - -Saves the given value at the given key. If data already exists at that key, it -is overwritten. - -```liquid -{{ scratch.Set "foo" "bar" }} -``` - -##### `scratch.SetX` - -This behaves exactly the same as `Set`, but does not overwrite if the value -already exists. - -```liquid -{{ scratch.SetX "foo" "bar" }} -``` - -##### `scratch.MapSet` - -Saves a value in a named key in the map. If data already exists at that key, it -is overwritten. - -```liquid -{{ scratch.MapSet "vars" "foo" "bar" }} -``` - -##### `scratch.MapSetX` - -This behaves exactly the same as `MapSet`, but does not overwrite if the value -already exists. - -```liquid -{{ scratch.MapSetX "vars" "foo" "bar" }} -``` - -##### `scratch.MapValues` - -Returns a sorted list (by key) of all values in the named map. - -```liquid -{{ scratch.MapValues "vars" }} -``` - ---- - -#### Helper Functions - -Unlike API functions, helper functions do not query remote services. These -functions are useful for parsing data, formatting data, performing math, etc. - -##### `base64Decode` - -Accepts a base64-encoded string and returns the decoded result, or an error if -the given string is not a valid base64 string. - -```liquid -{{ base64Decode "aGVsbG8=" }} -``` - -renders - -```text -hello -``` - -##### `base64Encode` - -Accepts a string and returns a base64-encoded string. - -```liquid -{{ base64Encode "hello" }} -``` - -renders - -```text -aGVsbG8= -``` - -##### `base64URLDecode` - -Accepts a base64-encoded URL-safe string and returns the decoded result, or an -error if the given string is not a valid base64 URL-safe string. - -```liquid -{{ base64URLDecode "aGVsbG8=" }} -``` - -renders - -```text -hello -``` - -##### `base64URLEncode` - -Accepts a string and returns a base-64 encoded URL-safe string. - -```liquid -{{ base64Encode "hello" }} -``` - -renders - -```text -aGVsbG8= -``` - -##### `byKey` - -Accepts a list of pairs returned from a [`tree`](#tree) call and creates a map that groups pairs by their top-level directory. - -For example: - -```text -groups/elasticsearch/es1 -groups/elasticsearch/es2 -groups/elasticsearch/es3 -services/elasticsearch/check_elasticsearch -services/elasticsearch/check_indexes -``` - -with the following template - -```liquid -{{ range $key, $pairs := tree "groups" | byKey }}{{ $key }}: -{{ range $pair := $pairs }} {{ .Key }}={{ .Value }} -{{ end }}{{ end }} -``` - -renders - -```text -elasticsearch: - es1=1 - es2=1 - es3=1 -``` - -Note that the top-most key is stripped from the Key value. Keys that have no -prefix after stripping are removed from the list. - -The resulting pairs are keyed as a map, so it is possible to look up a single -value by key: - -```liquid -{{ $weights := tree "weights" }} -{{ range service "release.web" }} - {{ $weight := or (index $weights .Node) 100 }} - server {{ .Node }} {{ .Address }}:{{ .Port }} weight {{ $weight }}{{ end }} -``` - -##### `byTag` - -Takes the list of services returned by the [`service`](#service) or -[`services`](#services) function and creates a map that groups services by tag. - -```liquid -{{ range $tag, $services := service "web" | byTag }}{{ $tag }} -{{ range $services }} server {{ .Name }} {{ .Address }}:{{ .Port }} -{{ end }}{{ end }} -``` - -##### `byMeta` - -Takes a list of services returned by the [`service`](#service) or -[`services`](#services) and returns a map that groups services by ServiceMeta values. -Multiple service meta keys can be passed as a comma separated string. `|int` can be added to -a meta key to convert numbers from service meta values to padded numbers in `printf "%05d" % value` -format (useful for sorting as Go Template sorts maps by keys). - -**Example**: - -If we have the following services registered in Consul: - -```json -{ - "Services": [ - { - "ID": "redis-dev-1", - "Name": "redis", - "ServiceMeta": { - "environment": "dev", - "shard_number": "1" - }, - ... - }, - { - "ID": "redis-prod-1", - "Name": "redis", - "ServiceMeta": { - "environment": "prod", - "shard_number": "1" - }, - ... - }, - { - "ID": "redis-prod-2", - "Name": "redis", - "ServiceMeta": { - "environment": "prod", - "shard_number": "2", - }, - ... - } - ] -} -``` - -```liquid -{{ service "redis|any" | byMeta "environment,shard_number|int" | toJSON }} -``` - -The code above will produce a map of services grouped by meta: - -```json -{ - "dev_00001": [ - { - "ID": "redis-dev-1", - ... - } - ], - "prod_00001": [ - { - "ID": "redis-prod-1", - ... - } - ], - "prod_00002": [ - { - "ID": "redis-prod-2", - ... - } - ] -} -``` - -##### `contains` - -Determines if a needle is within an iterable element. - -```liquid -{{ if .Tags | contains "production" }} -# ... -{{ end }} -``` - -##### `containsAll` - -Returns `true` if all needles are within an iterable element, or `false` -otherwise. Returns `true` if the list of needles is empty. - -```liquid -{{ if containsAll $requiredTags .Tags }} -# ... -{{ end }} -``` - -##### `containsAny` - -Returns `true` if any needle is within an iterable element, or `false` -otherwise. Returns `false` if the list of needles is empty. - -```liquid -{{ if containsAny $acceptableTags .Tags }} -# ... -{{ end }} -``` - -##### `containsNone` - -Returns `true` if no needles are within an iterable element, or `false` -otherwise. Returns `true` if the list of needles is empty. - -```liquid -{{ if containsNone $forbiddenTags .Tags }} -# ... -{{ end }} -``` - -##### `containsNotAll` - -Returns `true` if some needle is not within an iterable element, or `false` -otherwise. Returns `false` if the list of needles is empty. - -```liquid -{{ if containsNotAll $excludingTags .Tags }} -# ... -{{ end }} -``` - -##### `env` - -Reads the given environment variable accessible to the current process. - -```liquid -{{ env "CLUSTER_ID" }} -``` - -This function can be chained to manipulate the output: - -```liquid -{{ env "CLUSTER_ID" | toLower }} -``` - -Reads the given environment variable and if it does not exist or is blank use a default value, ex `12345`. - -```liquid -{{ or (env "CLUSTER_ID") "12345" }} -``` - -##### `executeTemplate` - -Executes and returns a defined template. - -```liquid -{{ define "custom" }}my custom template{{ end }} - -This is my other template: -{{ executeTemplate "custom" }} - -And I can call it multiple times: -{{ executeTemplate "custom" }} - -Even with a new context: -{{ executeTemplate "custom" 42 }} - -Or save it to a variable: -{{ $var := executeTemplate "custom" }} -``` - -##### `explode` - -Takes the result from a `tree` or `ls` call and converts it into a deeply-nested -map for parsing/traversing. - -```liquid -{{ tree "config" | explode }} -``` - -Note: You will lose any metadata about the key-pair after it has been exploded. -You can also access deeply nested values: - -```liquid -{{ with tree "config" | explode }} -{{ .a.b.c }}{{ end }} -``` - -You will need to have a reasonable format about your data in Consul. Please see -[Go's text/template package][text-template] for more information. - - -##### `explodeMap` - -Takes the value of a map and converts it into a deeply-nested map for parsing/traversing, -using the same logic as `explode`. - -```liquid -{{ scratch.MapSet "example", "foo/bar", "a" }} -{{ scratch.MapSet "example", "foo/baz", "b" }} -{{ scratch.Get "example" | explodeMap | toYAML }} -``` - -##### `indent` - -Indents a block of text by prefixing N number of spaces per line. - -```liquid -{{ tree "foo" | explode | toYAML | indent 4 }} -``` - -##### `in` - -Determines if a needle is within an iterable element. - -```liquid -{{ if in .Tags "production" }} -# ... -{{ end }} -``` - -##### `loop` - -Accepts varying parameters and differs its behavior based on those parameters. - -If `loop` is given one integer, it will return a goroutine that begins at zero -and loops up to but not including the given integer: - -```liquid -{{ range loop 5 }} -# Comment{{end}} -``` - -If given two integers, this function will return a goroutine that begins at -the first integer and loops up to but not including the second integer: - -```liquid -{{ range $i := loop 5 8 }} -stanza-{{ $i }}{{ end }} -``` - -which would render: - -```text -stanza-5 -stanza-6 -stanza-7 -``` - -Note: It is not possible to get the index and the element since the function -returns a goroutine, not a slice. In other words, the following is **not -valid**: - -```liquid -# Will NOT work! -{{ range $i, $e := loop 5 8 }} -# ...{{ end }} -``` - -##### `join` - -Takes the given list of strings as a pipe and joins them on the provided string: - -```liquid -{{ $items | join "," }} -``` - -##### `trimSpace` - -Takes the provided input and trims all whitespace, tabs and newlines: - -```liquid -{{ file "/etc/ec2_version" | trimSpace }} -``` - -##### `parseBool` - -Takes the given string and parses it as a boolean: - -```liquid -{{ "true" | parseBool }} -``` - -This can be combined with a key and a conditional check, for example: - -```liquid -{{ if key "feature/enabled" | parseBool }}{{ end }} -``` - -##### `parseFloat` - -Takes the given string and parses it as a base-10 float64: - -```liquid -{{ "1.2" | parseFloat }} -``` - -##### `parseInt` - -Takes the given string and parses it as a base-10 int64: - -```liquid -{{ "1" | parseInt }} -``` - -This can be combined with other helpers, for example: - -```liquid -{{ range $i := loop key "config/pool_size" | parseInt }} -# ...{{ end }} -``` - -##### `parseJSON` - -Takes the given input (usually the value from a key) and parses the result as -JSON: - -```liquid -{{ with $d := key "user/info" | parseJSON }}{{ $d.name }}{{ end }} -``` - -Note: Consul Template evaluates the template multiple times, and on the first -evaluation the value of the key will be empty (because no data has been loaded -yet). This means that templates must guard against empty responses. - -##### `parseUint` - -Takes the given string and parses it as a base-10 int64: - -```liquid -{{ "1" | parseUint }} -``` - -##### `plugin` - -Takes the name of a plugin and optional payload and executes a Consul Template -plugin. - -```liquid -{{ plugin "my-plugin" }} -``` - -The plugin can take an arbitrary number of string arguments, and can be the -target of a pipeline that produces strings as well. This is most commonly -combined with a JSON filter for customization: - -```liquid -{{ tree "foo" | explode | toJSON | plugin "my-plugin" }} -``` - -Please see the [plugins](#plugins) section for more information about plugins. - -##### `regexMatch` - -Takes the argument as a regular expression and will return `true` if it matches -on the given string, or `false` otherwise. - -```liquid -{{ if "foo.bar" | regexMatch "foo([.a-z]+)" }} -# ... -{{ else }} -# ... -{{ end }} -``` - -##### `regexReplaceAll` - -Takes the argument as a regular expression and replaces all occurrences of the -regex with the given string. As in go, you can use variables like $1 to refer to -subexpressions in the replacement string. - -```liquid -{{ "foo.bar" | regexReplaceAll "foo([.a-z]+)" "$1" }} -``` - -##### `replaceAll` - -Takes the argument as a string and replaces all occurrences of the given string -with the given string. - -```liquid -{{ "foo.bar" | replaceAll "." "_" }} -``` - -This function can be chained with other functions as well: - -```liquid -{{ service "web" }}{{ .Name | replaceAll ":" "_" }}{{ end }} -``` - -##### `split` - -Splits the given string on the provided separator: - -```liquid -{{ "foo\nbar\n" | split "\n" }} -``` - -This can be combined with chained and piped with other functions: - -```liquid -{{ key "foo" | toUpper | split "\n" | join "," }} -``` - -##### `timestamp` - -Returns the current timestamp as a string (UTC). If no arguments are given, the -result is the current RFC3339 timestamp: - -```liquid -{{ timestamp }} // e.g. 1970-01-01T00:00:00Z -``` - -If the optional parameter is given, it is used to format the timestamp. The -magic reference date **Mon Jan 2 15:04:05 -0700 MST 2006** can be used to format -the date as required: - -```liquid -{{ timestamp "2006-01-02" }} // e.g. 1970-01-01 -``` - -See [Go's `time.Format`](http://golang.org/pkg/time/#Time.Format) for more -information. - -As a special case, if the optional parameter is `"unix"`, the unix timestamp in -seconds is returned as a string. - -```liquid -{{ timestamp "unix" }} // e.g. 0 -``` - -##### `toJSON` - -Takes the result from a `tree` or `ls` call and converts it into a JSON object. - -```liquid -{{ tree "config" | explode | toJSON }} -``` - -renders - -```javascript -{"admin":{"port":"1234"},"maxconns":"5","minconns":"2"} -``` - -Note: Consul stores all KV data as strings. Thus true is "true", 1 is "1", etc. - -##### `toJSONPretty` - -Takes the result from a `tree` or `ls` call and converts it into a -pretty-printed JSON object, indented by two spaces. - -```liquid -{{ tree "config" | explode | toJSONPretty }} -``` - -renders - -```javascript -{ - "admin": { - "port": "1234" - }, - "maxconns": "5", - "minconns": "2", -} -``` - -Note: Consul stores all KV data as strings. Thus true is "true", 1 is "1", etc. - -##### `toLower` - -Takes the argument as a string and converts it to lowercase. - -```liquid -{{ key "user/name" | toLower }} -``` - -See [Go's `strings.ToLower`](http://golang.org/pkg/strings/#ToLower) for more -information. - -##### `toTitle` - -Takes the argument as a string and converts it to titlecase. - -```liquid -{{ key "user/name" | toTitle }} -``` - -See [Go's `strings.Title`](http://golang.org/pkg/strings/#Title) for more -information. - -##### `toTOML` - -Takes the result from a `tree` or `ls` call and converts it into a TOML object. - -```liquid -{{ tree "config" | explode | toTOML }} -``` - -renders - -```toml -maxconns = "5" -minconns = "2" - -[admin] - port = "1134" -``` - -Note: Consul stores all KV data as strings. Thus true is "true", 1 is "1", etc. - -##### `toUpper` - -Takes the argument as a string and converts it to uppercase. - -```liquid -{{ key "user/name" | toUpper }} -``` - -See [Go's `strings.ToUpper`](http://golang.org/pkg/strings/#ToUpper) for more -information. - -##### `toYAML` - -Takes the result from a `tree` or `ls` call and converts it into a -pretty-printed YAML object, indented by two spaces. - -```liquid -{{ tree "config" | explode | toYAML }} -``` - -renders - -```yaml -admin: - port: "1234" -maxconns: "5" -minconns: "2" -``` - -Note: Consul stores all KV data as strings. Thus true is "true", 1 is "1", etc. - -##### `sockaddr` - -Takes a quote-escaped template string as an argument and passes it on to -[hashicorp/go-sockaddr](https://github.com/hashicorp/go-sockaddr) templating engine. - -```liquid -{{ sockaddr "GetPrivateIP" }} -``` - -See [hashicorp/go-sockaddr documentation](https://godoc.org/github.com/hashicorp/go-sockaddr) -for more information. - ---- - -#### Math Functions - -The following functions are available on floats and integer values. - -##### `add` - -Returns the sum of the two values. - -```liquid -{{ add 1 2 }} // 3 -``` - -This can also be used with a pipe function. - -```liquid -{{ 1 | add 2 }} // 3 -``` - -##### `subtract` - -Returns the difference of the second value from the first. - -```liquid -{{ subtract 2 5 }} // 3 -``` - -This can also be used with a pipe function. - -```liquid -{{ 5 | subtract 2 }} // 3 -``` - -Please take careful note of the order of arguments. - -##### `multiply` - -Returns the product of the two values. - -```liquid -{{ multiply 2 2 }} // 4 -``` - -This can also be used with a pipe function. - -```liquid -{{ 2 | multiply 2 }} // 4 -``` - -##### `divide` - -Returns the division of the second value from the first. - -```liquid -{{ divide 2 10 }} // 5 -``` - -This can also be used with a pipe function. - -```liquid -{{ 10 | divide 2 }} // 5 -``` - -Please take careful note of the order or arguments. - -##### `modulo` - -Returns the modulo of the second value from the first. - -```liquid -{{ modulo 2 5 }} // 1 -``` - -This can also be used with a pipe function. - -```liquid -{{ 5 | modulo 2 }} // 1 -``` - -Please take careful note of the order of arguments. - -## Plugins - -### Authoring Plugins - -For some use cases, it may be necessary to write a plugin that offloads work to -another system. This is especially useful for things that may not fit in the -"standard library" of Consul Template, but still need to be shared across -multiple instances. - -Consul Template plugins must have the following API: - -```shell -$ NAME [INPUT...] -``` - -- `NAME` - the name of the plugin - this is also the name of the binary, either - a full path or just the program name. It will be executed in a shell with the - inherited `PATH` so e.g. the plugin `cat` will run the first executable `cat` - that is found on the `PATH`. - -- `INPUT` - input from the template. There will be one INPUT for every argument passed - to the `plugin` function. If the arguments contain whitespace, that whitespace - will be passed as if the argument were quoted by the shell. - -#### Important Notes - -- Plugins execute user-provided scripts and pass in potentially sensitive data - from Consul or Vault. Nothing is validated or protected by Consul Template, - so all necessary precautions and considerations should be made by template - authors - -- Plugin output must be returned as a string on stdout. Only stdout will be - parsed for output. Be sure to log all errors, debugging messages onto stderr - to avoid errors when Consul Template returns the value. Note that output to - stderr will only be output if the plugin returns a non-zero exit code. - -- Always `exit 0` or Consul Template will assume the plugin failed to execute - -- Ensure the empty input case is handled correctly (see [Multi-phase execution](#multi-phase-execution)) - -- Data piped into the plugin is appended after any parameters given explicitly (eg `{{ "sample-data" | plugin "my-plugin" "some-parameter"}}` will call `my-plugin some-parameter sample-data`) - -Here is a sample plugin in a few different languages that removes any JSON keys -that start with an underscore and returns the JSON string: - -```ruby -#! /usr/bin/env ruby -require "json" - -if ARGV.empty? - puts JSON.fast_generate({}) - Kernel.exit(0) -end - -hash = JSON.parse(ARGV.first) -hash.reject! { |k, _| k.start_with?("_") } -puts JSON.fast_generate(hash) -Kernel.exit(0) -``` - -```go -func main() { - arg := []byte(os.Args[1]) - - var parsed map[string]interface{} - if err := json.Unmarshal(arg, &parsed); err != nil { - fmt.Fprintln(os.Stderr, fmt.Sprintf("err: %s", err)) - os.Exit(1) - } - - for k, _ := range parsed { - if string(k[0]) == "_" { - delete(parsed, k) - } - } - - result, err := json.Marshal(parsed) - if err != nil { - fmt.Fprintln(os.Stderr, fmt.Sprintf("err: %s", err)) - os.Exit(1) - } - - fmt.Fprintln(os.Stdout, fmt.Sprintf("%s", result)) - os.Exit(0) -} -``` - -## Caveats - -### Docker Image Use - -The Alpine Docker image is configured to support an external volume to render -shared templates to. If mounted you will need to make sure that the -consul-template user in the docker image has write permissions to the -directory. Also if you build your own image using these you need to be sure you -have the permissions correct. - -**The consul-template user in docker has a UID of 100 and a GID of 1000.** - -This effects the in image directories /consul-template/config, used to add -configuration when using this as a parent image, and /consul-template/data, -exported as a VOLUME as a location to render shared results. - -Previously the image initially ran as root in order to ensure the permissions -allowed it. But this ran against docker best practices and security policies. - -If you build your own image based on ours you can override these values with -`--build-arg` parameters. - -### Dots in Service Names - -Using dots `.` in service names will conflict with the use of dots for [TAG -delineation](https://github.com/hashicorp/consul-template#service) in the -template. Dots already [interfere with using -DNS](https://www.consul.io/docs/agent/services.html#service-and-tag-names-with-dns) -for service names, so we recommend avoiding dots wherever possible. - -### Once Mode - -In Once mode, Consul Template will wait for all dependencies to be rendered. If -a template specifies a dependency (a request) that does not exist in Consul, -once mode will wait until Consul returns data for that dependency. Please note -that "returned data" and "empty data" are not mutually exclusive. - -When you query for all healthy services named "foo" (`{{ service "foo" }}`), you -are asking Consul - "give me all the healthy services named foo". If there are -no services named foo, the response is the empty array. This is also the same -response if there are no _healthy_ services named foo. - -Consul template processes input templates multiple times, since the first result -could impact later dependencies: - -```liquid -{{ range services }} -{{ range service .Name }} -{{ end }} -{{ end }} -``` - -In this example, we have to process the output of `services` before we can -lookup each `service`, since the inner loops cannot be evaluated until the outer -loop returns a response. Consul Template waits until it gets a response from -Consul for all dependencies before rendering a template. It does not wait until -that response is non-empty though. - -**Note:** Once mode implicitly disables any wait/quiescence timers specified in configuration files or passed on the command line. - -### Exec Mode - -As of version 0.16.0, Consul Template has the ability to maintain an arbitrary -child process (similar to [envconsul](https://github.com/hashicorp/envconsul)). -This mode is most beneficial when running Consul Template in a container or on a -scheduler like [Nomad](https://www.nomadproject.io) or Kubernetes. When -activated, Consul Template will spawn and manage the lifecycle of the child -process. - -This mode is best-explained through example. Consider a simple application that -reads a configuration file from disk and spawns a server from that -configuration. - -```sh -$ consul-template \ - -template "/tmp/config.ctmpl:/tmp/server.conf" \ - -exec "/bin/my-server -config /tmp/server.conf" -``` - -When Consul Template starts, it will pull the required dependencies and populate -the `/tmp/server.conf`, which the `my-server` binary consumes. After that -template is rendered completely the first time, Consul Template spawns and -manages a child process. When any of the list templates change, Consul Template -will send a configurable reload signal to the child process. Additionally, -Consul Template will proxy any signals it receives to the child process. This -enables a scheduler to control the lifecycle of the process and also eases the -friction of running inside a container. - -A common point of confusion is that the command string behaves the same as the -shell; it does not. In the shell, when you run `foo | bar` or `foo > bar`, that -is actually running as a subprocess of your shell (bash, zsh, csh, etc.). When -Consul Template spawns the exec process, it runs outside of your shell. This -behavior is _different_ from when Consul Template executes the template-specific -reload command. If you want the ability to pipe or redirect in the exec command, -you will need to spawn the process in subshell, for example: - -```hcl -exec { - command = "/bin/bash -c 'my-server > /var/log/my-server.log'" -} -``` - -Note that when spawning like this, most shells do not proxy signals to their -child by default, so your child process will not receive the signals that Consul -Template sends to the shell. You can avoid this by writing a tiny shell wrapper -and executing that instead: - -```bash -#!/usr/bin/env bash -trap "kill -TERM $child" SIGTERM - -/bin/my-server -config /tmp/server.conf -child=$! -wait "$child" -``` - -Alternatively, you can use your shell's exec function directly, if it exists: - -```bash -#!/usr/bin/env bash -exec /bin/my-server -config /tmp/server.conf > /var/log/my-server.log -``` - -There are some additional caveats with Exec Mode, which should be considered -carefully before use: - -- If the child process dies, the Consul Template process will also die. Consul - Template **does not supervise the process!** This is generally the - responsibility of the scheduler or init system. - -- The child process must remain in the foreground. This is a requirement for - Consul Template to manage the process and send signals. - -- The exec command will only start after _all_ templates have been rendered at - least once. One may have multiple templates for a single Consul Template - process, all of which must be rendered before the process starts. Consider - something like an nginx or apache configuration where both the process - configuration file and individual site configuration must be written in order - for the service to successfully start. - -- After the child process is started, any change to any dependent template will - cause the reload signal to be sent to the child process. If no reload signal - is provided, Consul Template will kill the process and spawn a new instance. - The reload signal can be specified and customized via the CLI or configuration - file. - -- When Consul Template is stopped gracefully, it will send the configurable kill - signal to the child process. The default value is SIGTERM, but it can be - customized via the CLI or configuration file. - -- Consul Template will forward all signals it receives to the child process - **except** its defined `reload_signal` and `kill_signal`. If you disable these - signals, Consul Template will forward them to the child process. - -- It is not possible to have more than one exec command (although each template - can still have its own reload command). - -- Individual template reload commands still fire independently of the exec - command. - -### De-Duplication Mode - -Consul Template works by parsing templates to determine what data is needed and -then watching Consul for any changes to that data. This allows Consul Template -to efficiently re-render templates when a change occurs. However, if there are -many instances of Consul Template rendering a common template there is a linear -duplication of work as each instance is querying the same data. - -To make this pattern more efficient Consul Template supports work de-duplication -across instances. This can be enabled with the `-dedup` flag or via the -`deduplicate` configuration block. Once enabled, Consul Template uses leader -election on a per-template basis to have only a single node perform the queries. -Results are shared among other instances rendering the same template by passing -compressed data through the Consul K/V store. - -Please note that no Vault data will be stored in the compressed template. -Because ACLs around Vault are typically more closely controlled than those ACLs -around Consul's KV, Consul Template will still request the secret from Vault on -each iteration. - -When running in de-duplication mode, it is important that local template -functions resolve correctly. For example, you may have a local template function -that relies on the `env` helper like this: - -```hcl -{{ key (env "KEY") }} -``` - -It is crucial that the environment variable `KEY` in this example is consistent -across all machines engaged in de-duplicating this template. If the values are -different, Consul Template will be unable to resolve the template, and you will -not get a successful render. - -### Termination on Error - -By default Consul Template is highly fault-tolerant. If Consul is unreachable or -a template changes, Consul Template will happily continue running. The only -exception to this rule is if the optional `command` exits non-zero. In this -case, Consul Template will also exit non-zero. The reason for this decision is -so the user can easily configure something like Upstart or God to manage Consul -Template as a service. - -If you want Consul Template to continue watching for changes, even if the -optional command argument fails, you can append `|| true` to your command. Note -that `||` is a "shell-ism", not a built-in function. You will also need to run -your command under a shell: - -```shell -$ consul-template \ - -template "in.ctmpl:out.file:/bin/bash -c 'service nginx restart || true'" -``` - -In this example, even if the Nginx restart command returns non-zero, the overall -function will still return an OK exit code; Consul Template will continue to run -as a service. Additionally, if you have complex logic for restarting your -service, you can intelligently choose when you want Consul Template to exit and -when you want it to continue to watch for changes. For these types of complex -scripts, we recommend using a custom sh or bash script instead of putting the -logic directly in the `consul-template` command or configuration file. - -### Command Environment - -The current processes environment is used when executing commands with the following additional environment variables: - -- `CONSUL_HTTP_ADDR` -- `CONSUL_HTTP_TOKEN` -- `CONSUL_HTTP_AUTH` -- `CONSUL_HTTP_SSL` -- `CONSUL_HTTP_SSL_VERIFY` - -These environment variables are exported with their current values when the -command executes. Other Consul tooling reads these environment variables, -providing smooth integration with other Consul tools (like `consul maint` or -`consul lock`). Additionally, exposing these environment variables gives power -users the ability to further customize their command script. - -### Multi-phase Execution - -Consul Template does an n-pass evaluation of templates, accumulating -dependencies on each pass. This is required due to nested dependencies, such as: - -```liquid -{{ range services }} -{{ range service .Name }} - {{ .Address }} -{{ end }}{{ end }} -``` - -During the first pass, Consul Template does not know any of the services in -Consul, so it has to perform a query. When those results are returned, the -inner-loop is then evaluated with that result, potentially creating more queries -and watches. - -Because of this implementation, template functions need a default value that is -an acceptable parameter to a `range` function (or similar), but does not -actually execute the inner loop (which would cause a panic). This is important -to mention because complex templates **must** account for the "empty" case. For -example, the following **will not work**: - -```liquid -{{ with index (service "foo") 0 }} -# ... -{{ end }} -``` - -This will raise an error like: - -```text -: error calling index: index out of range: 0 -``` - -That is because, during the _first_ evaluation of the template, the `service` -key is returning an empty slice. You can account for this in your template like -so: - -```liquid -{{ with service "foo" }} -{{ with index . 0 }} -{{ .Node }}{{ end }}{{ end }} -``` - -This will still add the dependency to the list of watches, but will not -evaluate the inner-if, avoiding the out-of-index error. - -## Running and Process Lifecycle - -While there are multiple ways to run Consul Template, the most common pattern is -to run Consul Template as a system service. When Consul Template first starts, -it reads any configuration files and templates from disk and loads them into -memory. From that point forward, changes to the files on disk do not propagate -to running process without a reload. - -The reason for this behavior is simple and aligns with other tools like haproxy. -A user may want to perform pre-flight validation checks on the configuration or -templates before loading them into the process. Additionally, a user may want to -update configuration and templates simultaneously. Having Consul Template -automatically watch and reload those files on changes is both operationally -dangerous and against some of the paradigms of modern infrastructure. Instead, -Consul Template listens for the `SIGHUP` syscall to trigger a configuration -reload. If you update configuration or templates, simply send `HUP` to the -running Consul Template process and Consul Template will reload all the -configurations and templates from disk. - -## Debugging - -Consul Template can print verbose debugging output. To set the log level for -Consul Template, use the `-log-level` flag: - -```shell -$ consul-template -log-level info ... -``` - -```text - [INFO] (cli) received redis from Watcher - [INFO] (cli) invoking Runner -# ... -``` - -You can also specify the level as debug: - -```shell -$ consul-template -log-level debug ... -``` - -```text - [DEBUG] (cli) creating Runner - [DEBUG] (cli) creating Consul API client - [DEBUG] (cli) creating Watcher - [DEBUG] (cli) looping for data - [DEBUG] (watcher) starting watch - [DEBUG] (watcher) all pollers have started, waiting for finish - [DEBUG] (redis) starting poll - [DEBUG] (service redis) querying Consul with &{...} - [DEBUG] (service redis) Consul returned 2 services - [DEBUG] (redis) writing data to channel - [DEBUG] (redis) starting poll - [INFO] (cli) received redis from Watcher - [INFO] (cli) invoking Runner - [DEBUG] (service redis) querying Consul with &{...} -# ... -``` - - -## FAQ - -**Q: How is this different than confd?**
-A: The answer is simple: Service Discovery as a first class citizen. You are also encouraged to read [this Pull Request](https://github.com/kelseyhightower/confd/pull/102) on the project for more background information. We think confd is a great project, but Consul Template fills a missing gap. Additionally, Consul Template has first class integration with [Vault](https://vaultproject.io), making it easy to incorporate secret material like database credentials or API tokens into configuration files. - -**Q: How is this different than Puppet/Chef/Ansible/Salt?**
-A: Configuration management tools are designed to be used in unison with Consul Template. Instead of rendering a stale configuration file, use your configuration management software to render a dynamic template that will be populated by [Consul][]. - - -## Contributing - -To build and install Consul-Template locally, you will need to [install Go][go]. - -Clone the repository: - -```shell -$ git clone https://github.com/hashicorp/consul-template.git -``` - -To compile the `consul-template` binary for your local machine: - -```shell -$ make dev -``` - -This will compile the `consul-template` binary into `bin/consul-template` as -well as your `$GOPATH` and run the test suite. - -If you want to compile a specific binary, set `XC_OS` and `XC_ARCH` or run the -following to generate all binaries: - -```shell -$ make build -``` - -If you want to run the tests, first install [consul](https://www.consul.io/docs/install/index.html) and [vault](https://www.vaultproject.io/docs/install/) locally, then: - -```shell -$ make test -``` - -Or to run a specific test in the suite: - -```shell -go test ./... -run SomeTestFunction_name -``` - -[consul]: https://www.consul.io "Consul by HashiCorp" -[connect]: https://www.consul.io/docs/connect/ "Connect" -[examples]: (https://github.com/hashicorp/consul-template/tree/master/examples) "Consul Template Examples" -[hcl]: https://github.com/hashicorp/hcl "HashiCorp Configuration Language (hcl)" -[releases]: https://releases.hashicorp.com/consul-template "Consul Template Releases" -[text-template]: https://golang.org/pkg/text/template/ "Go's text/template package" -[vault]: https://www.vaultproject.io "Vault by HashiCorp" -[go]: https://golang.org "Go programming language" diff --git a/vendor/github.com/hashicorp/consul-template/cli.go b/vendor/github.com/hashicorp/consul-template/cli.go deleted file mode 100644 index afff0d06b941..000000000000 --- a/vendor/github.com/hashicorp/consul-template/cli.go +++ /dev/null @@ -1,799 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "io" - "io/ioutil" - "log" - "os" - "os/signal" - "sync" - "time" - - "github.com/hashicorp/consul-template/config" - "github.com/hashicorp/consul-template/logging" - "github.com/hashicorp/consul-template/manager" - "github.com/hashicorp/consul-template/signals" - "github.com/hashicorp/consul-template/version" -) - -// Exit codes are int values that represent an exit code for a particular error. -// Sub-systems may check this unique error to determine the cause of an error -// without parsing the output or help text. -// -// Errors start at 10 -const ( - ExitCodeOK int = 0 - - ExitCodeError = 10 + iota - ExitCodeInterrupt - ExitCodeParseFlagsError - ExitCodeRunnerError - ExitCodeConfigError -) - -// CLI is the main entry point. -type CLI struct { - sync.Mutex - - // outSteam and errStream are the standard out and standard error streams to - // write messages from the CLI. - outStream, errStream io.Writer - - // signalCh is the channel where the cli receives signals. - signalCh chan os.Signal - - // stopCh is an internal channel used to trigger a shutdown of the CLI. - stopCh chan struct{} - stopped bool -} - -// NewCLI creates a new CLI object with the given stdout and stderr streams. -func NewCLI(out, err io.Writer) *CLI { - return &CLI{ - outStream: out, - errStream: err, - signalCh: make(chan os.Signal, 1), - stopCh: make(chan struct{}), - } -} - -// Run accepts a slice of arguments and returns an int representing the exit -// status from the command. -func (cli *CLI) Run(args []string) int { - // Parse the flags - config, paths, dry, isVersion, err := cli.ParseFlags(args[1:]) - if err != nil { - if err == flag.ErrHelp { - fmt.Fprintf(cli.errStream, usage, version.Name) - return 0 - } - fmt.Fprintln(cli.errStream, err.Error()) - return ExitCodeParseFlagsError - } - - // Save original config (defaults + parsed flags) for handling reloads - cliConfig := config.Copy() - - // Load configuration paths, with CLI taking precedence - config, err = loadConfigs(paths, cliConfig) - if err != nil { - return logError(err, ExitCodeConfigError) - } - - config.Finalize() - - // Setup the config and logging - config, err = cli.setup(config) - if err != nil { - return logError(err, ExitCodeConfigError) - } - - // Print version information for debugging - log.Printf("[INFO] %s", version.HumanVersion) - - // If the version was requested, return an "error" containing the version - // information. This might sound weird, but most *nix applications actually - // print their version on stderr anyway. - if isVersion { - log.Printf("[DEBUG] (cli) version flag was given, exiting now") - fmt.Fprintf(cli.errStream, "%s\n", version.HumanVersion) - return ExitCodeOK - } - - // Initial runner - runner, err := manager.NewRunner(config, dry) - if err != nil { - return logError(err, ExitCodeRunnerError) - } - go runner.Start() - - // Listen for signals - signal.Notify(cli.signalCh) - - for { - select { - case err := <-runner.ErrCh: - // Check if the runner's error returned a specific exit status, and return - // that value. If no value was given, return a generic exit status. - code := ExitCodeRunnerError - if typed, ok := err.(manager.ErrExitable); ok { - code = typed.ExitStatus() - } - return logError(err, code) - case <-runner.DoneCh: - return ExitCodeOK - case s := <-cli.signalCh: - log.Printf("[DEBUG] (cli) receiving signal %q", s) - - switch s { - case *config.ReloadSignal: - fmt.Fprintf(cli.errStream, "Reloading configuration...\n") - runner.Stop() - - // Re-parse any configuration files or paths - config, err = loadConfigs(paths, cliConfig) - if err != nil { - return logError(err, ExitCodeConfigError) - } - config.Finalize() - - // Load the new configuration from disk - config, err = cli.setup(config) - if err != nil { - return logError(err, ExitCodeConfigError) - } - - runner, err = manager.NewRunner(config, dry) - if err != nil { - return logError(err, ExitCodeRunnerError) - } - go runner.Start() - case *config.KillSignal: - fmt.Fprintf(cli.errStream, "Cleaning up...\n") - runner.StopImmediately() - return ExitCodeInterrupt - case signals.SignalLookup["SIGCHLD"]: - // The SIGCHLD signal is sent to the parent of a child process when it - // exits, is interrupted, or resumes after being interrupted. We ignore - // this signal because the child process is monitored on its own. - // - // Also, the reason we do a lookup instead of a direct syscall.SIGCHLD - // is because that isn't defined on Windows. - default: - // Propagate the signal to the child process - runner.Signal(s) - } - case <-cli.stopCh: - return ExitCodeOK - } - } -} - -// stop is used internally to shutdown a running CLI -func (cli *CLI) stop() { - cli.Lock() - defer cli.Unlock() - - if cli.stopped { - return - } - - close(cli.stopCh) - cli.stopped = true -} - -// ParseFlags is a helper function for parsing command line flags using Go's -// Flag library. This is extracted into a helper to keep the main function -// small, but it also makes writing tests for parsing command line arguments -// much easier and cleaner. -func (cli *CLI) ParseFlags(args []string) ( - *config.Config, []string, bool, bool, error, -) { - var dry, isVersion bool - - c := config.DefaultConfig() - - if s := os.Getenv("CT_LOCAL_CONFIG"); s != "" { - envConfig, err := config.Parse(s) - if err != nil { - return nil, nil, false, false, err - } - c = c.Merge(envConfig) - } - - // configPaths stores the list of configuration paths on disk - configPaths := make([]string, 0, 6) - - // Parse the flags and options - flags := flag.NewFlagSet(version.Name, flag.ContinueOnError) - flags.SetOutput(ioutil.Discard) - flags.Usage = func() {} - - flags.Var((funcVar)(func(s string) error { - configPaths = append(configPaths, s) - return nil - }), "config", "") - - flags.Var((funcVar)(func(s string) error { - c.Consul.Address = config.String(s) - return nil - }), "consul-addr", "") - - flags.Var((funcVar)(func(s string) error { - a, err := config.ParseAuthConfig(s) - if err != nil { - return err - } - c.Consul.Auth = a - return nil - }), "consul-auth", "") - - flags.Var((funcBoolVar)(func(b bool) error { - c.Consul.Retry.Enabled = config.Bool(b) - return nil - }), "consul-retry", "") - - flags.Var((funcIntVar)(func(i int) error { - c.Consul.Retry.Attempts = config.Int(i) - return nil - }), "consul-retry-attempts", "") - - flags.Var((funcDurationVar)(func(d time.Duration) error { - c.Consul.Retry.Backoff = config.TimeDuration(d) - return nil - }), "consul-retry-backoff", "") - - flags.Var((funcDurationVar)(func(d time.Duration) error { - c.Consul.Retry.MaxBackoff = config.TimeDuration(d) - return nil - }), "consul-retry-max-backoff", "") - - flags.Var((funcBoolVar)(func(b bool) error { - c.Consul.SSL.Enabled = config.Bool(b) - return nil - }), "consul-ssl", "") - - flags.Var((funcVar)(func(s string) error { - c.Consul.SSL.CaCert = config.String(s) - return nil - }), "consul-ssl-ca-cert", "") - - flags.Var((funcVar)(func(s string) error { - c.Consul.SSL.CaPath = config.String(s) - return nil - }), "consul-ssl-ca-path", "") - - flags.Var((funcVar)(func(s string) error { - c.Consul.SSL.Cert = config.String(s) - return nil - }), "consul-ssl-cert", "") - - flags.Var((funcVar)(func(s string) error { - c.Consul.SSL.Key = config.String(s) - return nil - }), "consul-ssl-key", "") - - flags.Var((funcVar)(func(s string) error { - c.Consul.SSL.ServerName = config.String(s) - return nil - }), "consul-ssl-server-name", "") - - flags.Var((funcBoolVar)(func(b bool) error { - c.Consul.SSL.Verify = config.Bool(b) - return nil - }), "consul-ssl-verify", "") - - flags.Var((funcVar)(func(s string) error { - c.Consul.Token = config.String(s) - return nil - }), "consul-token", "") - - flags.Var((funcDurationVar)(func(d time.Duration) error { - c.Consul.Transport.DialKeepAlive = config.TimeDuration(d) - return nil - }), "consul-transport-dial-keep-alive", "") - - flags.Var((funcDurationVar)(func(d time.Duration) error { - c.Consul.Transport.DialTimeout = config.TimeDuration(d) - return nil - }), "consul-transport-dial-timeout", "") - - flags.Var((funcBoolVar)(func(b bool) error { - c.Consul.Transport.DisableKeepAlives = config.Bool(b) - return nil - }), "consul-transport-disable-keep-alives", "") - - flags.Var((funcIntVar)(func(i int) error { - c.Consul.Transport.MaxIdleConnsPerHost = config.Int(i) - return nil - }), "consul-transport-max-idle-conns-per-host", "") - - flags.Var((funcDurationVar)(func(d time.Duration) error { - c.Consul.Transport.TLSHandshakeTimeout = config.TimeDuration(d) - return nil - }), "consul-transport-tls-handshake-timeout", "") - - flags.Var((funcBoolVar)(func(b bool) error { - c.Dedup.Enabled = config.Bool(b) - return nil - }), "dedup", "") - - flags.BoolVar(&dry, "dry", false, "") - - flags.Var((funcVar)(func(s string) error { - c.Exec.Enabled = config.Bool(true) - c.Exec.Command = config.String(s) - return nil - }), "exec", "") - - flags.Var((funcVar)(func(s string) error { - sig, err := signals.Parse(s) - if err != nil { - return err - } - c.Exec.KillSignal = config.Signal(sig) - return nil - }), "exec-kill-signal", "") - - flags.Var((funcDurationVar)(func(d time.Duration) error { - c.Exec.KillTimeout = config.TimeDuration(d) - return nil - }), "exec-kill-timeout", "") - - flags.Var((funcVar)(func(s string) error { - sig, err := signals.Parse(s) - if err != nil { - return err - } - c.Exec.ReloadSignal = config.Signal(sig) - return nil - }), "exec-reload-signal", "") - - flags.Var((funcDurationVar)(func(d time.Duration) error { - c.Exec.Splay = config.TimeDuration(d) - return nil - }), "exec-splay", "") - - flags.Var((funcVar)(func(s string) error { - sig, err := signals.Parse(s) - if err != nil { - return err - } - c.KillSignal = config.Signal(sig) - return nil - }), "kill-signal", "") - - flags.Var((funcVar)(func(s string) error { - c.LogLevel = config.String(s) - return nil - }), "log-level", "") - - flags.Var((funcDurationVar)(func(d time.Duration) error { - c.MaxStale = config.TimeDuration(d) - return nil - }), "max-stale", "") - - flags.Var((funcBoolVar)(func(b bool) error { - c.Once = *(config.Bool(b)) - return nil - }), "once", "") - - flags.Var((funcVar)(func(s string) error { - c.PidFile = config.String(s) - return nil - }), "pid-file", "") - - flags.Var((funcVar)(func(s string) error { - sig, err := signals.Parse(s) - if err != nil { - return err - } - c.ReloadSignal = config.Signal(sig) - return nil - }), "reload-signal", "") - - flags.Var((funcDurationVar)(func(d time.Duration) error { - c.Consul.Retry.Backoff = config.TimeDuration(d) - return nil - }), "retry", "") - - flags.Var((funcBoolVar)(func(b bool) error { - c.Syslog.Enabled = config.Bool(b) - return nil - }), "syslog", "") - - flags.Var((funcVar)(func(s string) error { - c.Syslog.Facility = config.String(s) - return nil - }), "syslog-facility", "") - - flags.Var((funcVar)(func(s string) error { - t, err := config.ParseTemplateConfig(s) - if err != nil { - return err - } - *c.Templates = append(*c.Templates, t) - return nil - }), "template", "") - - flags.Var((funcVar)(func(s string) error { - c.Vault.Address = config.String(s) - return nil - }), "vault-addr", "") - - flags.Var((funcBoolVar)(func(b bool) error { - c.Vault.RenewToken = config.Bool(b) - return nil - }), "vault-renew-token", "") - - flags.Var((funcBoolVar)(func(b bool) error { - c.Vault.Retry.Enabled = config.Bool(b) - return nil - }), "vault-retry", "") - - flags.Var((funcIntVar)(func(i int) error { - c.Vault.Retry.Attempts = config.Int(i) - return nil - }), "vault-retry-attempts", "") - - flags.Var((funcDurationVar)(func(d time.Duration) error { - c.Vault.Retry.Backoff = config.TimeDuration(d) - return nil - }), "vault-retry-backoff", "") - - flags.Var((funcDurationVar)(func(d time.Duration) error { - c.Vault.Retry.MaxBackoff = config.TimeDuration(d) - return nil - }), "vault-retry-max-backoff", "") - - flags.Var((funcBoolVar)(func(b bool) error { - c.Vault.SSL.Enabled = config.Bool(b) - return nil - }), "vault-ssl", "") - - flags.Var((funcVar)(func(s string) error { - c.Vault.SSL.CaCert = config.String(s) - return nil - }), "vault-ssl-ca-cert", "") - - flags.Var((funcVar)(func(s string) error { - c.Vault.SSL.CaPath = config.String(s) - return nil - }), "vault-ssl-ca-path", "") - - flags.Var((funcVar)(func(s string) error { - c.Vault.SSL.Cert = config.String(s) - return nil - }), "vault-ssl-cert", "") - - flags.Var((funcVar)(func(s string) error { - c.Vault.SSL.Key = config.String(s) - return nil - }), "vault-ssl-key", "") - - flags.Var((funcVar)(func(s string) error { - c.Vault.SSL.ServerName = config.String(s) - return nil - }), "vault-ssl-server-name", "") - - flags.Var((funcBoolVar)(func(b bool) error { - c.Vault.SSL.Verify = config.Bool(b) - return nil - }), "vault-ssl-verify", "") - - flags.Var((funcDurationVar)(func(d time.Duration) error { - c.Vault.Transport.DialKeepAlive = config.TimeDuration(d) - return nil - }), "vault-transport-dial-keep-alive", "") - - flags.Var((funcDurationVar)(func(d time.Duration) error { - c.Vault.Transport.DialTimeout = config.TimeDuration(d) - return nil - }), "vault-transport-dial-timeout", "") - - flags.Var((funcBoolVar)(func(b bool) error { - c.Vault.Transport.DisableKeepAlives = config.Bool(b) - return nil - }), "vault-transport-disable-keep-alives", "") - - flags.Var((funcIntVar)(func(i int) error { - c.Vault.Transport.MaxIdleConnsPerHost = config.Int(i) - return nil - }), "vault-transport-max-idle-conns-per-host", "") - - flags.Var((funcDurationVar)(func(d time.Duration) error { - c.Vault.Transport.TLSHandshakeTimeout = config.TimeDuration(d) - return nil - }), "vault-transport-tls-handshake-timeout", "") - - flags.Var((funcVar)(func(s string) error { - c.Vault.Token = config.String(s) - return nil - }), "vault-token", "") - - flags.Var((funcVar)(func(s string) error { - c.Vault.VaultAgentTokenFile = config.String(s) - return nil - }), "vault-agent-token-file", "") - - flags.Var((funcBoolVar)(func(b bool) error { - c.Vault.UnwrapToken = config.Bool(b) - return nil - }), "vault-unwrap-token", "") - - flags.Var((funcVar)(func(s string) error { - w, err := config.ParseWaitConfig(s) - if err != nil { - return err - } - c.Wait = w - return nil - }), "wait", "") - - flags.BoolVar(&isVersion, "v", false, "") - flags.BoolVar(&isVersion, "version", false, "") - - // If there was a parser error, stop - if err := flags.Parse(args); err != nil { - return nil, nil, false, false, err - } - - // Error if extra arguments are present - args = flags.Args() - if len(args) > 0 { - return nil, nil, false, false, fmt.Errorf("cli: extra args: %q", args) - } - - return c, configPaths, dry, isVersion, nil -} - -// loadConfigs loads the configuration from the list of paths. The optional -// configuration is the list of overrides to apply at the very end, taking -// precedence over any configurations that were loaded from the paths. If any -// errors occur when reading or parsing those sub-configs, it is returned. -func loadConfigs(paths []string, o *config.Config) (*config.Config, error) { - finalC := config.DefaultConfig() - - for _, path := range paths { - c, err := config.FromPath(path) - if err != nil { - return nil, err - } - - finalC = finalC.Merge(c) - } - - finalC = finalC.Merge(o) - finalC.Finalize() - return finalC, nil -} - -// logError logs an error message and then returns the given status. -func logError(err error, status int) int { - log.Printf("[ERR] (cli) %s", err) - return status -} - -func (cli *CLI) setup(conf *config.Config) (*config.Config, error) { - if err := logging.Setup(&logging.Config{ - Name: version.Name, - Level: config.StringVal(conf.LogLevel), - Syslog: config.BoolVal(conf.Syslog.Enabled), - SyslogFacility: config.StringVal(conf.Syslog.Facility), - Writer: cli.errStream, - }); err != nil { - return nil, err - } - - return conf, nil -} - -const usage = `Usage: %s [options] - - Watches a series of templates on the file system, writing new changes when - Consul is updated. It runs until an interrupt is received unless the -once - flag is specified. - -Options: - - -config= - Sets the path to a configuration file or folder on disk. This can be - specified multiple times to load multiple files or folders. If multiple - values are given, they are merged left-to-right, and CLI arguments take - the top-most precedence. - - -consul-addr=
- Sets the address of the Consul instance - - -consul-auth= - Set the basic authentication username and password for communicating - with Consul. - - -consul-retry - Use retry logic when communication with Consul fails - - -consul-retry-attempts= - The number of attempts to use when retrying failed communications - - -consul-retry-backoff= - The base amount to use for the backoff duration. This number will be - increased exponentially for each retry attempt. - - -consul-retry-max-backoff= - The maximum limit of the retry backoff duration. Default is one minute. - 0 means infinite. The backoff will increase exponentially until given value. - - -consul-ssl - Use SSL when connecting to Consul - - -consul-ssl-ca-cert= - Validate server certificate against this CA certificate file list - - -consul-ssl-ca-path= - Sets the path to the CA to use for TLS verification - - -consul-ssl-cert= - SSL client certificate to send to server - - -consul-ssl-key= - SSL/TLS private key for use in client authentication key exchange - - -consul-ssl-server-name= - Sets the name of the server to use when validating TLS. - - -consul-ssl-verify - Verify certificates when connecting via SSL - - -consul-token= - Sets the Consul API token - - -consul-transport-dial-keep-alive= - Sets the amount of time to use for keep-alives - - -consul-transport-dial-timeout= - Sets the amount of time to wait to establish a connection - - -consul-transport-disable-keep-alives - Disables keep-alives (this will impact performance) - - -consul-transport-max-idle-conns-per-host= - Sets the maximum number of idle connections to permit per host - - -consul-transport-tls-handshake-timeout= - Sets the handshake timeout - - -dedup - Enable de-duplication mode - reduces load on Consul when many instances of - Consul Template are rendering a common template - - -dry - Print generated templates to stdout instead of rendering - - -exec= - Enable exec mode to run as a supervisor-like process - the given command - will receive all signals provided to the parent process and will receive a - signal when templates change - - -exec-kill-signal= - Signal to send when gracefully killing the process - - -exec-kill-timeout= - Amount of time to wait before force-killing the child - - -exec-reload-signal= - Signal to send when a reload takes place - - -exec-splay= - Amount of time to wait before sending signals - - -kill-signal= - Signal to listen to gracefully terminate the process - - -log-level= - Set the logging level - values are "debug", "info", "warn", and "err" - - -max-stale= - Set the maximum staleness and allow stale queries to Consul which will - distribute work among all servers instead of just the leader - - -once - Do not run the process as a daemon. This disables wait/quiescence timers. - - -pid-file= - Path on disk to write the PID of the process - - -reload-signal= - Signal to listen to reload configuration - - -retry= - The amount of time to wait if Consul returns an error when communicating - with the API - - -syslog - Send the output to syslog instead of standard error and standard out. The - syslog facility defaults to LOCAL0 and can be changed using a - configuration file - - -syslog-facility= - Set the facility where syslog should log - if this attribute is supplied, - the -syslog flag must also be supplied - - -template=